/* =========================================
   ESCOLINHA DE ESPORTES - DESIGN SYSTEM
   ========================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --sidebar-w: 260px;
  --color-bg: #0a2111;
  --color-sidebar: #0f3019;
  --color-card: #164524;
  --color-card-hover: #1b542c;
  --color-border: #26743d;
  --color-accent: #facc15;
  --color-accent-hover: #eab308;
  --color-green: #22c55e;
  --color-yellow: #f59e0b;
  --color-red: #ef4444;
  --color-purple: #a855f7;
  --color-orange: #f97316;
  --color-text: #e2e8f0;
  --color-text-muted: #8896b0;
  --color-text-faint: #4a5568;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.35);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
}

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--color-sidebar);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 30px 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-bottom: 1px solid var(--color-border);
}

.logo-main {
  width: 100%;
  max-width: 210px;
  height: auto;
  display: block;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.5));
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.logo-main:hover {
  transform: scale(1.08) rotate(2deg);
  filter: drop-shadow(0 8px 24px rgba(0,0,0,0.6));
}

.sidebar-logo h1 {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.3;
}

.sidebar-logo span {
  font-size: 12px;
  color: var(--color-text-muted);
  font-weight: 400;
}

.nav-section {
  padding: 16px 12px 8px;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--color-text-faint);
  padding: 0 8px;
  margin-bottom: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 13.5px;
  transition: all 0.2s;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: rgba(250,204,21,0.05);
  color: var(--color-text);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(250,204,21,0.15), rgba(217,119,6,0.05));
  color: var(--color-accent);
  border: 1px solid rgba(250,204,21,0.2);
}

.nav-item .icon { font-size: 17px; width: 22px; text-align: center; }

/* ---- MAIN CONTENT ---- */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--color-sidebar);
  border-bottom: 1px solid var(--color-border);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
}

.topbar-sub {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.content {
  padding: 28px;
  flex: 1;
}

/* ---- CARDS ---- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.2s;
}

.stat-card:hover {
  border-color: var(--color-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 50px; height: 50px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.blue  { background: rgba(59,130,246,0.15); }
.stat-icon.green { background: rgba(34,197,94,0.15); }
.stat-icon.yellow{ background: rgba(245,158,11,0.15); }
.stat-icon.red   { background: rgba(239,68,68,0.15); }
.stat-icon.purple{ background: rgba(168,85,247,0.15); }

.stat-info { flex: 1; }
.stat-value { font-size: 26px; font-weight: 800; }
.stat-label { font-size: 12px; color: var(--color-text-muted); margin-top: 2px; }

/* ---- PANELS ---- */
.panel {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
}

.panel-body { padding: 20px; }

/* ---- TABLE ---- */
.table-wrap { 
  overflow-x: auto; 
  -webkit-overflow-scrolling: touch; 
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--color-text-muted);
  background: rgba(0,0,0,0.2);
  text-align: left;
  white-space: nowrap;
}

tbody tr {
  border-top: 1px solid var(--color-border);
  transition: background 0.15s;
}

tbody tr:hover { background: var(--color-card-hover); }

tbody td {
  padding: 12px 14px;
  color: var(--color-text);
  font-size: 13.5px;
}

