/* ============================================================
   AQUANASSRI Management — Aquatic Blue Theme
   ============================================================ */

:root {
  --aqua-50:  #e6f6fb;
  --aqua-100: #c2e8f4;
  --aqua-200: #8fd4ea;
  --aqua-300: #4fb9d8;
  --aqua-400: #1a97bd;
  --aqua-500: #0e78a0;
  --aqua-600: #08587a;
  --aqua-700: #063f5a;
  --aqua-800: #04283a;
  --aqua-900: #011a26;

  --accent: #00c2c7;
  --accent-dark: #0097a0;
  --coral: #ff7a59;

  --success: #16a34a;
  --danger:  #dc2626;
  --warning: #f59e0b;
  --info:    #0ea5e9;

  --bg: #f4f8fb;
  --card-bg: #ffffff;
  --text: #0f2b3a;
  --text-muted: #64798a;
  --border: #e2ecf3;

  --sidebar-w: 260px;
  --topbar-h: 64px;
  --radius: 10px;
  --shadow-sm: 0 1px 3px rgba(6, 63, 90, 0.06);
  --shadow-md: 0 4px 12px rgba(6, 63, 90, 0.08);
  --shadow-lg: 0 10px 30px rgba(6, 63, 90, 0.12);
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  min-height: 100vh;
  font-size: 14px;
}

/* ============ LOGIN ============ */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--aqua-600) 0%, var(--aqua-800) 50%, var(--aqua-900) 100%);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.login-wrapper::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(0, 194, 199, 0.15), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(79, 185, 216, 0.15), transparent 40%);
}
.login-card {
  background: white;
  border-radius: 16px;
  padding: 40px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.3);
  width: 100%;
  max-width: 400px;
  position: relative;
  z-index: 1;
}
.login-brand {
  text-align: center;
  margin-bottom: 30px;
}
.login-brand .bi {
  font-size: 3.5rem;
  background: linear-gradient(135deg, var(--aqua-500), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.login-brand h1 {
  font-size: 1.5rem;
  margin: 10px 0 5px;
  color: var(--aqua-800);
  font-weight: 700;
  letter-spacing: 1px;
}
.login-brand p {
  color: var(--text-muted);
  margin: 0;
  font-size: 0.85rem;
  letter-spacing: 2px;
}

/* ============ LAYOUT ============ */
.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--aqua-800) 0%, var(--aqua-900) 100%);
  color: rgba(255,255,255,0.85);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.3s ease;
}
.sidebar-brand {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand .bi {
  font-size: 2rem;
  color: var(--accent);
}
.brand-name { font-weight: 700; font-size: 1.1rem; color: white; letter-spacing: 1px; }
.brand-sub  { font-size: 0.75rem; color: rgba(255,255,255,0.55); letter-spacing: 3px; }

.sidebar-nav { padding: 10px 0 30px; }
.nav-section {
  padding: 15px 20px 8px;
  font-size: 0.7rem;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  letter-spacing: 1.5px;
  font-weight: 600;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 0.9rem;
  border-left: 3px solid transparent;
  transition: all 0.2s;
}
.nav-link:hover {
  background: rgba(255,255,255,0.05);
  color: white;
  border-left-color: var(--accent);
}
.nav-link.active {
  background: rgba(0, 194, 199, 0.12);
  color: white;
  border-left-color: var(--accent);
  font-weight: 500;
}
.nav-link .bi { font-size: 1.1rem; }

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
}

.topbar {
  height: var(--topbar-h);
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 20px;
}
.btn-menu {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--aqua-700);
  cursor: pointer;
}
.topbar-title { font-weight: 600; font-size: 1.05rem; color: var(--aqua-800); }
.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 15px;
}

.cash-indicator {
  background: linear-gradient(135deg, var(--aqua-50), white);
  border: 1px solid var(--aqua-200);
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--aqua-700);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}
.cash-indicator .bi { color: var(--accent-dark); }

