/* =============================================
   ADMIN DASHBOARD - CSS UNIFICADO E LIMPO
   Versão final sem redundâncias
   Usar APENAS este arquivo para admin
   ============================================= */

/* =============================================
   VARIÁVEIS (se style-improved.css não estiver carregado)
   ============================================= */

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #13131a;
    --bg-tertiary: #1a1a24;
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --accent: #f59e0b;
    --accent-light: #fbbf24;
    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;
    --border: rgba(255, 255, 255, 0.1);
    --border-hover: rgba(255, 255, 255, 0.2);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.4);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =============================================
   BODY & PAGE
   ============================================= */

.admin-page {
    background: var(--bg-primary);
    overflow-x: hidden;
}

body.modal-open {
    overflow: hidden;
}

/* =============================================
   LAYOUT PRINCIPAL
   ============================================= */

.admin-layout {
    display: flex;
    min-height: calc(100vh - 70px);
    background: var(--bg-primary);
}

/* =============================================
   SIDEBAR
   ============================================= */

.admin-sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    position: fixed;
    left: 0;
    top: 70px;
    height: calc(100vh - 70px);
    z-index: 90;
    transition: transform var(--transition);
    overflow-y: auto;
}

/* Scrollbar da sidebar */
.admin-sidebar::-webkit-scrollbar {
    width: 6px;
}

.admin-sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

.admin-sidebar::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    border-radius: 3px;
}

.admin-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.5);
}

/* Navigation */
.admin-nav {
    padding: 24px 16px;
}

.nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    text-align: left;
    font-family: 'Instrument Sans', -apple-system, sans-serif;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    transform: translateX(4px);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(245, 158, 11, 0.1) 100%);
    color: var(--primary-light);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: linear-gradient(135deg, #6366f1 0%, #f59e0b 100%);
    border-radius: 0 4px 4px 0;
}

.nav-item svg {
    flex-shrink: 0;
}

.nav-badge {
    margin-left: auto;
    padding: 4px 8px;
    background: var(--error);
    color: white;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
}

/* =============================================
   MAIN CONTENT
   ============================================= */

.admin-main {
    flex: 1;
    margin-left: 280px;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 70px);
}

/* Page Header */
.page-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 32px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 70px;
    z-index: 80;
    backdrop-filter: blur(10px);
}

.page-header h1 {
    font-size: 32px;
    font-weight: 800;
    background: linear-gradient(135deg, #ffffff 0%, #a1a1aa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Admin Content */
.admin-content {
    flex: 1;
    padding: 40px;
}

.admin-section {
    display: none;
    animation: fadeInUp 0.4s ease-out;
}

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

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

/* =============================================
   EVENT SELECTOR CARD
   ============================================= */

.event-selector-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(245, 158, 11, 0.08) 100%);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 20px;
    padding: 28px 32px;
    margin-bottom: 40px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
    z-index: 1;
    animation: slideInDown 0.5s ease-out;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.event-selector-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #6366f1 0%, #f59e0b 100%);
    z-index: 0;
}

.event-selector-card label {
    display: block;
    margin-bottom: 14px;
    color: #e0e7ff;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    position: relative;
    z-index: 2;
}

.event-selector-card select {
    width: 100%;
    max-width: 600px;
    padding: 16px 48px 16px 20px;
    background: rgba(30, 41, 59, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='16' height='10' viewBox='0 0 16 10' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L8 8L15 1' stroke='%236366f1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    font-family: 'Instrument Sans', -apple-system, sans-serif;
    line-height: 1.5;
    position: relative;
    z-index: 2;
}

.event-selector-card select:hover {
    background: rgba(30, 41, 59, 0.95);
    border-color: rgba(99, 102, 241, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.3);
}

.event-selector-card select:focus {
    outline: none;
    border-color: #6366f1;
    background: rgba(30, 41, 59, 1);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

.event-selector-card select option {
    background: #1e293b;
    color: #ffffff;
    padding: 12px;
    font-weight: 600;
    line-height: 1.6;
}

/* =============================================
   STATS GRID
   ============================================= */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
    position: relative;
    z-index: 1;
}

.stat-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 28px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #6366f1 0%, #f59e0b 100%);
    opacity: 0;
    transition: var(--transition);
}

.stat-card:hover {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateY(-6px);
    box-shadow: 0 16px 40px rgba(99, 102, 241, 0.3);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2) 0%, rgba(245, 158, 11, 0.1) 100%);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 36px;
    font-weight: 800;
    color: var(--primary-light);
    font-family: 'Sora', sans-serif;
    line-height: 1;
    margin-bottom: 6px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* =============================================
   PROGRESS CARD
   ============================================= */

.progress-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(245, 158, 11, 0.06) 100%);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 20px;
    padding: 36px;
    box-shadow: var(--shadow-lg);
}

