:root {
    --bg-primary: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1f2937;
    --primary: #15803d; /* Verde Recon */
    --primary-hover: #166534;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --border: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: 'Inter', 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    background: var(--bg-primary);
    color: var(--text-main);
    line-height: 1.5;
}

.main-header {
    background: var(--card-bg);
    padding: 15px 30px;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--primary);
}

.main-header h1 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.main-header .user-info {
    font-size: 0.9rem;
    color: #6b7280;
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap; /* Para telas pequenas */
    justify-content: center;
}

.header-logo-container {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}
.header-logo { 
    height: 40px !important; 
    max-height: 40px; 
    width: auto; 
    object-fit: contain; 
}
.header-church-name { margin: 0; font-size: 1.2rem; color: var(--primary); text-transform: uppercase; text-align: center;}

.main-header a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.main-header a:hover {
    text-decoration: underline;
}

.container {
    padding: 30px 20px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

/* Tipografia */
h2 { color: var(--primary); margin-top: 0; font-weight: 700; }
h3 { margin-top: 0; color: #374151; font-weight: 600; }

/* Botões Globais */
button, .btn {
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    outline: none;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: var(--danger-hover); }

.btn-sec { background: #f3f4f6; color: #4b5563; border-color: #d1d5db; }
.btn-sec:hover { background: #e5e7eb; color: #1f2937; }

/* Inputs e Formulários */
input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="time"] {
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s;
    background: #fff;
}
input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(21,128,61,0.15);
}

/* Tabelas (Dashboard) */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}
table th {
    background: #f9fafb;
    color: #4b5563;
    font-size: 0.85rem;
    text-transform: uppercase;
    padding: 12px 15px;
    text-align: left;
    border-bottom: 2px solid var(--border);
}
table td {
    padding: 15px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
table tr:hover {
    background: #f8fafc;
}

/* Utilitários */
.flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-10 { gap: 10px; }
.mt-20 { margin-top: 20px; }

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}
.modal {
    background: white;
    padding: 24px;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}
.modal-header h3 { margin: 0; color: var(--primary); }
.modal-close {
    background: transparent; border: none; font-size: 1.5rem; cursor: pointer; color: #9ca3af;
}
.modal-close:hover { color: var(--danger); }

@media (max-width: 768px) {
    .main-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding: 15px;
    }
    .main-header .user-info {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .table-container {
        overflow-x: hidden;
        width: 100%;
        margin-top: 15px;
    }
    table, thead, tbody, th, td, tr {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }
    thead {
        display: none;
    }
    tr {
        margin-bottom: 15px;
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 10px;
        background: #fafafa;
    }
    td {
        padding: 5px 10px;
        border: none;
        text-align: left;
    }
    td:last-child {
        margin-top: 10px;
        padding-top: 15px;
        border-top: 1px dashed var(--border);
    }
    td:last-child .flex {
        flex-direction: column;
        width: 100%;
    }
    td:last-child .flex > * {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
    }
    .title-actions-container {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
        text-align: center;
    }
    .title-actions-container a.btn {
        width: 100%;
        box-sizing: border-box;
    }
    .header-logo-container {
        gap: 10px;
    }
    .header-church-name {
        font-size: 1.1rem;
    }
}

/* Sidebar Layout */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--card-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform 0.3s ease;
    z-index: 1050;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-logo {
    height: 40px;
    max-width: 100%;
    object-fit: contain;
}

.close-sidebar-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-main);
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 20px;
}

.nav-section-title {
    padding: 0 20px;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #9ca3af;
    margin: 0 0 10px 0;
    letter-spacing: 1px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-main);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-item:hover {
    background: #f3f4f6;
    color: var(--primary);
}

.nav-item.active {
    background: rgba(37, 99, 235, 0.05); /* very light primary */
    color: var(--primary);
    border-right: 3px solid var(--primary);
}

.nav-icon {
    opacity: 0.7;
    transition: opacity 0.2s;
}

.nav-item:hover .nav-icon, .nav-item.active .nav-icon {
    opacity: 1;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
}

.user-info-sidebar {
    margin-bottom: 15px;
}

.user-name-sidebar {
    font-weight: bold;
    color: var(--text-main);
}

.church-name-sidebar {
    font-size: 0.8rem;
    color: #6b7280;
}

.btn-logout {
    width: 100%;
    text-align: left;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--danger);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    padding: 10px;
}

.btn-logout:hover {
    background: #fef2f2;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-primary);
}

.mobile-top-bar {
    display: none;
    background: var(--card-bg);
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    align-items: center;
    justify-content: space-between;
}

.hamburger-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-main);
}

