@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Cores Principais (Indigo & Slate) */
    --primary: #6366f1; /* Indigo 500 */
    --primary-hover: #4f46e5;
    --primary-light: #e0e7ff;
    --primary-fade: rgba(99, 102, 241, 0.1);
    
    --bg-body: #f8fafc; /* Slate 50 */
    --bg-card: #ffffff;
    
    --text-title: #1e293b; /* Slate 800 */
    --text-body: #475569; /* Slate 600 */
    --text-muted: #94a3b8; /* Slate 400 */
    
    --border: #e2e8f0;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    --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);

    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
}

* { box-sizing: border-box; outline: none; -webkit-tap-highlight-color: transparent; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-body);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Header & Title */
.app-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    margin-bottom: 2rem;
}
.app-header h1 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-title);
    font-weight: 700;
    padding: 0 24px;
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px 60px 24px;
}

/* Navegação (Tabs) */
.nav-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 30px;
    padding: 6px;
    background: #e2e8f0; /* Fundo cinza para o grupo de botões */
    border-radius: 50px; /* Pill shape container */
    overflow-x: auto;
    width: fit-content;
    max-width: 100%;
}
.nav-tabs::-webkit-scrollbar { display: none; }

.nav-btn {
    background: transparent;
    border: none;
    padding: 8px 20px;
    border-radius: 40px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-body);
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
.nav-btn span { font-size: 1.1rem; }
.nav-btn:hover { color: var(--text-title); background: rgba(255,255,255,0.5); }
.nav-btn.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

/* Cards e Estrutura */
.screen { display: none; animation: fadeUp 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
.screen.active { display: block; }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-title);
    margin: 0 0 24px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}
h3 {
    font-size: 1.1rem;
    color: var(--text-title);
    font-weight: 600;
    margin-top: 30px;
    margin-bottom: 15px;
}

/* Formulários */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}
label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-body);
    margin-bottom: 8px;
}
.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    color: var(--text-title);
    background: #fcfcfc;
    transition: all 0.2s;
    font-family: inherit;
}
.form-control:focus {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
textarea.form-control { resize: vertical; }

/* Botões */
.btn {
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.btn-primary { 
    background: var(--primary); 
    color: white; 
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover { 
    background: var(--primary-hover); 
    transform: translateY(-1px); 
    box-shadow: 0 4px 6px rgba(99, 102, 241, 0.4);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary { background: #f1f5f9; color: var(--text-body); border: 1px solid transparent; }
.btn-secondary:hover { background: #e2e8f0; color: var(--text-title); }

.btn-danger { background: #fff1f2; color: var(--danger); }
.btn-danger:hover { background: #fee2e2; }

.btn-sm { padding: 8px 16px; font-size: 0.85rem; border-radius: 6px; }

/* Tabelas (Listagem) */
table { width: 100%; border-collapse: separate; border-spacing: 0; margin-top: 10px; }
th { 
    text-align: left; 
    padding: 16px; 
    color: var(--text-muted); 
    font-size: 0.75rem; 
    font-weight: 700;
    text-transform: uppercase; 
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border);
}
td { 
    padding: 16px; 
    border-bottom: 1px solid var(--border); 
    color: var(--text-body);
    font-size: 0.95rem;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background-color: #f8fafc; }

/* Tabela de Grade/Horário (Agenda Visual) */
.grade-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: white;
}
.grade-table { margin-top: 0; }
.grade-table th {
    background: #f8fafc;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    text-align: center;
    color: var(--text-title);
    padding: 12px;
}
.grade-table td {
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 6px;
    height: 90px;
    min-width: 130px;
    vertical-align: top;
    text-align: center;
    position: relative;
    transition: background 0.2s;
}
/* Primeira Coluna (Horários) */
.grade-table td:first-child {
    background: #f8fafc;
    font-size: 0.85rem;
    vertical-align: middle;
    font-weight: 600;
    color: var(--text-muted);
    width: 100px;
    min-width: 100px;
}

/* Slots da Grade */
.slot-livre {
    cursor: pointer;
    color: transparent;
}
.slot-livre:hover {
    background-color: var(--primary-light);
    color: var(--primary);
}
.slot-livre::after {
    content: "+";
    font-size: 1.5rem;
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
}

.slot-ocupado {
    background: #eff6ff;
    margin: 4px;
    border-radius: 6px;
    border-left: 3px solid var(--primary);
    padding: 8px 6px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    font-size: 0.85rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    height: calc(100% - 8px); /* Ajuste para margem */
}
.slot-ocupado b { color: var(--primary); font-weight: 600; display: block; margin-bottom: 2px; }

/* Calendário Anual */
.calendar-year { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); 
    gap: 24px; 
    margin-top: 30px; 
}
.month { 
    border: 1px solid var(--border); 
    padding: 20px; 
    border-radius: var(--radius-md); 
    background: white; 
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s;
}
.month:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.month h4 { 
    text-align: center; 
    margin: 0 0 15px 0; 
    color: var(--primary); 
    text-transform: capitalize; 
    font-weight: 700;
}
.days-grid { 
    display: grid; 
    grid-template-columns: repeat(7, 1fr); 
    gap: 6px; 
    text-align: center; 
}
.days-grid div:nth-child(-n+7) { /* Dias da semana */
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
}
.day { 
    aspect-ratio: 1; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    border-radius: 50%; 
    font-size: 0.8rem;
    color: var(--text-body);
    transition: 0.2s;
}
.day:hover { background: #f1f5f9; }
.day.aula { background: var(--primary); color: white; font-weight: 600; box-shadow: 0 2px 4px rgba(99, 102, 241, 0.4); }
.day.feriado { background: #fee2e2; color: #991b1b; font-weight: 700; }

.legend { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 24px; 
    padding: 16px 24px; 
    background: white; 
    border: 1px solid var(--border);
    border-radius: var(--radius-md); 
    margin-top: 24px;
    font-size: 0.9rem;
    color: var(--text-body);
}

/* Responsivo */
@media (max-width: 768px) {
    .app-container { padding: 0 16px 40px 16px; margin: 0; }
    .card { padding: 20px; }
    h2 { font-size: 1.25rem; }
    .nav-tabs { width: 100%; justify-content: flex-start; }
    .grade-table td { min-width: 100px; height: 80px; }
}