.progress-card h3 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 28px;
}

.progress-wrapper {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 600;
}

.progress-bar-admin {
    width: 100%;
    height: 14px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 7px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.progress-fill-admin {
    height: 100%;
    background: linear-gradient(90deg, #6366f1 0%, #f59e0b 100%);
    border-radius: 7px;
    transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.8);
}

/* =============================================
   SECTION HEADER
   ============================================= */

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 20px;
}

.section-header h2 {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
}

.section-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 8px;
}

.section-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* =============================================
   BUTTONS
   ============================================= */

.btn-primary,
.btn-secondary,
.btn-outline {
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: none;
    font-family: 'Instrument Sans', -apple-system, sans-serif;
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.25);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.25);
}

/* =============================================
   TABLES
   ============================================= */

.table-controls {
    margin-bottom: 24px;
}

.table-controls input[type="text"] {
    width: 100%;
    max-width: 500px;
    padding: 14px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition);
}

.table-controls input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.table-container {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
}

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

.data-table thead {
    background: rgba(0, 0, 0, 0.3);
}

.data-table th {
    text-align: left;
    padding: 18px 20px;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 18px 20px;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 14px;
}

.data-table tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.data-table tr:last-child td {
    border-bottom: none;
}

/* =============================================
   CARDS
   ============================================= */

.glass-card,
.checkin-card,
.notification-form-card,
.notification-history-card,
.settings-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 36px;
    margin-bottom: 36px;
}

.glass-card h3,
.notification-form-card h2,
.notification-history-card h2,
.settings-card h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 28px;
}

/* Check-in Card específico */
.checkin-card {
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
    padding: 72px 56px;
}

.checkin-icon {
    margin-bottom: 36px;
}

.checkin-card h2 {
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.checkin-card p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 36px;
}

.btn-scanner {
    padding: 18px 48px;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    border: none;
    border-radius: 14px;
    font-size: 18px;
    font-weight: 700;
    color: white;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.5);
}

.btn-scanner:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 48px rgba(99, 102, 241, 0.6);
}

/* =============================================
   GRIDS
   ============================================= */

.events-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 28px;
}

.solicitacoes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 28px;
}

/* =============================================
   FORM ELEMENTS
   ============================================= */

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 700;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: 'Instrument Sans', -apple-system, sans-serif;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.form-group small {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* =============================================
   MODAL
   ============================================= */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}

.modal.show,
.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

.modal-header h2 {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--error);
    color: var(--error);
    transform: rotate(90deg);
}

.modal-body {
    padding: 32px;
}

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

/* Scrollbar do modal */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.modal-content::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.5);
    border-radius: 4px;
}

/* =============================================
   LOADING & EMPTY STATES
   ============================================= */

.loading-state,
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
}

.loading-state .spinner {
    margin: 0 auto 24px;
}

.empty-state-icon {
    font-size: 72px;
    margin-bottom: 24px;
    opacity: 0.5;
}

/* =============================================
   RESPONSIVE
   ============================================= */

@media (max-width: 1024px) {
    .admin-sidebar {
        transform: translateX(-100%);
        z-index: 999;
    }
    
    .admin-sidebar.active {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    }
    
    .admin-main {
        margin-left: 0;
    }
    
    .page-header {
        padding: 24px 20px;
    }
    
    .page-header h1 {
        font-size: 24px;
    }
    
    .admin-content {
        padding: 24px 20px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .events-list,
    .solicitacoes-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .page-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .page-actions .btn-primary,
    .page-actions .btn-secondary {
        width: 100%;
        justify-content: center;
    }
    
    .modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 20px;
    }
    
    .modal-footer {
        flex-direction: column-reverse;
    }
    
    .modal-footer .btn-primary,
    .modal-footer .btn-outline {
        width: 100%;
        justify-content: center;
    }
    
    .checkin-card {
        padding: 48px 32px;
    }
    
    .checkin-card h2 {
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    .page-header h1 {
        font-size: 20px;
    }
    
    .section-header h2 {
        font-size: 24px;
    }
    
    .stat-value {
        font-size: 28px;
    }
    
    .stat-icon {
        width: 60px;
        height: 60px;
        font-size: 30px;
    }
}

/* =============================================
   ADMIN SECTIONS - CORREÇÃO DE EXIBIÇÃO
   ============================================= */

.admin-section {
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease;
}

.admin-section.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
    animation: sectionFadeIn 0.4s ease;
}

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

/* Garantir que apenas uma section esteja visível */
.admin-content > .admin-section:not(.active) {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
}

/* Fix para modal z-index */
.modal {
    z-index: 9999 !important;
}

.modal.active ~ .admin-section {
    opacity: 0.3;
    pointer-events: none;
}

/* No arquivo admin-new.css ou inline */
.modal.show {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}