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

:root {
  --bg-primary: #0f172a;
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-card-border: rgba(255, 255, 255, 0.1);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-cyan: #06b6d4;
  --accent-blue: #3b82f6;
  --status-green: #10b981;
  --status-yellow: #f59e0b;
  --status-red: #ef4444;
  --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --border-radius: 16px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
}

body {
  background: linear-gradient(135deg, #0b132b 0%, #1c2541 50%, #0b2545 100%);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header & Navbar */
header {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--bg-card-border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 1rem 2rem;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1.25rem;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.4);
}

nav ul {
  display: flex;
  list-style: none;
  gap: 1.5rem;
}

nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 8px;
  transition: all 0.3s ease;
}

nav a:hover, nav a.active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.offline-badge {
  display: none;
  background: var(--status-red);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

/* Layout Principal */
main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.page-title {
  margin-bottom: 1.5rem;
}

.page-title h1 {
  font-size: 1.8rem;
  font-weight: 700;
}

.page-title p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* Tarjetas y Grid */
.grid-kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  box-shadow: var(--card-shadow);
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.2);
}

.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.kpi-value {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.kpi-sub {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

/* Indicador de Semáforo */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

.status-pill.green {
  background: rgba(16, 185, 129, 0.15);
  color: var(--status-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-pill.yellow {
  background: rgba(245, 158, 11, 0.15);
  color: var(--status-yellow);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-pill.red {
  background: rgba(239, 68, 68, 0.15);
  color: var(--status-red);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.status-pill.green .status-dot { background: var(--status-green); box-shadow: 0 0 8px var(--status-green); }
.status-pill.yellow .status-dot { background: var(--status-yellow); box-shadow: 0 0 8px var(--status-yellow); }
.status-pill.red .status-dot { background: var(--status-red); box-shadow: 0 0 8px var(--status-red); }

/* Gráficas */
.chart-container {
  margin-bottom: 2rem;
}

.chart-wrapper {
  position: relative;
  height: 350px;
  width: 100%;
}

/* Formularios */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--bg-card-border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.3s;
}

.form-control:focus {
  border-color: var(--accent-cyan);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  color: white;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(6, 182, 212, 0.4);
}

/* Tablas */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th, td {
  padding: 1rem;
  border-bottom: 1px solid var(--bg-card-border);
}

th {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

/* Footer */
footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
  border-top: 1px solid var(--bg-card-border);
  background: rgba(15, 23, 42, 0.5);
  margin-top: auto;
}
