:root {
  --bg-primary: #0a0f1d;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-glass: rgba(15, 23, 42, 0.65);
  --border-glass: rgba(255, 255, 255, 0.08);
  
  --accent-cyan: #06b6d4;
  --accent-blue: #3b82f6;
  --accent-indigo: #6366f1;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-purple: #8b5cf6;

  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;

  --font-family: 'Plus Jakarta Sans', 'Outfit', sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-main: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(6, 182, 212, 0.15);
}

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

body.dark-theme {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* GLASS & UTILS */
.glass-panel {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-main);
}

.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.85rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.max-w-700 { max-width: 700px; }

/* TOAST NOTIFICATIONS */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border-left: 4px solid var(--accent-cyan);
  color: #fff;
  box-shadow: 0 5px 15px rgba(0,0,0,0.4);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s forwards;
}
.toast.success { border-left-color: var(--accent-emerald); }
.toast.error { border-left-color: var(--accent-rose); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* LOGIN OVERLAY */
.login-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, #1e293b 0%, #090d16 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 440px;
  padding: 35px;
}

.login-header {
  text-align: center;
  margin-bottom: 25px;
}

.brand-logo {
  font-size: 2.8rem;
  color: var(--accent-cyan);
  margin-bottom: 10px;
  text-shadow: 0 0 15px rgba(6, 182, 212, 0.4);
}

.login-header h2 {
  font-size: 1.8rem;
  font-weight: 700;
}

.login-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 5px;
}

/* FORM STYLES */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 11px 14px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.2);
}

.error-banner {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid var(--accent-rose);
  color: var(--accent-rose);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 15px;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
  color: #fff;
}
.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-glass);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-danger {
  background: var(--accent-rose);
  color: #fff;
}
.btn-danger:hover {
  background: #e11d48;
}

.btn-danger-outline {
  background: transparent;
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: var(--accent-rose);
}
.btn-danger-outline:hover {
  background: rgba(244, 63, 94, 0.2);
}

.btn-success {
  background: var(--accent-emerald);
  color: #fff;
}

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

.btn-block {
  width: 100%;
}

.btn-icon-only {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
}

/* MAIN LAYOUT */
.admin-app {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* SIDEBAR */
.sidebar {
  width: 260px;
  background: #0d1322;
  border-right: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-glass);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  font-size: 1.8rem;
  color: var(--accent-cyan);
}

.brand-title {
  display: block;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.brand-subtitle {
  display: block;
  font-size: 0.7rem;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}

.sidebar-nav {
  padding: 15px 10px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

.nav-item i {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
}

.nav-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(6, 182, 212, 0.2), transparent);
  border-left: 3px solid var(--accent-cyan);
  font-weight: 600;
}

.sidebar-footer {
  padding: 15px 20px;
  border-top: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0,0,0,0.2);
}

.admin-profile-info {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.admin-avatar {
  font-size: 1.5rem;
  color: var(--accent-cyan);
}

.admin-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.admin-name {
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-email {
  font-size: 0.72rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* MAIN CONTENT */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-primary);
}

.top-header {
  padding: 20px 30px;
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(13, 19, 34, 0.5);
}

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

.top-header-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--accent-emerald);
  font-weight: 600;
}

.pulse {
  width: 8px;
  height: 8px;
  background: var(--accent-emerald);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-ring 1.8s infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.content-body {
  flex: 1;
  padding: 30px;
  overflow-y: auto;
}

.content-view {
  display: none;
}
.content-view.active {
  display: block;
}

/* DASHBOARD KPIS */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.kpi-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.kpi-icon {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: #fff;
}

.users-bg { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.boats-bg { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.trips-bg { background: linear-gradient(135deg, #10b981, #047857); }
.nm-bg { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }

.kpi-value {
  display: block;
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1.1;
}

.kpi-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.secondary-kpis .small-card {
  padding: 14px 18px;
  gap: 12px;
  font-size: 0.85rem;
}

.secondary-kpis i { font-size: 1.2rem; }
.icon-cyan { color: var(--accent-cyan); }
.icon-emerald { color: var(--accent-emerald); }
.icon-amber { color: var(--accent-amber); }
.icon-purple { color: var(--accent-purple); }
.icon-pink { color: var(--accent-rose); }

.dashboard-tables-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-glass);
}
.panel-header h3 {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}
.panel-body { padding: 15px; }

/* DATA TABLES */
.action-bar {
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.search-box {
  position: relative;
  width: 320px;
}
.search-box i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
}
.search-box input {
  padding-left: 36px;
}

.table-container {
  overflow-x: auto;
}

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

.data-table th {
  background: rgba(0,0,0,0.2);
  padding: 14px 18px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-glass);
}

.data-table td {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.compact-table td, .compact-table th {
  padding: 10px 14px;
}

.avatar-cell {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: #1e293b;
}

.status-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-block;
}
.badge-recording { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); }
.badge-ended { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }

/* SPECIES GRID */
.species-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.species-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.species-img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: #1e293b;
}

.species-body {
  padding: 16px;
}
.species-name {
  font-size: 1.05rem;
  font-weight: 700;
}
.species-latin {
  font-style: italic;
  font-size: 0.85rem;
  color: var(--accent-cyan);
  margin-bottom: 8px;
}

/* BADGES & BLOBS GRID */
.badges-grid, .blobs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.badge-card, .blob-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}
.badge-icon-img, .blob-preview-img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  margin: 0 auto 12px;
}
.blob-preview-img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

/* TABS HEADER */
.tabs-header {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-glass);
  padding-bottom: 10px;
}

.tab-btn {
  padding: 8px 18px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.tab-btn.active {
  background: var(--accent-cyan);
  color: #fff;
}

.subtab-content { display: none; }
.subtab-content.active { display: block; }

/* MODALS */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  width: 100%;
  max-width: 550px;
  padding: 25px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.divider {
  border: 0;
  border-top: 1px solid var(--border-glass);
  margin: 20px 0;
}

/* WEATHER PANEL STYLING */
.weather-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 15px;
}

.weather-stat-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 15px;
}

.weather-stat-card .icon-wrap {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.icon-wrap.wind-bg { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); }
.icon-wrap.compass-bg { background: rgba(99, 102, 241, 0.15); color: var(--accent-indigo); }
.icon-wrap.gust-bg { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }
.icon-wrap.press-bg { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); }
.icon-wrap.temp-bg { background: rgba(244, 63, 94, 0.15); color: var(--accent-rose); }

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-val {
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
}

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