/* Variáveis Dinâmicas (sobrescritas por theme.php) */
:root {
  --cor-primaria: #003366;
  --cor-secundaria: #FF6600;
  --cor-sucesso: #28a745;
  --cor-alerta: #ffc107;
  --cor-erro: #dc3545;
  --cor-fundo: #f8f9fa;
}

/* ============================================================
   Salas Acadêmicas — Design System
   Estética: Editorial acadêmico · tons de ardósia e âmbar
   Tipografia: DM Serif Display + DM Sans
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --ink:          #1a1a2e;
  --ink-light:    #3d3d5c;
  --ink-muted:    #7a7a9a;
  --paper:        #f7f5f0;
  --paper-dark:   #eeebe3;
  --paper-card:   #ffffff;
  --accent:       #c8860a;        /* âmbar */
  --accent-soft: #fdf2e0;
  --green:        #2a7a4b;
  --green-soft:   #e2f3eb;
  --red:          #c0392b;
  --red-soft:     #fdecea;
  --blue:         #2563eb;
  --blue-soft:    #eff6ff;
  --border:       #e2ddd5;
  --shadow-sm:    0 1px 3px rgba(26,26,46,.08);
  --shadow-md:    0 4px 16px rgba(26,26,46,.1);
  --shadow-lg:    0 12px 40px rgba(26,26,46,.15);
  --radius:       10px;
  --radius-lg:    16px;
  --sidebar-w:    240px;
  --font-serif:   'DM Serif Display', Georgia, serif;
  --font-sans:    'DM Sans', system-ui, sans-serif;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }

/* ── Layout container ───────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }

/* ── Typography ────────────────────────────────────────────── */
h1, h2, h3 { font-family: var(--font-serif); line-height: 1.2; }
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
em { font-style: italic; color: var(--accent); }
.text-muted { color: var(--ink-muted); font-size: .875rem; }
.tc { text-align: center; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .55rem 1.2rem;
  background: var(--ink); color: #fff;
  border: none; border-radius: var(--radius);
  font-family: var(--font-sans); font-size: .875rem; font-weight: 500;
  cursor: pointer; transition: opacity .2s, transform .15s;
  white-space: nowrap;
}
.btn:hover { opacity: .85; transform: translateY(-1px); text-decoration: none; }
.btn-primary { background: var(--accent); }
.btn-ghost   { background: transparent; color: var(--ink); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: var(--paper-dark); }
.btn-perigo  { background: var(--red); }
.btn-sm  { padding: .4rem .9rem; font-size: .8rem; }
.btn-xs  { padding: .3rem .7rem; font-size: .75rem; border-radius: 6px; }
.btn-full { width: 100%; justify-content: center; }

/* ── Alerts ────────────────────────────────────────────────── */
.alert {
  padding: .85rem 1.1rem;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  font-size: .9rem;
  border-left: 4px solid currentColor;
}
.alert-ok   { background: var(--green-soft); color: var(--green); }
.alert-erro { background: var(--red-soft);   color: var(--red);   }
.alert-info { background: var(--blue-soft);  color: var(--blue);  }