/* ---- BADGES ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
}

.badge-green  { background: rgba(34,197,94,0.15);  color: #4ade80; }
.badge-yellow { background: rgba(245,158,11,0.15); color: #fbbf24; }
.badge-red    { background: rgba(239,68,68,0.15);  color: #f87171; }
.badge-blue   { background: rgba(59,130,246,0.15); color: #60a5fa; }
.badge-gray   { background: rgba(148,163,184,0.1); color: #94a3b8; }
.badge-purple { background: rgba(168,85,247,0.15); color: #c084fc; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-accent), #d97706);
  color: #111;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(250,204,21,0.3); }

.btn-green  { background: rgba(34,197,94,0.15);  color: #4ade80; border: 1px solid rgba(34,197,94,0.3); }
.btn-green:hover { background: rgba(34,197,94,0.25); }

.btn-yellow { background: rgba(245,158,11,0.15); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.btn-yellow:hover { background: rgba(245,158,11,0.25); }

.btn-red    { background: rgba(239,68,68,0.15);  color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.btn-red:hover  { background: rgba(239,68,68,0.25); }

.btn-ghost  { background: transparent; color: var(--color-text-muted); border: 1px solid var(--color-border); }
.btn-ghost:hover { background: var(--color-card-hover); color: var(--color-text); }

.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ---- FORMS ---- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }

label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

input, select, textarea {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--color-text);
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(250,204,21,0.15);
}

textarea { resize: vertical; min-height: 80px; }
select option { background: #1c2333; }

.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
}

.search-bar input {
  border: none;
  background: transparent;
  padding: 0;
  flex: 1;
}

.search-bar input:focus { box-shadow: none; }

/* ---- ALERTS ---- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-success { background: rgba(34,197,94,0.12); border: 1px solid rgba(34,197,94,0.3); color: #4ade80; }
.alert-danger  { background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.3); color: #f87171; }
.alert-warning { background: rgba(245,158,11,0.12); border: 1px solid rgba(245,158,11,0.3); color: #fbbf24; }

/* ---- MISC ---- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-muted);
}

.empty-state .icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 15px; }

.divider { height: 1px; background: var(--color-border); margin: 20px 0; }

.flex { display: flex; }
.flex-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.text-muted { color: var(--color-text-muted); font-size: 13px; }
.text-right { text-align: right; }
.w-full { width: 100%; }

/* ---- MODAL ---- */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 999;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 28px;
  width: 90%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .sidebar { 
    transform: translateX(-100%); 
    transition: transform 0.3s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
  }
  .sidebar.open { transform: translateX(0); }
  
  .main { margin-left: 0; display: block; }
  .topbar { padding: 12px 16px; position: sticky; top: 0; }
  .menu-toggle { display: block !important; }
  .desktop-time { display: none; }
  .content { padding: 16px; }
  
  .stat-grid { grid-template-columns: 1fr; gap: 12px; }
  
  /* Flex direction utilities useful for panels */
  .panel-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .panel-header > div, .panel-header > form { width: 100%; display: flex; flex-wrap: wrap; gap: 8px; }
  .panel-header > div > select, .panel-header form select { flex: 1; min-width: 120px; }
  .panel-header > div > a, .panel-header form > button { flex: 1; text-align: center; justify-content: center; }
  
  /* Transform Tables to Mobile Cards */
  .table-wrap { overflow-x: hidden; padding-bottom: 8px; }
  table, thead, tbody, th, td, tr { display: block; }
  thead tr { position: absolute; top: -9999px; left: -9999px; }
  tbody tr {
    margin-bottom: 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: rgba(0,0,0,0.2);
  }
  tbody td {
    border: none;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding: 14px 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
  }
  tbody td:last-child { border-bottom: 0; }
  tbody td::before {
    content: attr(data-label);
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--color-text-muted);
    text-align: center;
    margin-bottom: 2px;
  }
  
  /* Modalities / last students panel grids */
  div[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
}

@media (max-width: 480px) {
  /* Forms stack completely */
  .form-grid { grid-template-columns: 1fr; gap: 12px; }
  
  /* Mensalidades inline preview stack */
  .preview-row span:last-child { display: flex; flex-direction: column; gap: 4px; text-align: right; }
}

/* ---- MOBILE OVERLAY ---- */
.mobile-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(2px);
  z-index: 90;
}
.mobile-overlay.active { display: block; }

/* ---- PAGINATION ---- */
.pagination {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.page-btn {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  transition: all 0.15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.page-btn:hover { background: var(--color-card-hover); color: var(--color-text); }
.page-btn.active { background: var(--color-accent); color: #fff; border-color: var(--color-accent); }

/* ---- MODALITY DOTS ---- */
.mod-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}
/* ---- LOGO FOOTER ---- */
.logo-footer {
  width: 50px;
  height: 50px;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.3));
}
