/* Mebelchi Usta OS — Industrial Cobalt & Steel Design System */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root, [data-theme="cobalt"] {
  --brand-primary: #2563EB;
  --brand-hover: #1D4ED8;
  --brand-active: #1E40AF;
  --brand-light: #EFF6FF;
  --brand-light-border: #BFDBFE;
  --brand-text: #1E40AF;
  --brand-ring: rgba(37, 99, 235, 0.20);
  --bg-canvas: #F8FAFC;
  --surface-white: #FFFFFF;
  --border-subtle: #E2E8F0;
  --header-grad-from: #2563EB;
  --header-grad-to: #1E40AF;
}

[data-theme="nordic"] {
  --brand-primary: #B45309;
  --brand-hover: #92400E;
  --brand-active: #78350F;
  --brand-light: #FDF8F3;
  --brand-light-border: #FDE68A;
  --brand-text: #78350F;
  --brand-ring: rgba(180, 83, 9, 0.20);
  --bg-canvas: #F8FAFC;
  --surface-white: #FFFFFF;
  --border-subtle: #E2E8F0;
  --header-grad-from: #D97706;
  --header-grad-to: #92400E;
}

[data-theme="emerald"] {
  --brand-primary: #059669;
  --brand-hover: #047857;
  --brand-active: #065F46;
  --brand-light: #ECFDF5;
  --brand-light-border: #A7F3D0;
  --brand-text: #065F46;
  --brand-ring: rgba(5, 150, 105, 0.20);
  --bg-canvas: #F8FAFC;
  --surface-white: #FFFFFF;
  --border-subtle: #E2E8F0;
  --header-grad-from: #059669;
  --header-grad-to: #047857;
}

* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html {
  height: 100%;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-canvas);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  color: #0F172A;
  touch-action: manipulation;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
}

main.main-viewport {
  flex: 1 1 0%;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

.font-mono-num {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-feature-settings: "tnum" 1;
  font-variant-numeric: tabular-nums;
}

/* Card Styling */
.card-elevation {
  background: var(--surface-white);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 1px 3px 0 rgba(15, 23, 42, 0.04), 0 1px 2px -1px rgba(15, 23, 42, 0.03);
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.card-elevation:hover {
  border-color: var(--brand-light-border);
  box-shadow: 0 4px 14px -2px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
}

/* Glassmorphism Navigation */
.glass-nav {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-subtle);
}

.glass-modal {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Primary Button */
.btn-primary {
  background-color: var(--brand-primary);
  color: #FFFFFF;
  transition: all 0.15s ease;
}

.btn-primary:hover {
  background-color: var(--brand-hover);
}

.btn-primary:active {
  background-color: var(--brand-active);
  transform: scale(0.98);
}

/* Brand badge / tint */
.badge-brand {
  background-color: var(--brand-light);
  color: var(--brand-text);
  border: 1px solid var(--brand-light-border);
}

/* Inputs & Form Elements */
input, select, textarea {
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Remove ugly default spinner arrows from number inputs */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}

/* Precise Cross-Platform Date Input Styling */
input[type="date"] {
  min-height: 38px;
  height: 38px;
  line-height: normal;
  -webkit-appearance: none;
  appearance: none;
  color: #0F172A;
  box-sizing: border-box;
}

input[type="date"]::-webkit-date-and-time-value {
  text-align: left;
  line-height: normal;
  margin: 0;
}

/* Ensure select elements don't force parent flex containers to overflow */
select {
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand-primary) !important;
  box-shadow: 0 0 0 3px var(--brand-ring) !important;
}

/* Safe areas & Scroll clearance */
.pb-safe {
  padding-bottom: calc(env(safe-area-inset-bottom, 16px) + 72px) !important;
}
.pt-safe {
  padding-top: env(safe-area-inset-top, 16px);
}

/* Precise iOS Floating Dock Position */
.ios-dock-position {
  bottom: calc(env(safe-area-inset-bottom, 16px) + 10px) !important;
}

/* Futuristic iOS 27 Liquid Glass Island Dock */
.ios-floating-island {
  position: relative;
  background: rgba(255, 255, 255, 0.68);
  backdrop-filter: blur(40px) saturate(240%) contrast(106%);
  -webkit-backdrop-filter: blur(40px) saturate(240%) contrast(106%);
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: 
    0 24px 50px -10px rgba(15, 23, 42, 0.22),
    0 10px 24px -4px rgba(37, 99, 235, 0.12),
    0 0 0 1px rgba(226, 232, 240, 0.6),
    inset 0 1.5px 2px 0 rgba(255, 255, 255, 1),
    inset 0 -1.5px 2px 0 rgba(0, 0, 0, 0.04),
    inset 0 0 20px 0 rgba(255, 255, 255, 0.35);
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

/* Liquid Gloss Lens Reflection Streak */
.ios-floating-island::before {
  content: '';
  position: absolute;
  top: 0;
  left: 5%;
  right: 5%;
  height: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.75) 0%, rgba(255, 255, 255, 0.12) 60%, transparent 100%);
  border-radius: 9999px 9999px 36px 36px;
  pointer-events: none;
  z-index: 0;
}

.ios-nav-item {
  position: relative;
  z-index: 1;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  color: #64748B;
  cursor: pointer;
  user-select: none;
}

/* Elastic Liquid Touch Physics */
.ios-nav-item:active {
  transform: scale(0.90) translateY(1px) !important;
  transition: transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Active State: Illuminated Liquid Droplet Pill */
.ios-nav-item.active {
  background: linear-gradient(135deg, var(--brand-primary, #2563EB) 0%, #1D4ED8 100%);
  color: #FFFFFF !important;
  box-shadow: 
    0 6px 18px -2px rgba(37, 99, 235, 0.48),
    0 2px 6px 0 rgba(0, 0, 0, 0.08),
    inset 0 1px 1.5px 0 rgba(255, 255, 255, 0.7),
    inset 0 -1px 1px 0 rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
}

.ios-nav-item:not(.active):hover {
  background: rgba(255, 255, 255, 0.45);
  color: #0F172A;
}

/* Dynamic theme adjustments for liquid glass active pill */
[data-theme="nordic"] .ios-nav-item.active {
  background: linear-gradient(135deg, #D97706 0%, #B45309 100%);
  box-shadow: 0 6px 18px -2px rgba(180, 83, 9, 0.48), inset 0 1px 1.5px 0 rgba(255, 255, 255, 0.7);
}

[data-theme="emerald"] .ios-nav-item.active {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 6px 18px -2px rgba(5, 150, 105, 0.48), inset 0 1px 1.5px 0 rgba(255, 255, 255, 0.7);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 9999px;
}
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Micro Animations */
@keyframes slideUpModal {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.animate-slide-up {
  animation: slideUpModal 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeInFast {
  from { opacity: 0; }
  to { opacity: 1; }
}

.animate-fade-in {
  animation: fadeInFast 0.16s ease-out forwards;
}

/* Active Bottom Nav Button */
.nav-tab-btn.active {
  color: var(--brand-primary);
}
.nav-tab-btn.active .nav-icon-container {
  background-color: var(--brand-light);
  color: var(--brand-primary);
}
.nav-tab-btn:not(.active) {
  color: #64748B;
}
.nav-tab-btn:not(.active) .nav-icon-container {
  background-color: transparent;
  color: #64748B;
}
