/* SalonOS Design System & Global Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Outfit:wght@400;500;600;700;800&family=Playfair+Display:wght@500;600;700;800&display=swap');

:root {
  /* Color Palette */
  --bg-base: #F4F0EB;
  --bg-card: rgba(252, 251, 249, 0.9);
  --bg-card-solid: #FFFFFF;
  --bg-elevated: #FAF8F5;
  --border-color: rgba(0, 0, 0, 0.08);
  --border-color-solid: #E2DDD5;
  
  --primary: #B88A60;
  --primary-glow: rgba(184, 138, 96, 0.2);
  --primary-hover: #9C724C;
  
  --success: #10B981;
  --success-glow: rgba(16, 185, 129, 0.2);
  
  --warning: #F59E0B;
  --warning-glow: rgba(245, 158, 11, 0.2);
  
  --danger: #F43F5E;
  --danger-glow: rgba(244, 63, 94, 0.2);
  
  --info: #3B82F6;
  --info-glow: rgba(59, 130, 246, 0.2);

  --offline: #6B7280;
  --offline-glow: rgba(107, 114, 128, 0.2);
  
  /* Typography Text Colors */
  --text-primary: #2C2A28;
  --text-secondary: #6B675E;
  --text-muted: #A39E93;
  
  /* Structural Tokens */
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 80px;
  --header-height: 70px;
  --border-radius-sm: 8px;
  --border-radius-md: 12px;
  --border-radius-lg: 16px;
  --border-radius-xl: 24px;
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-heading: 'Outfit', 'Inter', system-ui, sans-serif;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --glass-effect: backdrop-filter: blur(40px) saturate(200%);
}

/* Base Resets */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  background-image:
    radial-gradient(circle at 15% 50%, rgba(184, 138, 96, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 85% 30%, rgba(184, 138, 96, 0.04) 0%, transparent 50%),
    radial-gradient(circle at 50% 80%, rgba(184, 138, 96, 0.05) 0%, transparent 50%);
  background-attachment: fixed;
}

/* Layout Shell */
#app-shell {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* Sidebar Styling */
#sidebar {
  width: var(--sidebar-width);
  background: #1A1A1A;
  border-right: 1px solid var(--border-color);
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  z-index: 100;
  transition: var(--transition-smooth);
}

.sidebar-brand {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
  background: linear-gradient(to bottom, #EAD1A3 0%, #C5A87C 40%, #A58359 60%, #EAD1A3 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  filter: drop-shadow(0px 2px 4px rgba(0,0,0,0.4));
}

.sidebar-logo i {
  color: var(--primary);
  -webkit-text-fill-color: initial;
}

.sidebar-menu {
  list-style: none;
  padding: 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  overflow-y: auto;
}

.sidebar-item a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  color: #9999B3;
  text-decoration: none;
  border-radius: var(--border-radius-md);
  font-weight: 500;
  font-size: 0.95rem;
  transition: var(--transition-smooth);
}

.sidebar-item a:hover {
  color: #F5E6C4;
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-item.active a {
  color: #F5E6C4;
  background: linear-gradient(90deg, rgba(184, 138, 96, 0.15) 0%, rgba(184, 138, 96, 0.03) 100%);
  border-left: 3px solid var(--primary);
  padding-left: 13px; /* Adjust for border width to prevent layout shift */
}

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.offline-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 50px;
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
  width: fit-content;
}

.offline-badge.offline {
  background: rgba(107, 114, 128, 0.1);
  color: var(--offline);
  border-color: rgba(107, 114, 128, 0.2);
}

/* Main Layout */
#main-container {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: var(--transition-smooth);
}

#header {
  height: var(--header-height);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: rgba(244, 240, 235, 0.8);
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  position: sticky;
  top: 0;
  z-index: 90;
}

.header-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
}

.header-salon-name {
  font-size: 0.9rem;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.03);
  padding: 6px 16px;
  border-radius: 50px;
  border: 1px solid var(--border-color);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

#app-viewport {
  padding: 32px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Banner Styling */
.banner {
  background: linear-gradient(135deg, rgba(184, 138, 96, 0.15) 0%, rgba(184, 138, 96, 0.05) 100%);
  border: 1px solid rgba(184, 138, 96, 0.2);
  padding: 20px 24px;
  border-radius: var(--border-radius-lg);
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.banner-content h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  margin-bottom: 6px;
  color: var(--text-primary);
  font-weight: 600;
}

.banner-content p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.banner-actions {
  display: flex;
  gap: 12px;
}

/* Base Component Styling */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  color: var(--text-primary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--border-radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  font-family: var(--font-sans);
  transition: var(--transition-smooth);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(0, 0, 0, 0.03);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.15);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.1);
  color: var(--danger);
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.btn-danger:hover {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 4px 14px var(--danger-glow);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--border-radius-sm);
}

/* Glassmorphism Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
  transition: var(--transition-smooth);
}

.card:hover {
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

/* Form Controls */
.form-group {
  margin-bottom: 20px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  background: #FFFFFF;
  border: 1px solid var(--border-color-solid);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: var(--border-radius-md);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  transition: var(--transition-smooth);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  background: #FFFFFF;
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-control::placeholder {
  color: var(--text-muted);
}

/* Checkbox and Toggle Switches */
.switch-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
}

