/* Configurações Globais */
:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #a855f7;
    --dark-purple: #1e1b4b;
    --accent: #f472b6;

    --terracotta: #AD4A2C;
    --terracotta-light: #d97a56;
    --terracotta-dark: #8a3a22;
    --terracotta-bg: #fdf1ec;

    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;

    --success: #10b981;
    --danger: #ef4444;
    --sidebar-width: 260px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
}

/* ===================== TELAS ===================== */
.full-screen {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, var(--secondary) 0%, var(--dark-purple) 60%, var(--terracotta-dark) 130%);
}

#app-screen {
    display: flex;
    min-height: 100vh;
}

.hidden { display: none !important; }

/* ===================== CAMPOS DE FORMULÁRIO (PADRÃO GLOBAL) ===================== */
input, select, textarea {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text-main);
    background: #f8fafc;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--terracotta);
    background: white;
    box-shadow: 0 0 0 4px rgba(173, 74, 44, 0.12);
}

textarea { resize: vertical; min-height: 80px; }

.input-wrapper {
    text-align: left;
    margin-bottom: 1rem;
}

.input-wrapper label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-main);
    display: block;
    margin-bottom: 6px;
    letter-spacing: 0.2px;
}

.input-wrapper label.required::after {
    content: " *";
    color: var(--terracotta);
}

/* ===================== LOGIN ===================== */
.login-container {
    position: relative;
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.logo-circle {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--secondary), var(--terracotta));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto -40px;
    position: relative;
    z-index: 10;
    color: white;
    font-size: 1.8rem;
    font-weight: 800;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
    border: 4px solid white;
}

.login-box {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 60px 40px 30px;
    border-radius: 28px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    text-align: center;
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    font-size: 2rem;
    color: #1e293b;
    margin-bottom: 5px;
}

.login-box h1 span { color: var(--terracotta); }

.login-box p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 30px;
}

.btn-login-premium {
    width: 100%;
    background: linear-gradient(135deg, var(--secondary) 0%, var(--terracotta) 100%);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 14px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 10px;
    box-shadow: 0 10px 15px -3px rgba(173, 74, 44, 0.3);
    transition: transform 0.2s;
}

.btn-login-premium:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, #7c3aed 0%, var(--terracotta-dark) 100%);
}

.developer-credit {
    margin-top: 30px;
    font-size: 0.65rem;
    letter-spacing: 1px;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    border-top: 2px solid var(--terracotta-light);
    padding-top: 10px;
    display: inline-block;
}

/* ===================== SIDEBAR ===================== */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--dark-purple) 0%, #312e81 100%);
    color: white;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    position: fixed;
    height: 100vh;
    border-right: 3px solid var(--terracotta);
}

.brand {
    font-size: 1.6rem;
    letter-spacing: -1px;
    color: #fff;
    margin-bottom: 2.5rem;
}

nav { flex: 1; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 0.85rem 1rem;
    margin-bottom: 0.75rem;
    border: none;
    background: transparent;
    text-align: left;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    color: #cbd5e1;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item i { width: 20px; height: 20px; stroke-width: 2px; }

.nav-item:hover, .nav-item.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: translateX(5px);
    border-left: 3px solid var(--terracotta);
}

.nav-item.active i {
    color: var(--terracotta-light);
    filter: drop-shadow(0 0 5px rgba(173, 74, 44, 0.5));
}

.btn-logout {
    background: transparent;
    border: 1px solid var(--border);
    padding: 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    margin-top: auto;
    color: #cbd5e1;
}

.btn-logout:hover {
    border-color: var(--terracotta);
    color: var(--terracotta-light);
}

