/* ============================================================
   Galamania — Design System
   ============================================================ */

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

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --c-primary: #1B6B4A;
  --c-primary-light: #2A8A60;
  --c-primary-dark: #0D3B2E;
  --c-primary-ultra: #E8F5EF;
  --c-secondary: #F5A623;
  --c-secondary-light: #FFB84D;
  --c-secondary-dark: #D4881A;
  --c-danger: #E53E3E;
  --c-danger-light: #FFF5F5;
  --c-success: #38A169;
  --c-success-light: #F0FFF4;
  --c-warning: #DD6B20;
  --c-warning-light: #FFFAF0;
  --c-info: #3182CE;
  --c-info-light: #EBF8FF;
  --c-escrow-hold: #7B2D8B;
  --c-escrow-ready: #2B6CB0;
  --c-escrow-done: #276749;

  --text-primary: #1A202C;
  --text-secondary: #4A5568;
  --text-muted: #718096;
  --text-inverse: #FFFFFF;

  --bg-base: #ECEEF0;
  --bg-white: #F5F6F7;
  --bg-dark: #0A1F17;
  --bg-dark-2: #0F2D20;
  --bg-glass: rgba(255,255,255,0.72);

  --border-color: #E2EBE7;
  --border-focus: var(--c-primary);

  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;
  --sp-12: 48px; --sp-16: 64px; --sp-20: 80px;

  --r-sm: 6px; --r-md: 12px; --r-lg: 16px;
  --r-xl: 24px; --r-2xl: 32px; --r-full: 9999px;

  --shadow-sm: 0 1px 4px rgba(0,0,0,0.07);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.16);
  --shadow-green: 0 4px 24px rgba(27,107,74,0.20);
  --shadow-gold: 0 4px 24px rgba(245,166,35,0.25);

  --t-fast: 150ms ease;
  --t-base: 250ms ease;
  --t-slow: 400ms ease;

  --nav-h: 64px;
  --max-w: 1280px;
  --sidebar-w: 340px;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }
ul { list-style: none; }

/* ── Typography ─────────────────────────────────────────────── */
h1,h2,h3,h4,h5,h6 { font-family: 'Poppins', sans-serif; line-height: 1.25; }
h1 { font-size: clamp(2rem, 4vw, 3rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); font-weight: 700; }
h3 { font-size: 1.25rem; font-weight: 700; }
h4 { font-size: 1.1rem; font-weight: 600; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.text-muted { color: var(--text-muted); }
.text-primary-c { color: var(--c-primary); }
.text-secondary-c { color: var(--c-secondary); }
.text-danger { color: var(--c-danger); }

/* ── Layout ─────────────────────────────────────────────────── */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 var(--sp-6); }
.container-sm { max-width: 800px; margin: 0 auto; padding: 0 var(--sp-6); }
.section { padding: var(--sp-16) 0; }
.section-sm { padding: var(--sp-10) 0; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: var(--sp-1); } .gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); } .gap-4 { gap: var(--sp-4); }
.gap-6 { gap: var(--sp-6); } .gap-8 { gap: var(--sp-8); }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }

.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); gap: var(--sp-6); }
.grid-3 { grid-template-columns: repeat(3, 1fr); gap: var(--sp-6); }
.grid-4 { grid-template-columns: repeat(4, 1fr); gap: var(--sp-5); }

.w-full { width: 100%; }
.h-full { height: 100%; }
.relative { position: relative; }
.absolute { position: absolute; }
.sticky { position: sticky; }
.overflow-hidden { overflow: hidden; }

/* ── Navbar ─────────────────────────────────────────────────── */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  height: var(--nav-h);
}
.navbar-inner {
  height: 100%;
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-6);
}
.logo {
  display: flex; align-items: center; gap: var(--sp-2);
  font-family: 'Poppins', sans-serif;
}
.logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--c-primary), var(--c-primary-light));
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.logo-text { font-size: 1.2rem; font-weight: 800; color: var(--c-primary-dark); }
.logo-text span { color: var(--c-secondary); }

.nav-links { display: flex; align-items: center; gap: var(--sp-1); }
.nav-link {
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-md);
  font-weight: 500; font-size: 0.9rem;
  color: var(--text-secondary);
  transition: all var(--t-fast);
}
.nav-link:hover { background: var(--c-primary-ultra); color: var(--c-primary); }
.nav-link.active { background: var(--c-primary-ultra); color: var(--c-primary); font-weight: 600; }

