@import url('https://fonts.googleapis.com/css2?family=Anuphan:wght@100;200;300;400;500;600;700&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
  /* Light theme (Default - Clean & Hygienic) */
  --bg-primary: #f0f4f8; /* Soft blue-gray */
  --bg-surface: rgba(255, 255, 255, 0.82);
  --bg-surface-solid: #ffffff;
  --bg-surface-hover: rgba(241, 245, 249, 0.95);
  --border-color: rgba(14, 165, 233, 0.1);
  --border-color-hover: rgba(14, 165, 233, 0.2);
  --text-primary: #0f172a; /* Slate 900 */
  --text-secondary: #475569; /* Slate 600 */
  --text-muted: #94a3b8; /* Slate 400 */
  
  --accent-primary: #0284c7; /* Azure */
  --accent-primary-rgb: 2, 132, 199;
  --accent-success: #059669; /* Clean Emerald */
  --accent-success-rgb: 5, 150, 105;
  --accent-warning: #ea580c; /* Orange */
  --accent-danger: #dc2626; /* Red */
  
  --glass-bg: rgba(255, 255, 255, 0.8);
  --glass-border: rgba(14, 165, 233, 0.08);
  --shadow: 0 8px 32px 0 rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 40px 4px rgba(15, 23, 42, 0.06);
  
  --font-sans: 'Plus Jakarta Sans', 'Anuphan', sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

[data-theme="dark"] {
  /* Dark theme (Secondary) */
  --bg-primary: #0a0e1a;
  --bg-surface: rgba(17, 24, 39, 0.75);
  --bg-surface-solid: #111827;
  --bg-surface-hover: rgba(31, 41, 55, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-hover: rgba(255, 255, 255, 0.16);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  --accent-primary: #0ea5e9;
  --accent-primary-rgb: 14, 165, 233;
  --accent-success: #10b981;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;
  
  --glass-bg: rgba(15, 23, 42, 0.65);
  --glass-border: rgba(255, 255, 255, 0.08);
  --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 40px 4px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  outline-color: var(--accent-primary);
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
  padding-bottom: calc(75px + var(--safe-bottom)); /* Leave space for bottom nav bar */
}

/* App container */
.container {
  width: 100%;
  max-width: 540px; /* Centered mobile container look */
  margin: 0 auto;
  padding: 20px 16px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

/* Glassmorphism utility */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.glass-panel:hover {
  border-color: var(--border-color-hover);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.title-display {
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 4px;
}

.subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 400;
}

/* Navbar / Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 4px 0;
}

.theme-toggle-btn {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.theme-toggle-btn:hover {
  transform: scale(1.05);
  border-color: var(--accent-primary);
}

/* Sticky Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 540px;
  height: calc(65px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--glass-border);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 1000;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

[data-theme="dark"] .bottom-nav {
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  gap: 4px;
  width: 25%;
  height: 100%;
  justify-content: center;
  transition: var(--transition-fast);
}

.nav-item svg {
  width: 22px;
  height: 22px;
  stroke-width: 2;
  transition: var(--transition-fast);
}

.nav-item:hover, .nav-item.active {
  color: var(--accent-primary);
}

.nav-item.active svg {
  transform: translateY(-2px);
  stroke: var(--accent-primary);
}

.nav-item.add-btn-special {
  position: relative;
}

.nav-item.add-btn-special .btn-inner {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-success) 100%);
  color: white;
  width: 54px;
  height: 54px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(14, 165, 233, 0.3);
  transition: var(--transition);
  border: 4px solid var(--bg-primary);
}

.nav-item.add-btn-special:hover .btn-inner {
  transform: translateX(-50%) translateY(-4px) scale(1.05);
  box-shadow: 0 8px 20px rgba(14, 165, 233, 0.4);
}

/* Action button styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  padding: 12px 20px;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary) 0%, #0284c7 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.2);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(2, 132, 199, 0.3);
  opacity: 0.95;
}

.btn-success {
  background: linear-gradient(135deg, var(--accent-success) 0%, #059669 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.2);
}

.btn-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(5, 150, 105, 0.3);
}

.btn-secondary {
  background: var(--bg-surface-solid);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-color-hover);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-full);
}

/* Badge styles */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge-primary {
  background: rgba(2, 132, 199, 0.08);
  color: #0284c7;
  border: 1px solid rgba(2, 132, 199, 0.15);
}

[data-theme="dark"] .badge-primary {
  background: rgba(14, 165, 233, 0.15);
  color: #38bdf8;
  border-color: rgba(14, 165, 233, 0.2);
}

.badge-success {
  background: rgba(5, 150, 105, 0.08);
  color: #059669;
  border: 1px solid rgba(5, 150, 105, 0.15);
}

[data-theme="dark"] .badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.2);
}

.badge-warning {
  background: rgba(217, 119, 6, 0.08);
  color: #d97706;
  border: 1px solid rgba(217, 119, 6, 0.15);
}

[data-theme="dark"] .badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.2);
}

/* Toilet card elements */
.toilet-card {
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.toilet-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.toilet-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.toilet-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}

.rating-display {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--accent-warning);
  font-weight: 700;
}

.rating-display svg {
  fill: currentColor;
  width: 14px;
  height: 14px;
}

.toilet-card-facilities {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.facility-icon-badge {
  background: var(--bg-surface-solid);
  border: 1px solid var(--border-color);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 12px;
}

.facility-icon-badge.active {
  color: var(--accent-primary);
  border-color: rgba(14, 165, 233, 0.3);
  background: rgba(14, 165, 233, 0.05);
}

/* Animations */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.8;
  }
}

.pulse {
  animation: pulse 2s infinite ease-in-out;
}

/* Modal styling */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.3);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
  padding: 16px;
}

[data-theme="dark"] .modal-overlay {
  background: rgba(0, 0, 0, 0.6);
}

.modal-container {
  width: 100%;
  max-width: 420px;
  padding: 24px;
  transform: translateY(20px);
  transition: var(--transition);
}

.modal-overlay.open .modal-container {
  transform: translateY(0);
}

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

/* Utilities */
.flex-row-center {
  display: flex;
  align-items: center;
  gap: 8px;
}

.text-success {
  color: var(--accent-success);
}

.text-warning {
  color: var(--accent-warning);
}

.text-danger {
  color: var(--accent-danger);
}

.mt-auto {
  margin-top: auto;
}

.hide {
  display: none !important;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
