:root {
    /* Light Theme Colors */
    --bg-base: #f4f6f9;
    --bg-surface: #ffffff;
    --bg-sidebar: #1e1e2d;
    --text-main: #333333;
    --text-muted: #888888;
    --primary: #4361ee;
    --primary-hover: #3a56d4;
    --success: #2ecc71;
    --warning: #f39c12;
    --danger: #e74c3c;
    --border-color: #e1e5eb;
    --sidebar-text: #a1a5b7;
    --sidebar-active: #ffffff;
    --sidebar-active-bg: #151521;
    --card-shadow: 0 4px 20px rgba(0,0,0,0.03);
    --border-radius: 12px;
}

body.theme-dark {
    --bg-base: #151521;
    --bg-surface: #1e1e2d;
    --bg-sidebar: #151521;
    --text-main: #ffffff;
    --text-muted: #a1a5b7;
    --border-color: #323248;
    --card-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    transition: background-color 0.3s ease, color 0.3s ease, opacity 0.5s ease;
}

body.loading-state {
    opacity: 0;
    overflow: hidden;
}

/* App Layout */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.sidebar-header {
    height: 80px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    color: #ffffff;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-nav {
    flex: 1;
    padding: 24px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: var(--sidebar-text);
    font-size: 15px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

.nav-item:hover, .nav-item.active {
    background-color: var(--sidebar-active-bg);
    color: var(--sidebar-active);
}

.nav-item.active {
    color: var(--primary);
}

.sidebar-footer {
    padding: 24px 12px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

/* Sidebar Collapsed State Styles */
.sidebar .nav-text {
    white-space: nowrap;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.2s ease, width 0.2s ease, visibility 0.2s ease;
}

.sidebar.collapsed {
    width: 80px;
}

.sidebar.collapsed .sidebar-header {
    padding: 0 10px;
    justify-content: center;
}

.sidebar.collapsed .sidebar-header img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    object-position: right;
    transition: all 0.3s ease;
}

.sidebar.collapsed .sidebar-nav,
.sidebar.collapsed .sidebar-footer {
    padding: 24px 8px;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 12px 0;
    gap: 0;
}

.sidebar.collapsed .nav-text {
    opacity: 0;
    visibility: hidden;
    width: 0;
    height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.top-header {
    height: 80px;
    background-color: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-base);
    padding: 8px 16px;
    border-radius: 20px;
    width: 300px;
}

.header-search input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    color: var(--text-main);
}

.header-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    text-align: right;
}

.user-name {
    display: block;
    font-weight: 600;
    font-size: 14px;
}

.user-role {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Views */
.views-container {
    padding: 32px;
    flex: 1;
}

.view-section {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.view-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 32px;
}

.view-header h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 4px;
}

.view-header p {
    color: var(--text-muted);
    font-size: 14px;
}

/* Cards */
.card {
    background: var(--bg-surface);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    padding: 24px;
    border: 1px solid var(--border-color);
}

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 12px;
}

.card-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-icon span {
    font-size: 28px;
}

.stat-card.primary .card-icon { background: rgba(67, 97, 238, 0.1); color: var(--primary); }
.stat-card.success .card-icon { background: rgba(46, 204, 113, 0.1); color: var(--success); }
.stat-card.warning .card-icon { background: rgba(243, 156, 18, 0.1); color: var(--warning); }
.stat-card.danger .card-icon { background: rgba(231, 76, 60, 0.1); color: var(--danger); }

.card-info h3 {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    margin-top: 4px;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 16px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 13px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.data-table tbody tr:hover {
    background-color: var(--bg-base);
}

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-aprovado { background: rgba(46, 204, 113, 0.1); color: var(--success); }
.status-pendente { background: rgba(243, 156, 18, 0.1); color: var(--warning); }
.status-cancelado { background: rgba(231, 76, 60, 0.1); color: var(--danger); }

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--bg-base);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
}

.form-group input, .form-group select, .form-group textarea {
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-base);
    color: var(--text-main);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
    max-width: 100%;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--primary);
}

.form-section-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

/* Controls */
.table-controls {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
}

.form-control {
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-base);
    color: var(--text-main);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--bg-surface);
    width: 100%;
    max-width: 600px;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    transform: translateY(-20px);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

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

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.6;
}