.mobile-church-name {
    margin: 0;
    font-size: 1.1rem;
    color: var(--primary);
    text-transform: uppercase;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1040;
}

@media (max-width: 768px) {
    .app-wrapper {
        flex-direction: column;
    }
    
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .close-sidebar-btn {
        display: block;
    }
    
    .mobile-top-bar {
        display: flex;
    }
    
    .sidebar-overlay.show {
        display: block;
    }
}


/* Estilos de Padronizacao do Repertorio */
.song { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; background: #fff; padding: 10px; border-radius: 6px; border: 1px solid var(--border); box-sizing: border-box; }
.song input.nome { flex: 2; min-width: 150px; font-weight: 600; height: 40px; box-sizing: border-box; margin: 0; padding: 0 10px; border-radius: 6px; border: 1px solid var(--border); outline: none; transition: 0.2s; }
.song input.nome:focus { border-color: var(--primary); }
.rep-btn { height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 0 15px; border: 1px solid #e5e7eb; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 0.85rem; box-sizing: border-box; text-decoration: none; transition: 0.2s; white-space: nowrap; background: #f3f4f6; color: #111827; gap: 5px; }
.rep-btn:hover { background: #e5e7eb; }
.rep-btn-primary.active { background: var(--primary); color: white; border-color: var(--primary); }
.rep-btn-primary.active:hover { opacity: 0.9; }
.rep-btn-yt.active { background: #ef4444; color: white; border-color: #ef4444; }
.rep-btn-yt.active:hover { background: #dc2626; }
.rep-icon-btn { height: 40px; width: 40px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; background: #f3f4f6; border: 1px solid #e5e7eb; border-radius: 6px; cursor: pointer; color: #4b5563; transition: 0.2s; box-sizing: border-box; padding: 0; }
.rep-icon-btn:hover { background: #e5e7eb; color: var(--primary); }
.rep-icon-btn.danger { color: #ef4444; border-color: transparent; }
.rep-icon-btn.danger:hover { background: #fee2e2; border-color: #fca5a5; }


/* Estilos Premium: Roteiro do Culto */
.roteiro-wrap { font-family: 'Inter', sans-serif; max-width: 800px; margin: 0 auto; color: #111827; }

/* Ticket Header */
.roteiro-ticket-header { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 12px; padding: 25px; margin-bottom: 30px; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.03); }
.roteiro-ticket-title { text-align: center; margin-bottom: 20px; border-bottom: 1px dashed #d1d5db; padding-bottom: 20px; }
.roteiro-ticket-title h1 { margin: 0 0 5px 0; color: var(--primary); font-size: 1.2rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
.roteiro-ticket-title h2 { margin: 0; font-size: 1.5rem; color: #111827; }
.roteiro-meta-grid { display: flex; flex-direction: column; gap: 5px; text-align: center; margin-bottom: 20px; }
.roteiro-meta-grid span { color: #6b7280; font-weight: 500; font-size: 0.9rem; }
.roteiro-meta-grid strong { color: #111827; font-weight: 600; }

/* Equipe Grid */
.roteiro-equipe-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; background: #fff; padding: 15px; border-radius: 8px; border: 1px solid #e5e7eb; }
.roteiro-equipe-item { display: flex; flex-direction: column; font-size: 0.9rem; }
.roteiro-equipe-item .role { color: var(--primary); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; margin-bottom: 2px; }
.roteiro-equipe-item .name { color: #111827; font-weight: 500; }

/* Timeline */
.roteiro-timeline { position: relative; padding-left: 30px; margin-top: 20px; }
.roteiro-timeline::before { content: ''; position: absolute; left: 7px; top: 10px; bottom: 0; width: 2px; background: #e5e7eb; }
.timeline-block { position: relative; margin-bottom: 35px; }
.timeline-node { position: absolute; left: -30px; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--primary); z-index: 2; box-shadow: 0 0 0 4px #fff; }
.timeline-title { font-size: 1.2rem; font-weight: 700; color: #111827; margin: 0 0 15px 0; letter-spacing: -0.02em; }

/* Music Items */
.musica-list { display: flex; flex-direction: column; gap: 8px; }
.musica-item { display: flex; align-items: center; background: #fff; border: 1px solid #f3f4f6; border-radius: 8px; padding: 12px 15px; transition: all 0.2s ease; box-shadow: 0 1px 2px rgba(0,0,0,0.02); }
.musica-item:hover { border-color: #e5e7eb; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); transform: translateY(-1px); }
.musica-idx { display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; background: #f3f4f6; color: #6b7280; border-radius: 50%; font-size: 0.8rem; font-weight: 700; margin-right: 15px; flex-shrink: 0; }
.musica-nome { font-weight: 600; color: #1f2937; font-size: 1rem; }

