/* ==========================================================================
   PYCANCHITEX WEB ADMIN — Sports Dark Slate / Grass Emerald Modern Design System
   Exactamente alineado con el sistema de PC (PySide6 Desktop)
   Paleta: Dark Slate (#0f172a) + Clean Slate (#f8fafc) + Emerald Grass (#059669 / #10b981)
   ========================================================================== */

:root {
  --bg-body: #f8fafc;
  --bg-sidebar: #0f172a;
  --bg-topbar: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-input: #ffffff;
  
  --border-color: #e2e8f0;
  --border-input: #cbd5e1;
  --border-focus: #059669;
  
  --emerald-600: #059669;
  --emerald-500: #10b981;
  --emerald-400: #34d399;
  --emerald-glow: rgba(16, 185, 129, 0.2);
  
  --sky-600: #0284c7;
  --sky-500: #0ea5e9;
  --amber-500: #f59e0b;
  --rose-500: #ef4444;
  --indigo-500: #6366f1;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  
  --font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
}

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

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

/* --------------------------------------------------------------------------
   LAYOUT PRINCIPAL: SIDEBAR + MAIN CONTENT
   -------------------------------------------------------------------------- */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Dark Slate (#0f172a) idéntico a la PC */
.sidebar {
  width: 250px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid #1e293b;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 20px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #1e293b;
}

.brand-icon {
  width: 38px;
  height: 38px;
  background-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.brand-title {
  font-size: 16px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.5px;
}

.brand-subtitle {
  font-size: 10px;
  font-weight: 700;
  color: var(--emerald-400);
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.nav-link i {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.nav-link:hover {
  color: #ffffff;
  background-color: #1e293b;
}

.nav-link.active {
  color: #ffffff;
  background-color: #059669;
  box-shadow: 0 4px 12px var(--emerald-glow);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid #1e293b;
}

.btn-logout {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  background-color: #1e293b;
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-logout:hover {
  background-color: #ef4444;
  color: white;
}

/* --------------------------------------------------------------------------
   MAIN WRAPPER & TOPBAR
   -------------------------------------------------------------------------- */
.main-wrapper {
  flex: 1;
  margin-left: 250px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: 64px;
  background-color: var(--bg-topbar);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 90;
}

.page-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.cloud-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

.cloud-pill.offline {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f1f5f9;
  color: #334155;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   CONTENT CONTAINER & KPIS
   -------------------------------------------------------------------------- */
.content-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.kpi-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
}

.kpi-sub {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   CARDS, TABLES & GRIDS
   -------------------------------------------------------------------------- */
.panel-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

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

.panel-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.table-custom {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  color: #0f172a;
}

.table-custom th {
  background-color: #0f172a;
  color: #ffffff;
  padding: 10px 14px;
  text-align: left;
  font-weight: 700;
  font-size: 12px;
  white-space: nowrap;
}

.table-custom td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  color: #0f172a;
  font-weight: 500;
}

.table-custom tr:nth-child(even) {
  background-color: #f8fafc;
}

.table-custom tr:hover {
  background-color: #f1f5f9;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}

.badge.success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.badge.danger { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.badge.warning { background: #fef9c3; color: #a16207; border: 1px solid #fef08a; }
.badge.info { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary { background-color: var(--emerald-600); color: white; }
.btn-primary:hover { background-color: #047857; }
.btn-secondary { background-color: #e2e8f0; color: #334155; }
.btn-secondary:hover { background-color: #cbd5e1; }
.btn-danger { background-color: #ef4444; color: white; }
.btn-danger:hover { background-color: #dc2626; }

/* --------------------------------------------------------------------------
   CANCHAS: MONITOR VISUAL DE HORARIOS
   -------------------------------------------------------------------------- */
.courts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.court-card {
  background: white;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.court-card.cancha-1 { border-top: 5px solid #059669; }
.court-card.cancha-2 { border-top: 5px solid #0284c7; }

.court-header {
  padding: 14px 18px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.court-title {
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
}

.slot-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
}

.slot-time { font-weight: 700; color: #334155; }

/* --------------------------------------------------------------------------
   RESPONSIVE DESIGN (MÓVILES)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .main-wrapper {
    margin-left: 0;
  }
  .mobile-menu-btn {
    display: inline-flex !important;
  }
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-main);
  cursor: pointer;
  padding: 6px;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  z-index: 95;
}

.sidebar-backdrop.active {
  display: block;
}