.modal-body p {
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 8px;
}

.modal-body p strong {
    color: var(--text-muted);
    font-weight: 500;
}

.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

/* Animations */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spinning {
    animation: spin 1s linear infinite;
    display: inline-block;
}

/* Modal Body Improvements */
.modal-body h4 {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-body p {
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 8px;
    font-size: 0.95rem;
}
/* Login View Styles */
.login-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease;
}

.login-card:hover {
    transform: translateY(-5px);
}

body.theme-dark .login-card {
    background: rgba(30, 30, 45, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

#admin-login-form input {
    height: 48px;
    border-radius: 12px;
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

#admin-login-form input:focus {
    border-color: var(--primary);
    background: var(--bg-surface);
    box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.1);
}

/* Google Login Styles */
.login-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
    color: var(--text-muted);
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.login-divider:not(:empty)::before {
    margin-right: .5em;
}

.login-divider:not(:empty)::after {
    margin-left: .5em;
}

.login-divider span {
    font-size: 0.85rem;
    font-weight: 500;
}

.btn-google {
    background: white;
    color: #3c4043;
    border: 1px solid #dadce0 !important;
    box-shadow: 0 1px 2px 0 rgba(60,64,67,0.30), 0 1px 3px 1px rgba(60,64,67,0.15);
    font-weight: 500 !important;
}

.btn-google:hover {
    background: #f8f9fa;
    border-color: #d2d4d7 !important;
    box-shadow: 0 1px 3px 0 rgba(60,64,67,0.30), 0 4px 8px 3px rgba(60,64,67,0.15);
}

body.theme-dark .btn-google {
    background: #1e1e2d;
    color: #e8eaed;
    border: 1px solid #3c4043 !important;
}

body.theme-dark .btn-google:hover {
    background: #232336;
}

.dashboard-recent {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

/* Responsiveness */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: -260px;
        z-index: 1001;
        height: 100vh;
    }

    .sidebar.mobile-active {
        left: 0;
    }

    #mobile-menu-btn {
        display: block !important;
    }

    .dashboard-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    #sidebar-collapse-btn {
        display: none !important;
    }

    .sidebar.collapsed {
        width: 260px !important;
    }

    .sidebar.collapsed .nav-text {
        opacity: 1 !important;
        visibility: visible !important;
        width: auto !important;
        height: auto !important;
        overflow: visible !important;
    }

    .sidebar.collapsed .sidebar-header {
        padding: 0 24px !important;
        justify-content: flex-start !important;
    }

    .sidebar.collapsed .sidebar-header img {
        width: auto !important;
        height: auto !important;
        max-width: 100% !important;
        max-height: 60px !important;
        object-fit: contain !important;
        object-position: center !important;
    }

    .sidebar.collapsed .nav-item {
        justify-content: flex-start !important;
        padding: 12px 16px !important;
        gap: 12px !important;
    }

    .sidebar.collapsed .sidebar-nav {
        padding: 24px 12px !important;
    }

    .sidebar.collapsed .sidebar-footer {
        padding: 24px 12px !important;
    }
}

@media (max-width: 768px) {
    .dashboard-recent {
        grid-template-columns: 1fr;
    }

    .top-header {
        padding: 0 16px;
    }

    .header-search {
        width: 180px;
    }

    .user-info {
        display: none;
    }

    .views-container {
        padding: 80px 16px;
    }

    .dashboard-cards {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .view-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .modal-content {
        width: 95%;
        margin: 10px;
    }
}

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: none;
}

.sidebar-overlay.active {
    display: block;
}

/* Responsive Helper Classes & Grid Adjustments */
.dependent-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 10px;
}

@media (max-width: 1024px) {
    .main-content {
        width: 100% !important;
        min-width: 0 !important;
    }
}

@media (max-width: 576px) {
    .card {
        padding: 16px !important;
    }
    
    .dependentes-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }
    
    .dependentes-header button {
        justify-content: center !important;
        width: 100% !important;
    }

    .dependent-grid {
        grid-template-columns: 1fr !important;
    }

    .form-actions {
        flex-direction: column-reverse !important;
        gap: 12px !important;
    }
    
    .form-actions .btn {
        width: 100% !important;
        justify-content: center !important;
    }
}