.btn-notif, .btn-user {
  background: none;
  border: none;
  color: var(--aqua-700);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-notif:hover, .btn-user:hover { background: var(--aqua-50); }
.btn-user { font-size: 1rem; }
.btn-user .bi { font-size: 1.6rem; }

.notif-badge {
  position: absolute;
  top: 2px; right: 2px;
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  font-weight: 700;
}
.notif-dropdown { width: 360px; max-height: 500px; overflow-y: auto; padding: 0; }
.notif-header {
  padding: 12px 15px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.notif-item {
  display: block;
  padding: 12px 15px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  border-left: 3px solid var(--aqua-300);
  transition: background 0.15s;
}
.notif-item:hover { background: var(--aqua-50); color: var(--text); }
.notif-stock_low { border-left-color: var(--warning); }
.notif-credit_due, .notif-supplier_due { border-left-color: var(--info); }
.notif-credit_overdue { border-left-color: var(--danger); }
.notif-title { font-weight: 600; font-size: 0.9rem; }
.notif-msg { font-size: 0.82rem; color: var(--text-muted); margin-top: 2px; }
.notif-time { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }
.notif-empty { padding: 30px; text-align: center; color: var(--text-muted); }

.page-content { padding: 24px; }

/* ============ CARDS & COMPONENTS ============ */
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--aqua-400), var(--accent));
}
.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.stat-value {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--aqua-800);
}
.stat-icon {
  position: absolute;
  right: 15px;
  top: 15px;
  font-size: 2rem;
  color: var(--aqua-200);
}
.stat-trend {
  font-size: 0.78rem;
  margin-top: 5px;
}
.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-header {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 14px 18px;
  font-weight: 600;
  color: var(--aqua-800);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.table {
  margin: 0;
  color: var(--text);
}
.table thead th {
  background: var(--aqua-50);
  color: var(--aqua-800);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--aqua-100);
  padding: 12px 15px;
}
.table tbody td { padding: 12px 15px; vertical-align: middle; }
.table-hover tbody tr:hover { background: var(--aqua-50); }

.badge-cat {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-poissons    { background: #dbeafe; color: #1e40af; }
.badge-aquariums   { background: #cffafe; color: #155e75; }
.badge-accessoires { background: #fef3c7; color: #92400e; }
.badge-nourriture  { background: #dcfce7; color: #166534; }

.status-badge {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}
.status-pending  { background: #fef3c7; color: #92400e; }
.status-partial  { background: #dbeafe; color: #1e40af; }
.status-paid     { background: #dcfce7; color: #166534; }
.status-overdue  { background: #fee2e2; color: #991b1b; }
.status-completed{ background: #dcfce7; color: #166534; }
.status-cancelled{ background: #f3f4f6; color: #6b7280; }
.status-received { background: #dcfce7; color: #166534; }

.btn-primary {
  background: linear-gradient(135deg, var(--aqua-500), var(--aqua-600));
  border-color: var(--aqua-600);
}
.btn-primary:hover, .btn-primary:focus {
  background: linear-gradient(135deg, var(--aqua-600), var(--aqua-700));
  border-color: var(--aqua-700);
}
.btn-aqua { background: var(--accent); color: white; border: none; }
.btn-aqua:hover { background: var(--accent-dark); color: white; }

.product-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.no-thumb {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background: var(--aqua-50);
  color: var(--aqua-300);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.stock-warn { color: var(--warning); font-weight: 600; }
.stock-out  { color: var(--danger); font-weight: 700; }

/* Filters bar */
.filter-bar {
  background: white;
  padding: 15px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}
.filter-bar .form-control, .filter-bar .form-select { max-width: 200px; }

/* Modal overrides */
.modal-header {
  background: linear-gradient(135deg, var(--aqua-600), var(--aqua-700));
  color: white;
}
.modal-header .btn-close { filter: invert(1); }

/* Cart */
.cart-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--aqua-50);
  border-radius: 6px;
  margin-bottom: 8px;
}
.cart-item .item-name { flex: 1; font-weight: 500; }
.cart-total {
  padding: 15px;
  background: var(--aqua-700);
  color: white;
  border-radius: 8px;
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
}

.product-picker {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.picker-item {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}
.picker-item:hover { background: var(--aqua-50); }
.picker-item:last-child { border-bottom: none; }
.picker-name { flex: 1; }
.picker-price { color: var(--aqua-700); font-weight: 600; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .btn-menu { display: block; }
  .cash-indicator { display: none; }
  .filter-bar .form-control, .filter-bar .form-select { max-width: 100%; }
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty-state .bi { font-size: 3rem; color: var(--aqua-200); }
.empty-state p { margin: 10px 0 0; }
