@import url('https://fonts.googleapis.com/css2?family=Kalam:wght@400;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg-site: #e8eef2;
    --board-frame: #64748b;
    --primary: #2563eb;
    --text-dark: #1e293b;
    --danger: #ef4444;
    --danger-bg: #fee2e2;
    
    --paper-1: #fef9c3; 
    --paper-2: #e0f2fe; 
    --paper-3: #dcfce7; 
    --paper-4: #fce7f3; 
    --paper-5: #f3e8ff; 
    --paper-6: #ffedd5; 
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-site);
    color: var(--text-dark);
    margin: 0;
    padding: 20px;
    overflow-x: hidden; /* Impede a tela toda de rolar pros lados */
}

h1 {
    font-family: 'Kalam', cursive;
    text-align: center;
    font-size: clamp(2rem, 5vw, 2.8rem); /* Texto adapta ao tamanho da tela */
    color: var(--text-dark);
    margin-bottom: 30px;
}

/* --- CONTROLES SUPERIORES --- */
.header-controls {
    max-width: 1100px;
    margin: 0 auto 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 10px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    flex-wrap: wrap;
    gap: 15px;
}

select {
    border: 1px solid #cbd5e1;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    color: var(--primary);
    font-family: inherit;
    outline: none;
    cursor: pointer;
}

/* --- QUADRO BRANCO (TABELA) --- */
.board-container {
    max-width: 1100px;
    margin: 0 auto 40px;
    background: white;
    border: 14px solid var(--board-frame);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 15px 25px rgba(0,0,0,0.1), inset 0 0 10px rgba(0,0,0,0.05);
    position: relative;
}

.board-container::after {
    content: '';
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 8px;
    background: #475569;
    border-radius: 0 0 8px 8px;
}

/* Scroll horizontal APENAS dentro do quadro */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 5px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 650px; /* Impede que a tabela se amasse no celular */
}

th {
    font-family: 'Kalam', cursive;
    font-size: 1.2rem;
    color: var(--primary);
    text-align: left;
    padding: 12px;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    font-weight: 500;
}

input[type="number"] {
    width: 50px;
    padding: 6px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    text-align: center;
    font-family: 'Kalam', cursive;
    font-size: 1rem;
}

tr { transition: background-color 0.2s; }
tr:has(.btn-remover:hover) { background-color: var(--danger-bg); }

.btn-remover {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.3rem;
    transition: transform 0.2s;
}
.btn-remover:hover { transform: scale(1.2); }

/* --- AVISOS --- */
#avisos {
    max-width: 1100px;
    margin: 0 auto 30px;
    padding: 15px;
    background: white;
    border: 2px dashed var(--danger);
    border-radius: 8px;
    color: var(--danger);
    font-family: 'Kalam', cursive;
    font-size: 1.1rem;
    font-weight: bold;
    display: none;
}

/* --- FOLHAS DE CADERNO (HORÁRIOS) --- */
.schedule-header {
    max-width: 1200px;
    margin: 0 auto 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    padding: 0 10px;
}

.schedule-header h2 {
    font-family: 'Kalam', cursive;
    color: var(--text-dark);
    margin: 0;
    font-size: clamp(1.5rem, 4vw, 1.8rem);
}

/* Sistema de Grid Responsivo */
#dias-container {
    display: grid;
    /* Faz as folhas se ajustarem automaticamente sem esmagar */
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); 
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.paper-card {
    position: relative;
    padding: 15px 15px 15px 35px;
    border-radius: 2px 12px 12px 2px;
    box-shadow: 3px 5px 15px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    min-height: 250px;
    background-image: linear-gradient(#cbd5e1 1px, transparent 1px);
    background-size: 100% 32px;
    background-position: 0 45px;
}

.paper-card::before {
    content: '';
    position: absolute;
    top: 0; bottom: 0; left: 25px;
    width: 2px;
    background-color: #fca5a5;
}

.paper-card.hidden { display: none; }

.paper-card strong {
    font-family: 'Kalam', cursive;
    font-size: 1.2rem;
    color: var(--text-dark);
    text-align: center;
    display: block;
    margin-bottom: 20px;
    background: var(--paper-bg);
    padding: 0 5px;
}

.class-item {
    position: relative;
    margin-bottom: 12px;
    line-height: 1.2;
    background: rgba(255,255,255,0.4);
    padding: 5px;
    border-radius: 4px;
}

.m-nome {
    font-family: 'Kalam', cursive;
    font-weight: 700;
    font-size: 0.95rem;
    display: block;
}

.m-faltas {
    font-family: 'Kalam', cursive;
    font-size: 0.8rem;
    color: #475569;
}

.del-aula {
    position: absolute;
    top: 2px; right: 2px;
    background: none; border: none;
    color: var(--danger); cursor: pointer;
    font-size: 1rem;
}

/* --- BOTÕES GERAIS --- */
.btn {
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-blue { background: var(--primary); color: white; }
.btn-blue:hover { background: #1d4ed8; }

.btn-outline { background: white; border: 1px solid #cbd5e1; color: var(--text-dark); }
.btn-outline:hover { background: #f1f5f9; }

.btn-add-aula {
    margin-top: auto;
    background: rgba(255,255,255,0.6);
    border: 1px dashed #94a3b8;
    font-size: 0.8rem;
    padding: 4px;
    width: 100%;
}

/* --- AJUSTES PARA CELULARES PEQUENOS --- */
@media (max-width: 600px) {
    body { padding: 10px 10px 40px; }
    .board-container { border-width: 8px; padding: 15px 10px; }
    .board-container::after { bottom: -16px; height: 6px; }
    
    /* No celular, os cadernos se empilham e as margens são reduzidas */
    #dias-container { grid-template-columns: 1fr; gap: 15px; }
    .paper-card { padding: 15px 10px 15px 25px; }
    .paper-card::before { left: 15px; }
}