/* Design System Autoral - Gestão Escolar Inteligente
   Visual Operacional Institucional (Sem cara de IA / Sem templates genéricos) */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-text: #94a3b8;
    --sidebar-active: #ffffff;
    
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    --primary: #059669;
    --primary-hover: #047857;
    --primary-light: #ecfdf5;
    
    --accent: #2563eb;
    --accent-light: #eff6ff;
    
    --warning: #d97706;
    --warning-light: #fffbeb;
    
    --danger: #dc2626;
    --danger-light: #fef2f2;
    
    --border: #e2e8f0;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;

    --shadow-subtle: 0 1px 3px 0 rgba(15, 23, 42, 0.05), 0 1px 2px -1px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Layout Estrutural (Sidebar + Header + Content) */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Esquerda */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: #fff;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid var(--sidebar-hover);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-logo {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #10b981, #059669);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #fff;
    font-size: 1.2rem;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.sidebar-title {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #f8fafc;
}

.sidebar-subtitle {
    font-size: 0.72rem;
    color: var(--sidebar-text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-menu {
    padding: 1.25rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.menu-section-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #475569;
    padding: 0.75rem 0.75rem 0.25rem 0.75rem;
    font-weight: 700;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    color: var(--sidebar-text);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.nav-link:hover {
    background-color: var(--sidebar-hover);
    color: var(--sidebar-active);
}

.nav-link.active {
    background-color: var(--primary);
    color: #ffffff;
    font-weight: 600;
}

.nav-icon {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

/* Área Principal */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Top Header */
.top-bar {
    height: 64px;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.school-selector-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.school-badge {
    background-color: var(--primary-light);
    color: var(--primary);
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid rgba(5, 150, 105, 0.2);
}

.top-user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.85rem;
}

/* Conteúdo da Página */
.content-area {
    padding: 1.75rem;
    flex: 1;
}

.page-header {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.page-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.page-subtitle {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}

/* Grid de Cards de Estatísticas */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    box-shadow: var(--shadow-subtle);
}

.stat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.stat-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.stat-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.stat-icon.emerald { background: var(--primary-light); color: var(--primary); }
.stat-icon.blue { background: var(--accent-light); color: var(--accent); }
.stat-icon.amber { background: var(--warning-light); color: var(--warning); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.stat-footer {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Componente de Tabela Padrão Institucional */
.table-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-subtle);
    overflow: hidden;
}

.table-header-bar {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #ffffff;
}

.table-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.table-custom {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.table-custom th {
    background-color: #f8fafc;
    padding: 0.75rem 1.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}

.table-custom td {
    padding: 0.85rem 1.25rem;
    font-size: 0.88rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
}

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

.table-custom tr:hover td {
    background-color: #f8fafc;
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-presente { background-color: var(--primary-light); color: var(--primary); }
.badge-ausente { background-color: var(--danger-light); color: var(--danger); }
.badge-pendente { background-color: var(--warning-light); color: var(--warning); }
.badge-info { background-color: var(--accent-light); color: var(--accent); }

/* Avatar do Aluno */
.student-avatar-inline {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
}

/* Botões Customizados */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.btn-primary {
    background-color: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-outline {
    background-color: transparent;
    border-color: var(--border);
    color: var(--text-primary);
}
.btn-outline:hover {
    background-color: #f1f5f9;
}

.btn-danger {
    background-color: var(--danger);
    color: #fff;
}
.btn-danger:hover {
    background-color: #b91c1c;
}

/* TELA DO PAINEL DA COZINHA (MODO TV ESCURO DE ALTO CONTRASTE) */
.tv-mode-container {
    background-color: #080c14;
    color: #f8fafc;
    min-height: 100vh;
    padding: 2rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.tv-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid #1e293b;
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}

.tv-title {
    font-size: 2.2rem;
    font-weight: 800;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.tv-badge-live {
    background-color: #10b981;
    color: #042f2e;
    font-size: 0.9rem;
    font-weight: 800;
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.tv-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 2rem;
}

.tv-card-big {
    background: #0f172a;
    border: 2px solid #1e293b;
    border-radius: var(--radius-lg);
    padding: 2rem;
}

.tv-stat-number {
    font-size: 4.5rem;
    font-weight: 800;
    color: #f59e0b;
    line-height: 1;
    font-family: 'JetBrains Mono', monospace;
}

.tv-ingredient-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.2rem;
    background: #1e293b;
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    border-left: 5px solid #10b981;
}

.tv-ingredient-name {
    font-size: 1.4rem;
    font-weight: 700;
    color: #f8fafc;
}

.tv-ingredient-weight {
    font-size: 1.8rem;
    font-weight: 800;
    color: #34d399;
    font-family: 'JetBrains Mono', monospace;
}

/* TOTEM DE RECONHECIMENTO FACIAL */
.facial-kiosk-wrapper {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 1.5rem;
}

.camera-box {
    position: relative;
    background: #000;
    border-radius: var(--radius-lg);
    overflow: hidden;
    aspect-ratio: 16/9;
    border: 3px solid var(--sidebar-bg);
}

.camera-feed {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1rem;
}

.face-box-indicator {
    position: absolute;
    border: 3px solid #10b981;
    background: rgba(16, 185, 129, 0.15);
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.5);
    transition: all 0.2s ease;
}

.face-label {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: #10b981;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    white-space: nowrap;
}