/* ── Forms ─────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: .4rem; }
.field-full { grid-column: 1 / -1; }
.field-check { flex-direction: row; align-items: center; }
.check-label { display: flex; align-items: center; gap: .5rem; cursor: pointer; }
label { font-size: .85rem; font-weight: 500; color: var(--ink-light); }
.field-hint { font-size: .8rem; color: var(--ink-muted); margin-top: .2rem; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="search"],
select,
textarea {
  padding: .65rem .9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-sans); font-size: .925rem;
  background: var(--paper-card); color: var(--ink);
  transition: border-color .2s, box-shadow .2s;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(200,134,10,.15);
}
textarea { resize: vertical; min-height: 80px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.form-actions { display: flex; gap: .75rem; flex-wrap: wrap; }

/* ── Card ───────────────────────────────────────────────────── */
.card {
  background: var(--paper-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.card-title { font-family: var(--font-serif); font-size: 1.15rem; margin-bottom: 1rem; }

/* ── Table ─────────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tabela {
  width: 100%; border-collapse: collapse; font-size: .875rem;
}
.tabela th {
  background: var(--paper-dark); text-align: left;
  padding: .65rem .9rem; font-weight: 600; font-size: .8rem;
  text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.tabela td { padding: .65rem .9rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tabela tr:last-child td { border-bottom: none; }
.tabela tr:hover td { background: var(--paper); }

/* ── Badges ────────────────────────────────────────────────── */
.badge-turno {
  display: inline-block; padding: .2rem .65rem;
  border-radius: 20px; font-size: .75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em;
}
.badge-turno.matutino    { background: #fff7e0; color: #92640a; }
.badge-turno.vespertino  { background: #e8f0ff; color: #2047a0; }
.badge-turno.noturno     { background: #1a1a2e; color: #c8b8ff; }

.status-tag {
  display: inline-block; padding: .15rem .6rem;
  border-radius: 20px; font-size: .75rem; font-weight: 600;
}
.status-tag.cancelado  { background: var(--red-soft);  color: var(--red); }
.status-tag.modificado { background: #fff3e0; color: #c45700; }
.status-tag.ativo      { background: var(--green-soft); color: var(--green); }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.page-login {
  background: var(--ink);
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 2rem;
}
.login-wrapper {
  display: grid; grid-template-columns: 1fr 1fr;
  max-width: 860px; width: 100%;
  background: var(--paper-card); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.login-brand {
  background: var(--accent);
  padding: 3rem 2.5rem;
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 1rem;
  text-align: center;
}
.brand-icon { font-size: 2.5rem; }
.brand-header {
  display: flex; align-items: center; gap: 1.5rem;
}
.brand-logo {
  width: 80px; height: 80px;
  object-fit: contain;
  flex-shrink: 0;
}
.brand-logo-login {
  width: 120px; height: 120px;
  object-fit: contain;
  display: block;
  margin: 0 auto 1.5rem auto;
  align-self: center;
}
.login-brand h1 { color: white; font-size: 2.2rem; margin: 0; }
.login-brand p  { color: rgba(255,255,255,.8); font-size: .95rem; }
.login-card { padding: 3rem 2.5rem; }
.login-card h2 { font-family: var(--font-serif); font-size: 1.8rem; margin-bottom: 1.5rem; }
.login-card .field { margin-bottom: 1rem; }
.login-card .btn { margin-top: .5rem; }
.link-aluno {
  display: block; margin-top: 1.25rem;
  font-size: .875rem; color: var(--accent);
  text-align: center;
}

@media (max-width: 600px) {
  .login-wrapper { grid-template-columns: 1fr; }
  .login-brand { padding: 2rem; }
  .login-card  { padding: 2rem; }
  .brand-header { flex-direction: column; text-align: center; gap: 1rem; }
  .brand-logo { width: 60px; height: 60px; }
  .login-brand h1 { font-size: 1.6rem; }
}

/* ============================================================
   ADMIN LAYOUT
   ============================================================ */
.page-admin { display: flex; min-height: 100vh; }

.admin-sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--ink); color: #e2e2f0;
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; height: 100vh;
  z-index: 100; overflow-y: auto;
}
.sidebar-brand {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand a {
  font-family: var(--font-serif); font-size: 1.1rem;
  color: #fff; font-weight: 700;
  display: flex; align-items: center; gap: .5rem;
}
.sidebar-nav { display: flex; flex-direction: column; padding: .75rem 0; flex: 1; }
.nav-item {
  padding: .7rem 1.25rem;
  color: rgba(226,226,240,.75); font-size: .875rem;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
}
.nav-item:hover, .nav-item.active {
  background: rgba(255,255,255,.07); color: #fff;
  text-decoration: none; border-left-color: var(--accent);
}
.nav-logout { color: rgba(200,80,80,.8); }
.nav-logout:hover { color: #ff8080; background: rgba(200,80,80,.1); }
.sidebar-divider { height: 1px; background: rgba(255,255,255,.08); margin: .5rem 1.25rem; }
.sidebar-user {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: .8rem; color: rgba(226,226,240,.5);
}

.admin-main {
  flex: 1; margin-left: var(--sidebar-w);
  padding: 1.5rem 2rem 3rem;
  max-width: calc(100% - var(--sidebar-w));
}
.admin-topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.75rem; padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.topbar-date { color: var(--ink-muted); font-size: .875rem; }

/* Stat Cards */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr));
  gap: 1rem; margin-bottom: 1.75rem;
}
.stat-card {
  background: var(--paper-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem 1.5rem;
  display: flex; align-items: center; gap: 1rem;
  box-shadow: var(--shadow-sm);
}
.stat-icon   { font-size: 2rem; }
.stat-valor  { font-family: var(--font-serif); font-size: 2rem; line-height: 1; }
.stat-label  { font-size: .8rem; color: var(--ink-muted); }

/* Mobile: oculta sidebar e usa menu hamburger */
@media (max-width: 768px) {
  .admin-sidebar { transform: translateX(-100%); transition: transform .3s; }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; max-width: 100%; padding: 1rem; }
  .admin-topbar h1::before {
    content: '☰ ';
    cursor: pointer;
  }
}

/* ============================================================
   STUDENT DASHBOARD
   ============================================================ */
.page-aluno { background: var(--paper); }

.site-header {
  background: var(--paper-card); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: .9rem; padding-bottom: .9rem;
}
.logo {
  display: flex; align-items: center; gap: 0.75rem;
  font-family: var(--font-serif); font-size: 1.2rem; color: var(--ink); font-weight: 700;
  text-decoration: none;
}
.logo img {
  width: 50px; height: 50px;
  object-fit: contain;
  flex-shrink: 0;
}
.header-nav { display: flex; align-items: center; gap: .75rem; }
.data-hoje { font-size: .875rem; color: var(--ink-muted); }

/* Seção do Filtro */
.filtro-section {
  background: var(--ink);
  padding: 2.5rem 0 2rem;
  color: white;
}
.filtro-section label {
  color: rgba(255, 255, 255, 0.9) !important;
  font-weight: 600;
  margin-bottom: 0.25rem;
}
.section-title {
  font-family: var(--font-serif); font-size: clamp(1.4rem, 3vw, 2rem);
  color: white; margin-bottom: 1.25rem;
}

/* Grid adaptativa para 4 campos */
.filtro-grid, .filtro-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
  width: 100%;
}

.filtro-campo {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* Estilização dos Inputs e Seletores na Seção de Filtro */
.filtro-input, .filtro-select {
  background: rgba(255, 255, 255, 0.1) !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  color: #ffffff !important;
  border-radius: var(--radius) !important;
  padding: 0.65rem 0.9rem;
  font-size: 0.925rem;
  color-scheme: dark; /* Garante que o ícone do calendário do input[type="date"] fique branco */
}

/* Inverte a cor do ícone do calendário para navegadores Webkit (Chrome, Edge, Safari) */
input[type="date"].filtro-input::-webkit-calendar-picker-indicator {
  filter: invert(1);
  cursor: pointer;
  opacity: 0.8;
}
input[type="date"].filtro-input::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

.filtro-input::placeholder { color: rgba(255, 255, 255, 0.5) !important; }

.filtro-input:focus, .filtro-select:focus {
  background: rgba(255, 255, 255, 0.18) !important;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(200, 134, 10, 0.4) !important;
  outline: none;
}

.filtro-select option {
  background: var(--ink);
  color: white;
}

/* Sala Grid */
.sala-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
  padding: 2rem 1.5rem;
  max-width: 1200px; margin: 0 auto;
}

.sala-card {
  background: var(--paper-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s;
}
.sala-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.sala-card[hidden] { display: none !important; }

.sala-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem .75rem;
  border-bottom: 1px solid var(--border);
}
.sala-header h3 { font-size: 1rem; font-family: var(--font-serif); }
.sala-cap { font-size: .8rem; color: var(--ink-muted); }

.sala-mapa-preview {
  position: relative; height: 140px; overflow: hidden;
  background: var(--paper-dark); cursor: pointer;
}
.sala-mapa-preview img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .3s;
}
.sala-mapa-preview:hover img { transform: scale(1.04); }
.mapa-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(26,26,46,.5); color: white;
  font-size: .875rem; font-weight: 600;
  opacity: 0; transition: opacity .2s;
}
.sala-mapa-preview:hover .mapa-overlay { opacity: 1; }
.sala-sem-mapa {
  height: 60px; display: flex; align-items: center; justify-content: center;
  background: var(--paper-dark); color: var(--ink-muted); font-size: .8rem;
}

.sala-livre {
  padding: 1rem 1.25rem; color: var(--green);
  font-size: .875rem; font-weight: 500;
  background: var(--green-soft);
}

.turnos-lista { padding: .75rem; display: flex; flex-direction: column; gap: .5rem; }
.turno-item {
  border-radius: var(--radius); padding: .75rem 1rem;
  background: var(--paper);
  border: 1px solid var(--border);
}
.turno-item.status-cancelado  { opacity: .65; background: var(--red-soft); }
.turno-item.status-modificado { background: #fff9f0; }
.turno-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .3rem; }
.turno-badge {
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--accent);
}
.turno-disciplina { font-weight: 600; font-size: .9rem; }
.turno-info  { font-size: .8rem; color: var(--ink-muted); margin-top: .2rem; }
.turno-obs   { font-size: .8rem; color: var(--blue); margin-top: .35rem;
               background: var(--blue-soft); padding: .3rem .6rem; border-radius: 6px; }

.empty-state {
  grid-column: 1 / -1; text-align: center; padding: 4rem 2rem;
  color: var(--ink-muted);
}
.empty-state span { font-size: 3rem; display: block; margin-bottom: 1rem; }

/* ============================================================
   MODAL
   ============================================================ */
.modal {
  display: none; position: fixed; inset: 0; z-index: 200;
  align-items: center; justify-content: center;
}
.modal.open { display: flex; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(26,26,46,.6); backdrop-filter: blur(4px);
}
.modal-content {
  position: relative; z-index: 1;
  background: var(--paper-card); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: min(90vw, 720px);
  max-height: 90vh; overflow: auto; animation: pop .25s ease-out;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.5rem; border-bottom: 1px solid var(--border);
}
.modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 1.2rem; color: var(--ink-muted); padding: .25rem;
}
.modal-body { padding: 1.25rem 1.5rem 1.5rem; }

@keyframes pop {
  from { transform: scale(.95); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  .filtro-grid, .filtro-form-grid { grid-template-columns: 1fr; }
  .sala-grid   { grid-template-columns: 1fr; padding: 1rem; }
  .header-nav .data-hoje { display: none; }
}