.nav-actions { display: flex; align-items: center; gap: var(--sp-3); }
.nav-avatar {
  width: 36px; height: 36px; border-radius: var(--r-full);
  background: linear-gradient(135deg, var(--c-primary), var(--c-secondary));
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 0.875rem;
  cursor: pointer; transition: transform var(--t-fast);
}
.nav-avatar:hover { transform: scale(1.05); }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--sp-2); padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-md); font-weight: 600; font-size: 0.9rem;
  transition: all var(--t-base); white-space: nowrap;
}
.btn-sm { padding: var(--sp-2) var(--sp-4); font-size: 0.8rem; border-radius: var(--r-sm); }
.btn-lg { padding: var(--sp-4) var(--sp-8); font-size: 1rem; }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: var(--r-md); }
.btn-icon-sm { width: 32px; height: 32px; padding: 0; border-radius: var(--r-sm); }

.btn-primary {
  background: linear-gradient(135deg, var(--c-primary), var(--c-primary-light));
  color: white; box-shadow: var(--shadow-green);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 32px rgba(27,107,74,0.30); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: linear-gradient(135deg, var(--c-secondary), var(--c-secondary-light));
  color: var(--c-primary-dark); box-shadow: var(--shadow-gold);
}
.btn-secondary:hover { transform: translateY(-1px); box-shadow: 0 6px 32px rgba(245,166,35,0.35); }

.btn-outline {
  border: 2px solid var(--c-primary); color: var(--c-primary);
  background: transparent;
}
.btn-outline:hover { background: var(--c-primary-ultra); }

.btn-ghost { color: var(--text-secondary); background: transparent; }
.btn-ghost:hover { background: var(--bg-base); color: var(--text-primary); }

.btn-danger { background: var(--c-danger); color: white; }
.btn-danger:hover { background: #C53030; }

.btn-full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--bg-white); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); border: 1px solid var(--border-color);
  overflow: hidden; transition: all var(--t-base);
}
.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card-body { padding: var(--sp-5); }
.card-header { padding: var(--sp-5); border-bottom: 1px solid var(--border-color); }
.card-footer { padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--border-color); background: var(--bg-base); }