.switch-label-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: none;
  letter-spacing: normal;
  margin-top: 4px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border-color-solid);
  transition: .4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 4px;
  bottom: 4px;
  background-color: var(--text-primary);
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary);
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--primary);
}

input:checked + .slider:before {
  transform: translateX(24px);
}

/* Wizard / Setup Multi-Step Layout */
.wizard-container {
  max-width: 700px;
  margin: 40px auto;
}

.wizard-steps {
  display: flex;
  justify-content: space-between;
  margin-bottom: 40px;
  position: relative;
}

.wizard-steps::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border-color-solid);
  transform: translateY(-50%);
  z-index: 1;
}

.wizard-step {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-base);
  border: 2px solid var(--border-color-solid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-secondary);
  position: relative;
  z-index: 2;
  transition: var(--transition-smooth);
}

.wizard-step.active {
  border-color: var(--primary);
  color: var(--text-primary);
  box-shadow: 0 0 15px var(--primary-glow);
  background: var(--primary);
}

.wizard-step.completed {
  border-color: var(--success);
  background: var(--success);
  color: white;
}

.wizard-panel {
  display: none;
}

.wizard-panel.active {
  display: block;
  animation: fadeIn 0.4s ease-out;
}

.wizard-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 32px;
  border-top: 1px solid var(--border-color);
  padding-top: 24px;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Grid Components */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.grid-1-3 {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px;
}

/* Settings Panels Navigation */
.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-nav-btn {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 12px 16px;
  text-align: left;
  border-radius: var(--border-radius-md);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.settings-nav-btn:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
}

.settings-nav-btn.active {
  background: rgba(124, 58, 237, 0.1);
  color: var(--primary-hover);
  border-left: 3px solid var(--primary);
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.settings-panel {
  display: none;
}

.settings-panel.active {
  display: block;
  animation: fadeIn 0.3s ease-out;
}

/* Inline items config manager (for stations list, services, staff) */
.item-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.item-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 500;
}

.item-chip button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-smooth);
}

.item-chip button:hover {
  color: var(--danger);
}

/* Alert notifications banner */
.alert {
  padding: 14px 18px;
  border-radius: var(--border-radius-md);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  font-weight: 500;
}

.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: var(--warning);
}

.alert-success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: var(--success);
}

/* Station Board Cards */
.station-card {
  transition: var(--transition-smooth);
}

.station-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

/* Payment Method Button Active State */
.payment-method-btn.active {
  background: rgba(124, 58, 237, 0.15) !important;
  border-color: var(--primary) !important;
  color: var(--primary-hover) !important;
  box-shadow: 0 0 10px var(--primary-glow);
}

/* KPI Card Animations */
.kpi-card {
  transition: var(--transition-smooth);
}

.kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

/* Animated spinner */
.animate-spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Pulsing dot for live indicators */
.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

/* Responsive Scaling */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: var(--sidebar-collapsed-width);
  }
  
  .sidebar-logo span,
  .sidebar-item a span,
  .offline-badge span {
    display: none;
  }
  
  .sidebar-logo {
    justify-content: center;
    padding: 0;
  }
  
  .sidebar-logo i {
    font-size: 1.75rem;
  }
  
  .sidebar-item a {
    justify-content: center;
    padding: 16px;
  }
  
  .sidebar-item a i {
    font-size: 1.25rem;
  }
  
  .sidebar-footer {
    padding: 16px;
    align-items: center;
  }
  
  .offline-badge {
    padding: 8px;
  }
  
  #main-container {
    margin-left: var(--sidebar-collapsed-width);
  }
}

@media (max-width: 768px) {
  body {
    flex-direction: column;
  }
  
  #sidebar {
    width: 100%;
    height: var(--header-height);
    flex-direction: row;
    position: sticky;
    top: 0;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  
  .sidebar-brand {
    border-bottom: none;
  }
  
  .sidebar-menu {
    flex-direction: row;
    padding: 0 16px;
    align-items: center;
    gap: 8px;
  }
  
  .sidebar-item a {
    padding: 8px;
  }
  
  .sidebar-footer {
    display: none;
  }
  
  #main-container {
    margin-left: 0;
  }
  
  #header {
    display: none; /* Combine header details in viewport or navigation */
  }
  
  #app-viewport {
    padding: 16px;
  }
  
  .grid-2, .grid-3, .grid-1-3 {
    grid-template-columns: 1fr;
  }
}

/* Print Styles — Invoice & Billing */
@media print {
  #sidebar,
  #header,
  #welcome-banner-container,
  #invoice-history-panel,
  .no-print {
    display: none !important;
  }

  body {
    background: white;
    background-image: none;
    font-size: 13px;
  }

  #main-container {
    margin-left: 0;
  }

  #app-viewport {
    padding: 0;
    display: block;
  }

  .grid-1-3 {
    display: block;
  }

  #invoice-viewer-card {
    box-shadow: none;
    border: none;
    background: white;
    padding: 0;
    min-height: unset;
  }
}