/* ===================== CONTEÚDO PRINCIPAL ===================== */
.content {
    margin-left: var(--sidebar-width);
    padding: 2.5rem;
    background: #f1f5f9;
    min-height: 100vh;
    width: 100%;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-section {
    background: rgba(255, 255, 255, 0.9);
    padding: 2rem;
    border-radius: 24px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
    animation: fadeInPage 0.4s ease-out;
}

@keyframes fadeInPage {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-section header h2 {
    color: var(--dark-purple);
    font-weight: 800;
    letter-spacing: -0.5px;
}

/* ===================== BOTÕES ===================== */
.btn-main, .btn-add, .btn-success {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 60%, var(--terracotta) 130%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-main:hover, .btn-add:hover, .btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(173, 74, 44, 0.35);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--terracotta);
    color: var(--terracotta);
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-outline:hover { background: var(--terracotta-bg); }

.btn-secondary {
    background: white;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover { border-color: var(--text-muted); color: var(--text-main); }

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.btn-photo {
    margin-top: 10px;
    padding: 8px 14px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid var(--terracotta);
    color: var(--terracotta);
    background: white;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    text-align: center;
    transition: all 0.2s;
}

.btn-photo:hover { background: var(--terracotta-bg); }

/* ===================== TABELAS ===================== */
.table-wrapper {
    background: white;
    border-radius: 18px;
    margin-top: 1.5rem;
    overflow: hidden;
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
}

table { width: 100%; border-collapse: collapse; }

th {
    background: #f1f5f9;
    text-align: left;
    padding: 1rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

td { padding: 1rem; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background-color 0.2s ease; }
tbody tr:hover { background-color: var(--terracotta-bg); }

.filter-bar {
    display: flex;
    gap: 1rem;
    background: #fff;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
}

.action-buttons { display: flex; gap: 8px; }

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #f1f5f9;
}

.btn-icon i { width: 16px; height: 16px; }

.btn-icon.edit { color: var(--terracotta); }
.btn-icon.edit:hover { background: var(--terracotta-bg); color: var(--terracotta-dark); }

.btn-icon.delete { color: var(--danger); }
.btn-icon.delete:hover { background: #fee2e2; transform: scale(1.1); }

.badge-turma {
    background: var(--terracotta-bg);
    color: var(--terracotta);
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge { padding: 4px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.status-ok { background: #ede9fe; color: var(--secondary); border: 1px solid #ddd6fe; }
.status-alert { background: #fee2e2; color: #991b1b; }

.presence-toggle { display: flex; gap: 15px; font-weight: 600; }

.actions-footer { margin-top: 1.5rem; display: flex; justify-content: flex-end; }

/* ===================== DASHBOARD / STATS ===================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 24px;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    transition: transform 0.3s ease;
}

.stat-card:hover { transform: translateY(-5px); box-shadow: 0 12px 20px rgba(0,0,0,0.06); }

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon i { width: 28px; height: 28px; color: white; }
.stat-icon.purple { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.stat-icon.indigo { background: linear-gradient(135deg, #6366f1, #4338ca); }
.stat-icon.pink { background: linear-gradient(135deg, #f472b6, #db2777); }
.stat-icon.pink-light {
    background: linear-gradient(135deg, var(--terracotta-light) 0%, var(--terracotta-dark) 100%);
    box-shadow: 0 4px 12px rgba(173, 74, 44, 0.3);
}

.stat-info { text-align: left; }
.stat-info .label { color: var(--text-muted); font-size: 0.85rem; font-weight: 500; }
.stat-info .value { display: block; font-size: 1.8rem; font-weight: 700; color: var(--text-main); }

.dashboard-secondary-grid { margin-bottom: 2rem; }

.bday-list-card {
    background: white;
    padding: 1.5rem;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.bday-list { display: flex; gap: 12px; overflow-x: auto; padding: 10px 5px; }

.bday-item {
    min-width: 220px;
    background: #f8fafc;
    border: 1px solid var(--border);
    padding: 12px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: transform 0.2s;
}

.bday-item:hover { transform: translateY(-3px); border-color: var(--terracotta); }

.bday-avatar {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--terracotta); color: white;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; overflow: hidden;
}

.bday-avatar img { width: 100%; height: 100%; object-fit: cover; }
.bday-name { display: block; font-size: 0.85rem; font-weight: 600; }
.bday-sub { font-size: 0.75rem; color: var(--text-muted); }
.bday-day {
    margin-left: auto; font-size: 0.75rem; font-weight: 700;
    color: var(--terracotta-dark); background: var(--terracotta-bg);
    padding: 4px 8px; border-radius: 8px;
}

.bday-badge {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--terracotta-bg); color: var(--terracotta-dark);
    font-size: 0.75rem; font-weight: 700; padding: 4px 10px;
    border-radius: 20px; border: 1px solid var(--terracotta-light);
    width: fit-content; animation: pulse-bday 2s infinite;
}

@keyframes pulse-bday {
    0% { transform: scale(1); }
    50% { transform: scale(1.03); }
    100% { transform: scale(1); }
}

.aluno-info-chamada { display: flex; flex-direction: column; gap: 4px; }
.nome-aluno-lista { font-weight: 600; }

/* ===================== MODAIS (BASE) ===================== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(15, 15, 20, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
    padding: 20px;
}

.modal-card {
    background: var(--bg-card);
    width: 100%;
    max-width: 480px;
    border-radius: 18px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    animation: modalPop 0.25s ease-out;
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-card.wide { max-width: 920px; }

.modal-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
    background: #fafafa;
}

.modal-header-icon {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--terracotta-light), var(--terracotta));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.modal-header-icon i { width: 20px; height: 20px; }

.modal-header-text { flex: 1; }
.modal-header-text h3 { font-size: 1.15rem; color: var(--dark-purple); font-weight: 700; }
.modal-header-text span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.modal-body {
    padding: 1.75rem 2rem;
    overflow-y: auto;
}

.modal-footer {
    padding: 1.25rem 2rem;
    border-top: 1px solid var(--border);
    background: #fafafa;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.modal-footer.confirm-footer { justify-content: center; border-top: none; background: transparent; }

/* Divisórias de seção dentro do formulário */
.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 1.1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.section-title i {
    width: 16px;
    height: 16px;
    color: var(--terracotta);
}

.section-title span {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.grid-inputs, .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 1.25rem; }

/* ===================== FORMULÁRIO DE ALUNO ===================== */
.form-container { display: flex; gap: 2rem; }
.form-sidebar {
    width: 190px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.photo-upload {
    width: 160px;
    height: 160px;
    background: #f8fafc;
    border: 2px dashed var(--terracotta-light);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
    position: relative;
    overflow: hidden;
    color: var(--terracotta-light);
    text-align: center;
    padding: 10px;
    transition: border-color 0.2s, background 0.2s;
}

.photo-upload:hover { border-color: var(--terracotta); background: var(--terracotta-bg); }

.photo-upload i { width: 28px; height: 28px; margin-bottom: 6px; }
.photo-upload span { font-size: 0.7rem; font-weight: 600; line-height: 1.3; }
.photo-upload img { width: 100%; height: 100%; object-fit: cover; }

.form-sidebar .input-wrapper { width: 100%; margin-top: 0.75rem; }

.form-content { flex: 1; min-width: 0; }

.tabs-nav {
    display: flex;
    gap: 4px;
    background: #f1f5f9;
    padding: 5px;
    border-radius: 12px;
    margin-bottom: 1.75rem;
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0.6rem 0.5rem;
    border: none;
    background: none;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.82rem;
    transition: all 0.2s;
}

.tab-btn i { width: 15px; height: 15px; }

.tab-btn.active {
    background: white;
    color: var(--terracotta);
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.tab-content textarea { min-height: 90px; }

/* ===================== CADASTRO DE TURMA ===================== */
#modal-turma .modal-body { padding-top: 1.5rem; }

/* ===================== CONFIRMAÇÃO ===================== */
.confirm-card { max-width: 400px; text-align: center; padding: 2.5rem; }

.confirm-icon {
    width: 64px; height: 64px;
    background: #fee2e2; color: var(--danger);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1.5rem;
}

.confirm-icon i { width: 32px; height: 32px; }

.btn-danger-confirm {
    background: var(--danger);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger-confirm:hover { background: #dc2626; transform: scale(1.05); }

/* ===================== TOASTS ===================== */
.toast-container {
    position: fixed; top: 20px; right: 20px; z-index: 9999;
    display: flex; flex-direction: column; gap: 10px;
}

.toast {
    min-width: 280px;
    padding: 16px 20px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-main);
    border-left: 4px solid var(--terracotta);
    animation: slideIn 0.3s ease-out forwards;
}

.toast.success { border-left-color: var(--success); }
.toast.danger { border-left-color: var(--danger); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut { to { transform: translateX(20px); opacity: 0; } }

/* ===================== RESPONSIVIDADE ===================== */
@media (max-width: 768px) {
    :root { --sidebar-width: 0px; }

    .sidebar {
        width: 100%; height: 65px; flex-direction: row;
        bottom: 0; left: 0; top: auto; padding: 0;
        border-right: none; border-top: 3px solid var(--terracotta);
        z-index: 1000; justify-content: space-around; align-items: center;
    }

    .brand { display: none; }
    nav { display: flex; width: 100%; justify-content: space-around; margin: 0; }

    .nav-item {
        margin-bottom: 0; padding: 0.5rem; font-size: 0.75rem;
        text-align: center; flex: 1; border-radius: 0; justify-content: center;
    }

    .content { margin-left: 0; padding: 1rem; padding-bottom: 80px; }

    header { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .filter-bar { flex-direction: column; width: 100%; }
    .btn-main, .btn-add, .btn-outline { width: 100%; }
    .table-wrapper { overflow-x: auto; }
    .stats-grid { grid-template-columns: 1fr; }

    .form-container { flex-direction: column; }
    .form-sidebar { width: 100%; flex-direction: row; align-items: center; gap: 1rem; }
    .photo-upload { width: 90px; height: 90px; margin-bottom: 0; }
    .form-sidebar .input-wrapper { margin-top: 0; flex: 1; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .tabs-nav { flex-wrap: wrap; }
    .tab-btn { flex: 1 1 45%; }
}

.paginacao-controles {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.25rem;
}

.paginacao-controles .pagina-info {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

.paginacao-controles button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.spin-icon {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}