/* ── Badges & Tags ───────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: var(--r-full);
  font-size: 0.72rem; font-weight: 600; white-space: nowrap;
}
.badge-verified { background: var(--c-success-light); color: var(--c-success); }
.badge-primary { background: var(--c-primary-ultra); color: var(--c-primary); }
.badge-secondary { background: #FFF8EC; color: var(--c-secondary-dark); }
.badge-danger { background: var(--c-danger-light); color: var(--c-danger); }
.badge-warning { background: var(--c-warning-light); color: var(--c-warning); }
.badge-info { background: var(--c-info-light); color: var(--c-info); }
.badge-gray { background: #F7FAFC; color: var(--text-muted); border: 1px solid var(--border-color); }

/* ── Forms ───────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: var(--sp-2); }
.form-label { font-size: 0.875rem; font-weight: 600; color: var(--text-secondary); }
.form-input {
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md);
  border: 1.5px solid var(--border-color);
  background: var(--bg-white); color: var(--text-primary);
  font-size: 0.9rem; transition: border-color var(--t-fast);
  outline: none;
}
.form-input:focus { border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(27,107,74,0.12); }
.form-input::placeholder { color: var(--text-muted); }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23718096' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
textarea.form-input { resize: vertical; min-height: 100px; }

/* ── Rating Stars ────────────────────────────────────────────── */
.stars { display: inline-flex; gap: 2px; }
.star { color: var(--c-secondary); font-size: 0.875rem; }
.star.empty { color: #D1D5DB; }

/* ── Chips / Filters ─────────────────────────────────────────── */
.chip-group { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.chip {
  padding: 6px 14px; border-radius: var(--r-full);
  border: 1.5px solid var(--border-color);
  font-size: 0.82rem; font-weight: 500;
  color: var(--text-secondary); background: var(--bg-white);
  cursor: pointer; transition: all var(--t-fast); white-space: nowrap;
}
.chip:hover { border-color: var(--c-primary); color: var(--c-primary); background: var(--c-primary-ultra); }
.chip.active { border-color: var(--c-primary); color: white; background: var(--c-primary); }
.chip-icon { font-size: 1rem; }

/* ── Divider ─────────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border-color); margin: var(--sp-5) 0; }

/* ── Progress / Steps ────────────────────────────────────────── */
.steps { display: flex; align-items: center; gap: 0; }
.step-item { display: flex; align-items: center; gap: var(--sp-2); flex: 1; }
.step-item:last-child .step-line { display: none; }
.step-circle {
  width: 32px; height: 32px; border-radius: var(--r-full);
  border: 2px solid var(--border-color);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700; color: var(--text-muted);
  background: var(--bg-white); flex-shrink: 0; transition: all var(--t-base);
}
.step-item.active .step-circle { border-color: var(--c-primary); background: var(--c-primary); color: white; }
.step-item.done .step-circle { border-color: var(--c-success); background: var(--c-success); color: white; }
.step-label { font-size: 0.78rem; font-weight: 500; color: var(--text-muted); }
.step-item.active .step-label { color: var(--c-primary); font-weight: 600; }
.step-line { flex: 1; height: 2px; background: var(--border-color); margin: 0 var(--sp-2); }
.step-item.done .step-line { background: var(--c-success); }

/* ── Escrow Status ───────────────────────────────────────────── */
.escrow-bar {
  display: flex; border-radius: var(--r-md); overflow: hidden;
  border: 1px solid var(--border-color);
}
.escrow-segment {
  flex: 1; padding: var(--sp-3) var(--sp-4); text-align: center;
  font-size: 0.78rem; font-weight: 600; transition: all var(--t-base);
}
.escrow-hold { background: #F3E8FF; color: var(--c-escrow-hold); }
.escrow-ready { background: #EBF8FF; color: var(--c-escrow-ready); }
.escrow-done { background: var(--c-success-light); color: var(--c-escrow-done); }
.escrow-active { opacity: 1; font-weight: 700; }
.escrow-inactive { opacity: 0.4; }

/* ── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-6); opacity: 0; pointer-events: none;
  transition: opacity var(--t-base);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-white); border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl); max-width: 480px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  transform: scale(0.95) translateY(10px);
  transition: transform var(--t-base);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-header { padding: var(--sp-5) var(--sp-6); border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; }
.modal-body { padding: var(--sp-6); }
.modal-footer { padding: var(--sp-4) var(--sp-6); border-top: 1px solid var(--border-color); display: flex; gap: var(--sp-3); justify-content: flex-end; }

/* ── Toast ───────────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: var(--sp-3); }
.toast {
  background: var(--bg-dark); color: white; padding: var(--sp-4) var(--sp-5);
  border-radius: var(--r-lg); box-shadow: var(--shadow-xl);
  display: flex; align-items: center; gap: var(--sp-3);
  font-size: 0.875rem; font-weight: 500; max-width: 360px;
  animation: slideInRight 0.3s ease, fadeOut 0.3s ease 3s forwards;
}
.toast.success { background: var(--c-success); }
.toast.danger { background: var(--c-danger); }
.toast.warning { background: var(--c-warning); }
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; transform: translateX(100%); } }

/* ── Skeleton Loading ────────────────────────────────────────── */
.skeleton { background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: var(--r-sm); }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── QR Code Display ─────────────────────────────────────────── */
.qr-wrapper {
  display: flex; flex-direction: column; align-items: center;
  gap: var(--sp-4); padding: var(--sp-6);
  background: white; border-radius: var(--r-lg);
  border: 2px dashed var(--border-color);
}
.qr-code {
  width: 160px; height: 160px;
  background: repeating-linear-gradient(0deg, #000 0px, #000 8px, #fff 8px, #fff 16px),
              repeating-linear-gradient(90deg, #000 0px, #000 8px, #fff 8px, #fff 16px);
  background-blend-mode: xor; border-radius: var(--r-sm);
  image-rendering: pixelated; position: relative;
  border: 4px solid var(--c-primary-dark);
}
.qr-code::after {
  content: "🐟"; position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  font-size: 28px; background: white; border-radius: 50%;
  width: 48px; height: 48px; display: flex; align-items: center; justify-content: center;
}

/* ── Map ─────────────────────────────────────────────────────── */
#map, .map-container {
  width: 100%; height: 100%; min-height: 400px;
  border-radius: var(--r-lg); overflow: hidden;
}
.leaflet-container { font-family: 'Inter', sans-serif !important; }

/* ── Utilities ───────────────────────────────────────────────── */
.mt-2 { margin-top: var(--sp-2); } .mt-4 { margin-top: var(--sp-4); } .mt-6 { margin-top: var(--sp-6); }
.mb-2 { margin-bottom: var(--sp-2); } .mb-4 { margin-bottom: var(--sp-4); } .mb-6 { margin-bottom: var(--sp-6); }
.p-4 { padding: var(--sp-4); } .p-5 { padding: var(--sp-5); } .p-6 { padding: var(--sp-6); }
.px-4 { padding-left: var(--sp-4); padding-right: var(--sp-4); }
.py-3 { padding-top: var(--sp-3); padding-bottom: var(--sp-3); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.hidden { display: none !important; }
.show { display: flex !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Animations ──────────────────────────────────────────────── */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.03); } }
@keyframes spin { to { transform: rotate(360deg); } }
.animate-fade-in-up { animation: fadeInUp 0.4s ease both; }
.animate-pulse { animation: pulse 2s infinite; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .hide-mobile { display: none !important; }
  .container { padding: 0 var(--sp-4); }
  .section { padding: var(--sp-10) 0; }
}
@media (max-width: 480px) {
  .grid-4 { grid-template-columns: 1fr; }
}
@media (min-width: 769px) {
  .hide-desktop { display: none !important; }
}

/* ── Phosphor Icons ──────────────────────────────────────────── */
/* Base sizing — inherits parent font-size by default */
[class^="ph-"]:before,
[class*=" ph-"]:before {
  display: inline-block;
  vertical-align: middle;
  line-height: 1;
}

/* Context-aware sizing */
.bn-item-icon .ph, .bn-item-icon [class^="ph-"] { font-size: 1.5rem; }
.nav-link .ph, .nav-link [class^="ph-"] { font-size: 1.1rem; margin-right: 4px; }
.dash-tab-icon .ph, .dash-tab-icon [class^="ph-"] { font-size: 1.25rem; }
.notif-icon .ph, .notif-icon [class^="ph-"] { font-size: 1.4rem; }
.txn-icon .ph, .txn-icon [class^="ph-"] { font-size: 1.3rem; }
.pgw-item-icon .ph, .pgw-item-icon [class^="ph-"] { font-size: 1.5rem; }
.quick-cat-icon .ph, .quick-cat-icon [class^="ph-"] { font-size: 1.6rem; display:block; }
.kolam-fav .ph, .kolam-fav [class^="ph-"] { font-size: 1.1rem; }
.order-chip .ph, .order-chip [class^="ph-"] { font-size: 0.85rem; margin-right: 2px; }

/* Page title icons */
.page-title .ph, .page-title [class^="ph-"] { font-size: 1.2rem; margin-right: 6px; vertical-align: middle; }

/* Section header icons */
.sec-head-title .ph, .sec-head-title [class^="ph-"] { font-size: 1rem; margin-right: 4px; vertical-align: middle; }

/* Logo icon override */
.logo-icon { display:flex; align-items:center; justify-content:center; }
.logo-icon .ph, .logo-icon [class^="ph-"] { font-size: 1.6rem; color: white; }

/* Sidebar icons in listing/detail forms */
.sidebar-title .ph, .sidebar-title [class^="ph-"] { font-size: 1rem; margin-right: 4px; }

/* Inline text icons */
.kolam-card-loc .ph, .kolam-card-loc [class^="ph-"] { font-size: 0.8rem; }
.fish-tag .ph, .fish-tag [class^="ph-"] { font-size: 0.78rem; }
.event-card-date .ph, .event-card-date [class^="ph-"] { font-size: 0.82rem; margin-right: 2px; }

/* KYC icons in profile */
.kyc-icon { font-size: 1.5rem; display:flex; align-items:center; justify-content:center; }
.kyc-icon .ph, .kyc-icon [class^="ph-"] { font-size: 1.5rem; }

/* Fix: icon in buttons */
button .ph, button [class^="ph-"] { vertical-align: middle; }
a .ph, a [class^="ph-"] { vertical-align: middle; }
