:root {
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --border: #e2e8f0;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
}

/* LOGIN SCREEN */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: #f1f5f9;
  padding: 1rem;
}

.login-card {
  width: 100%;
  max-width: 380px;
  padding: 2rem;
  border-radius: 10px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.login-error {
  background: #fee2e2;
  color: #b91c1c;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  margin-top: 0.75rem;
}

/* NAVBAR */
.navbar {
  background-color: #0f172a;
  color: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.15rem;
  font-weight: 700;
}

.brand-tag {
  font-size: 0.7rem;
  background: #0284c7;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: 600;
}

.nav-menu {
  display: flex;
  gap: 0.35rem;
}

.nav-tab {
  background: none;
  border: none;
  color: #94a3b8;
  padding: 0.45rem 0.75rem;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s;
}

.nav-tab:hover {
  color: #ffffff;
  background: rgba(255,255,255,0.08);
}

.nav-tab.active {
  color: #ffffff;
  background: #1e293b;
  border-bottom: 2px solid var(--primary);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
}

.user-badge {
  background: rgba(255,255,255,0.08);
  padding: 0.3rem 0.65rem;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-logout {
  background: #334155;
  color: white;
  border: none;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
}
.btn-logout:hover {
  background: #475569;
}

/* CONTAINER */
.container {
  max-width: 1360px;
  margin: 1.25rem auto;
  padding: 0 1rem;
}

/* CARDS & GRIDS */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.card-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
  .nav-menu {
    overflow-x: auto;
  }
}

/* STAT CARDS */
.stat-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.stat-card.alert { border-left: 4px solid var(--danger); }
.stat-card.warning { border-left: 4px solid var(--accent); }
.stat-card.success { border-left: 4px solid var(--success); }
.stat-card.info { border-left: 4px solid var(--primary); }

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
}

.stat-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* BUTTONS */
.btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.88rem;
  text-decoration: none;
  transition: background 0.15s;
}

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

.btn-secondary { background: #e2e8f0; color: #334155; }
.btn-secondary:hover { background: #cbd5e1; }
.btn-secondary.active-subtab { background: #0284c7; color: white; }

.btn-success { background: var(--success); }
.btn-success:hover { background: #059669; }

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #dc2626; }

.btn-sm { padding: 0.25rem 0.55rem; font-size: 0.8rem; }

/* BADGES */
.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-fixo { background: #0f172a; color: #ffffff; }
.badge-reposicao { background: #fee2e2; color: #dc2626; border: 1px solid #fca5a5; }
.badge-experimental { background: #dbeafe; color: #1d4ed8; border: 1px solid #93c5fd; }
.badge-active { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef3c7; color: #b45309; }

/* TABLES */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

th {
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 600;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

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

/* FORMS */
.form-group { margin-bottom: 0.85rem; }

label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.25rem;
}

input, select, textarea {
  width: 100%;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.88rem;
  outline: none;
  background: white;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(2,132,199,0.15);
}

/* QUADRO SEMANAL (WEEKLY BOARD GRID) */
.board-week-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.75rem;
  margin-top: 1rem;
}

@media (max-width: 1000px) {
  .board-week-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 600px) {
  .board-week-grid {
    grid-template-columns: 1fr;
  }
}

.board-day-col {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.board-day-header {
  background: #0f172a;
  color: white;
  padding: 0.6rem;
  text-align: center;
  font-weight: 600;
  font-size: 0.88rem;
}

.board-slot-card {
  border-bottom: 1px solid var(--border);
  padding: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.board-slot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 700;
}

.board-slot-students {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.2rem;
  margin-top: 0.1rem;
}

.board-student-item {
  min-width: 0;
  font-size: 0.75rem;
  padding: 0.2rem 0.35rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
}

.board-student-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-student-item.fixo {
  background: #f1f5f9;
  border-left: 3px solid #0f172a;
  color: #0f172a;
}
.board-student-item.reposicao {
  background: #fee2e2;
  border-left: 3px solid #dc2626;
  color: #b91c1c;
}
.board-student-item.experimental {
  background: #dbeafe;
  border-left: 3px solid #2563eb;
  color: #1d4ed8;
}

/* CHAT SIMULATOR */
.chat-container {
  height: 360px;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  background: #e5ddd5;
}

.chat-messages {
  flex: 1;
  padding: 0.85rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.chat-bubble {
  max-width: 80%;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-size: 0.82rem;
  line-height: 1.4;
  box-shadow: 0 1px 1px rgba(0,0,0,0.1);
}

.chat-bubble.bot {
  background: #ffffff;
  align-self: flex-start;
  border-top-left-radius: 2px;
}

.chat-bubble.user {
  background: #d9fdd3;
  align-self: flex-end;
  border-top-right-radius: 2px;
}

.chat-input-bar {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem;
  background: #f0f2f5;
  border-top: 1px solid var(--border);
}

/* MODAL */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal-content {
  background: white;
  border-radius: 8px;
  padding: 1.5rem;
  width: 90%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.hidden {
  display: none !important;
}
