/* Booking Management CMS */

/* Fonts  */
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=Outfit:wght@400;500;600;700;800&display=swap');

/* Design Tokens */
:root {
  --color-primary: #F5C518;
  --color-primary-hover: #FFD740;
  --color-primary-dark: #C69F10;

  --color-bg-base: #0D1117;
  --color-bg-card: #161B22;
  --color-bg-elevated: #21262D;
  --color-bg-accent: #1F242C;

  --color-border-base: #30363D;
  --color-border-hover: #484F58;
  --color-border-active: rgba(245, 197, 24, 0.35);

  --color-text-primary: #F0F6FC;
  --color-text-secondary: #8B949E;
  --color-text-muted: #57606A;

  --color-success: #3FB950;
  --color-success-bg: rgba(63, 185, 80, 0.1);
  --color-warning: #D29922;
  --color-warning-bg: rgba(210, 153, 34, 0.1);
  --color-danger: #F85149;
  --color-danger-bg: rgba(248, 81, 73, 0.1);
  --color-blue: #58A6FF;
  --color-blue-bg: rgba(88, 166, 255, 0.1);

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Outfit', system-ui, -apple-system, sans-serif;

  --sidebar-w: 248px;
  --topbar-h: 62px;
  --radius: 0.625rem;
  --radius-lg: 0.75rem;

  /* Aliases used by some inline styles */
  --gold: var(--color-primary);
  --bg: var(--color-bg-base);
  --bg-card: var(--color-bg-card);
  --bg-elevated: var(--color-bg-elevated);
  --border: var(--color-border-base);
  --border-hover: var(--color-border-hover);
  --text: var(--color-text-primary);
  --text-2: var(--color-text-secondary);
  --text-3: var(--color-text-muted);
  --green: var(--color-success);
  --green-bg: var(--color-success-bg);
  --amber: var(--color-warning);
  --amber-bg: var(--color-warning-bg);
  --red: var(--color-danger);
  --red-bg: var(--color-danger-bg);
  --blue: var(--color-blue);
  --blue-bg: var(--color-blue-bg);
}

/* Light Theme - applied when <html data-theme="light"> */
[data-theme="light"] {
  /* Gold is darkened here because the brand yellow is unreadable as text on white.
     Bright gold is kept for solid gold fills (buttons/logo) further down. */
  /* --color-primary: #8A6D00;
  --color-primary-hover: #6F5700;
  --color-primary-dark: #5A4700; */
  --color-primary: #F5C518;
  --color-primary-hover: #FFD740;
  --color-primary-dark: #C69F10;
  /* --color-bg-base: #FAFBFC; */
  --color-bg-base: #FFFFFF;
  --color-bg-card: #FFFFFF;
  --color-bg-elevated: #EFF2F5;
  --color-bg-accent: #E9EDF1;

  --color-border-base: #D8DEE4;
  --color-border-hover: #BAC2CC;
  --color-border-active: rgba(138, 109, 0, 0.4);

  --color-text-primary: #1F2328;
  --color-text-secondary: #59636E;
  --color-text-muted: #8C959F;

  --color-success: #1A7F37;
  --color-success-bg: #DAFBE1;
  --color-warning: #9A6700;
  --color-warning-bg: #FFF8C5;
  --color-danger: #CF222E;
  --color-danger-bg: #FFEBE9;
  --color-blue: #0969DA;
  --color-blue-bg: #DDF4FF;


  --color-primary-bg: #FFF6C2;
}

/* Solid gold fills keep the bright brand yellow (they carry black text). */
[data-theme="light"] .sidebar-logo-icon,
[data-theme="light"] .login-logo-icon {
  background: #F5C518;
}

/* Native form chrome (date picker icon, number spinners) must follow the theme. */
[data-theme="light"] input[type="date"].form-control,
[data-theme="light"] input[type="time"].form-control,
[data-theme="light"] input[type="number"].form-control,
[data-theme="light"] input[type="datetime-local"].form-control {
  color-scheme: light;
}

/* Softer shadows and overlays read better on a light canvas. */
[data-theme="light"] .card.hover-effect:hover {
  box-shadow: 0 10px 20px -5px rgba(31, 35, 40, 0.12);
}

[data-theme="light"] .modal-overlay {
  background: rgba(31, 35, 40, 0.45);
}

[data-theme="light"] .modal-box {
  box-shadow: 0 25px 50px -12px rgba(31, 35, 40, 0.25);
}

[data-theme="light"] .media-preview-wrapper {
  background: var(--color-bg-accent);
}

/* Several panels use a dark-navy rgba() overlay tuned for the dark theme
   (a subtle darkening against a near-black card). On white that reads as a
   flat, heavy gray bar instead of a subtle tint, which is what made the
   light theme look dull. Swap them for a light neutral tint instead. */
[data-theme="light"] table.data-table th {
  background: var(--color-bg-accent);
}

[data-theme="light"] table.data-table tr:hover td {
  background: rgba(138, 109, 0, 0.06);
}

[data-theme="light"] .section-header,
[data-theme="light"] .section-services-list,
[data-theme="light"] .upload-dropzone {
  background: var(--color-bg-accent);
}

/* Give each dashboard stat icon a colored tint chip instead of a flat gray
   box, so the icons read as bright/colorful rather than washed out. */
[data-theme="light"] .stat-icon-wrapper {
  border-color: transparent;
}

[data-theme="light"] .stat-icon-wrapper.text-primary {
  background: var(--color-primary-bg);
}

[data-theme="light"] .stat-icon-wrapper.text-success {
  background: var(--color-success-bg);
}

[data-theme="light"] .stat-icon-wrapper.text-warning {
  background: var(--color-warning-bg);
}

[data-theme="light"] .stat-icon-wrapper.text-danger {
  background: var(--color-danger-bg);
}

[data-theme="light"] .stat-icon-wrapper.text-blue {
  background: var(--color-blue-bg);
}

/* The base .badge-* / sidebar-active rules use a low-alpha rgba(...) tuned
   for a dark card, which reads pale on white. Swap in the same solid
   pastel fills used above so badges and the active nav item look vivid. */
[data-theme="light"] .badge-primary {
  background: var(--color-primary-bg);
  border-color: rgba(154, 103, 0, 0.3);
}

[data-theme="light"] .badge-success {
  border-color: rgba(26, 127, 55, 0.3);
}

[data-theme="light"] .badge-warning {
  border-color: rgba(154, 103, 0, 0.3);
}

[data-theme="light"] .badge-danger {
  border-color: rgba(207, 34, 46, 0.25);
}

[data-theme="light"] .badge-blue {
  border-color: rgba(9, 105, 218, 0.3);
}

[data-theme="light"] .sidebar-item.active a {
  background: var(--color-primary-bg);
  border-color: rgba(154, 103, 0, 0.3);
}

body,
.sidebar,
.top-bar,
.card {
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

/* Theme switch (neumorphic): an inset pill track with a round knob that carries
   the sun/moon icon. The knob sits on the side of the active mode and the mode
   name is shown on the opposite side. Everything is driven by the data-theme
   attribute on <html> - dark is the default, [data-theme="light"] overrides it. */
.theme-switch {
  position: relative;
  width: 108px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  flex-shrink: 0;
  font-family: inherit;
  background: #12161C;
  box-shadow:
    inset 3px 3px 7px rgba(0, 0, 0, 0.65),
    inset -2px -2px 5px rgba(255, 255, 255, 0.04),
    0 0 0 1px rgba(255, 255, 255, 0.04);
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

.theme-switch:focus-visible {
  outline: 2px solid #F5C518;
  outline-offset: 3px;
}

.theme-switch-knob {
  position: absolute;
  top: 4px;
  left: calc(100% - 38px);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #E4E8F0;
  background: linear-gradient(145deg, #8C93A6, #6A7185);
  box-shadow: 3px 3px 7px rgba(0, 0, 0, 0.5), -1px -1px 3px rgba(255, 255, 255, 0.08);
  transition: left 0.25s ease, background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

.theme-switch-knob .material-icons {
  font-size: 1.15rem;
}

.theme-switch-text {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #6F7789;
  user-select: none;
  transition: color 0.25s ease;
}

/* Dark (default): knob on the right, "Dark Mode" on the left. */
.theme-switch-text-dark { left: 13px; right: 42px; }
.theme-switch-text-light,
.theme-switch-icon-light { display: none; }

/* Light: knob on the left, "Light Mode" on the right. */
[data-theme="light"] .theme-switch {
  background: #E3E7EE;
  box-shadow:
    inset 3px 3px 7px rgba(150, 160, 180, 0.6),
    inset -3px -3px 6px rgba(255, 255, 255, 0.95),
    0 0 0 1px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .theme-switch-knob {
  left: 4px;
  color: #98A1B3;
  background: linear-gradient(145deg, #FFFFFF, #E9EDF3);
  box-shadow: 3px 3px 7px rgba(140, 150, 170, 0.45), -2px -2px 5px rgba(255, 255, 255, 0.9);
}

[data-theme="light"] .theme-switch-text { color: #98A1B3; }
[data-theme="light"] .theme-switch-text-dark,
[data-theme="light"] .theme-switch-icon-dark { display: none; }
[data-theme="light"] .theme-switch-text-light { display: flex; left: 42px; right: 12px; }
[data-theme="light"] .theme-switch-icon-light { display: inline-block; }

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

body {
  background: var(--color-bg-base);
  color: var(--color-text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-display);
  color: var(--color-text-primary);
  font-weight: 600;
  letter-spacing: -0.025em;
}

a {
  color: inherit;
  text-decoration: none;
}

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

::-webkit-scrollbar-track {
  background: var(--color-bg-base);
}

::-webkit-scrollbar-thumb {
  background: var(--color-border-base);
  border-radius: 99px;
}

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

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0
  }

  to {
    opacity: 1
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.96)
  }

  to {
    opacity: 1;
    transform: scale(1)
  }
}

.animate-fade-in {
  animation: fadeIn 0.2s ease forwards;
}

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

.animate-scale-in {
  animation: scaleIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Layout Shell */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--color-bg-card);
  border-right: 1px solid var(--color-border-base);
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
}

.sidebar-brand {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  padding: 0 1.375rem;
  border-bottom: 1px solid var(--color-border-base);
  gap: 0.625rem;
}

.sidebar-logo-icon {
  width: 30px;
  height: 30px;
  background: var(--color-primary);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  flex-shrink: 0;
}

.sidebar-logo-icon .material-icons {
  font-size: 17px;
}

.sidebar-logo-text {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--color-text-primary);
  letter-spacing: -0.03em;
}

.sidebar-menu {
  list-style: none;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  overflow-y: auto;
}

.sidebar-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  padding: 0.875rem 0.75rem 0.375rem;
}

.sidebar-item a {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.6rem 0.875rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  transition: all 0.15s ease;
}

.sidebar-item a .material-icons {
  font-size: 1.15rem;
  flex-shrink: 0;
}

.sidebar-item a:hover {
  background: var(--color-bg-elevated);
  color: var(--color-text-primary);
}

.sidebar-item.active a {
  background: rgba(245, 197, 24, 0.12);
  color: var(--color-primary);
  border: 1px solid rgba(245, 197, 24, 0.25);
}

.sidebar-item.active a .material-icons {
  color: var(--color-primary);
}

.sidebar-footer {
  padding: 0.875rem 1.125rem;
  border-top: 1px solid var(--color-border-base);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-footer .user-details {
  flex: 1;
  min-width: 0;
}

.sidebar-footer .user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer .user-role {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-top: 1px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-bg-elevated);
  border: 1.5px solid rgba(245, 197, 24, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-primary);
  flex-shrink: 0;
}

.logout-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-base);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.logout-btn .material-icons {
  font-size: 1rem;
}

.logout-btn:hover {
  background: var(--color-danger-bg);
  border-color: rgba(248, 81, 73, 0.25);
  color: var(--color-danger);
}

/* Main Content */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Top Bar */
.top-bar {
  height: var(--topbar-h);
  background: var(--color-bg-card);
  border-bottom: 1px solid var(--color-border-base);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 40;
}

.page-title-heading {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.top-bar-user {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.top-bar-user-info {
  line-height: 1.2;
}

.top-bar-user-info .name {
  font-size: 0.82rem;
  font-weight: 600;
}

.top-bar-user-info .role {
  font-size: 0.68rem;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
}

/* Content Body */
.content-body {
  padding: 2rem;
  flex: 1;
  /* NOTE: NO transform/translate animation here - it would create a stacking
     context that breaks position:fixed modals (they'd be fixed to this element
     instead of the viewport). Use opacity-only animation instead. */
  animation: fadeIn 0.25s ease forwards;
}

/* Flash Messages */
.flash-msg {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.125rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-border-base);
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  animation: fadeIn 0.2s ease forwards;
}

.flash-msg.success {
  background: var(--color-success-bg);
  border-color: rgba(63, 185, 80, 0.2);
  color: var(--color-success);
}

.flash-msg.error {
  background: var(--color-danger-bg);
  border-color: rgba(248, 81, 73, 0.2);
  color: var(--color-danger);
}

.flash-msg.warning {
  background: var(--color-warning-bg);
  border-color: rgba(210, 153, 34, 0.2);
  color: var(--color-warning);
}

.flash-msg.info {
  background: var(--color-blue-bg);
  border-color: rgba(88, 166, 255, 0.2);
  color: var(--color-blue);
}

.flash-msg-close {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 0.25rem;
  transition: opacity 0.15s;
}

.flash-msg-close:hover {
  opacity: 1;
}

/* Welcome Banner */
.welcome-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.welcome-title {
  font-size: 1.875rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.welcome-sub {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin-top: 0.25rem;
}

/* Grid Layouts */
.grid {
  display: grid;
  gap: 1.5rem;
}

.grid-cols-1 {
  grid-template-columns: 1fr;
}

.grid-cols-2 {
  grid-template-columns: 1fr 1fr;
}

.grid-cols-3 {
  grid-template-columns: 2fr 1fr;
}

.grid-cols-4 {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

@media (max-width:1024px) {
  .grid-cols-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width:640px) {
  .grid-cols-2 {
    grid-template-columns: 1fr;
  }
}

/* Cards  */
.card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-base);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.card.hover-effect {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.card.hover-effect:hover {
  border-color: var(--color-border-hover);
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.3);
}

.card-header {
  padding: 1.125rem 1.375rem;
  border-bottom: 1px solid var(--color-border-base);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.card-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.card-body {
  padding: 1.375rem;
}

/* Stat Cards */
.stat-card-body {
  display: flex;
  align-items: center;
  gap: 1.125rem;
}

.stat-icon-wrapper {
  width: 46px;
  height: 46px;
  border-radius: 0.625rem;
  background: var(--color-bg-accent);
  border: 1px solid var(--color-border-base);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon-wrapper .material-icons {
  font-size: 1.5rem;
  color: var(--color-text-secondary);
}

.stat-icon-wrapper.text-primary .material-icons {
  color: var(--color-primary);
}

.stat-icon-wrapper.text-success .material-icons {
  color: var(--color-success);
}

.stat-icon-wrapper.text-warning .material-icons {
  color: var(--color-warning);
}

.stat-icon-wrapper.text-danger .material-icons {
  color: var(--color-danger);
}

.stat-icon-wrapper.text-blue .material-icons {
  color: var(--color-blue);
}

.stat-number {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
}

.stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-secondary);
  margin-top: 3px;
}

/* Stats Grid (bookings page) */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-base);
  border-radius: var(--radius-lg);
  padding: 1.125rem;
  display: flex;
  align-items: center;
  gap: 0.875rem;
  transition: border-color 0.15s;
}

.stat-card:hover {
  border-color: var(--color-border-hover);
}

.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon .material-icons {
  font-size: 1.25rem;
}

.stat-info .stat-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.stat-info .stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
  white-space: nowrap;
}

.btn .material-icons {
  font-size: 1.1rem;
}

.btn-primary {
  background: var(--color-bg-elevated);
  border-color: var(--color-border-base);
  color: var(--color-text-primary);
}

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

.btn-gold {
  background: linear-gradient(135deg, #F5C518 0%, #FFDF6B 50%, #C69F10 100%);
  color: #000;
  font-weight: 700;
  border: none;
}

.btn-gold:hover {
  filter: brightness(0.95);
  box-shadow: 0 0 16px rgba(245, 197, 24, 0.3);
}

.btn-danger {
  background: var(--color-danger-bg);
  border-color: rgba(248, 81, 73, 0.2);
  color: var(--color-danger);
}

.btn-danger:hover {
  background: rgba(248, 81, 73, 0.2);
}

.btn-whatsapp {
  padding: 0.25rem 0.5rem;
  background: rgba(37, 211, 102, 0.12);
  border-color: rgba(37, 211, 102, 0.35);
  color: #25D366;
  text-decoration: none;
}

.btn-whatsapp:hover {
  background: #25D366;
  border-color: #25D366;
  color: #fff;
}

.btn-whatsapp.is-disabled,
.btn-whatsapp.is-disabled:hover {
  background: var(--color-bg-elevated);
  border-color: var(--color-border-base);
  color: var(--color-text-muted);
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-success {
  background: var(--color-success-bg);
  border-color: rgba(63, 185, 80, 0.2);
  color: var(--color-success);
}

.btn-success:hover {
  background: rgba(63, 185, 80, 0.2);
}

.btn-icon {
  padding: 0.45rem;
  border-radius: 6px;
}

.btn.disabled,
.btn[disabled] {
  pointer-events: none;
  opacity: 0.4;
}

/* Forms  */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 0.4rem;
}

.form-control {
  width: 100%;
  background: var(--color-bg-base);
  border: 1px solid var(--color-border-base);
  border-radius: var(--radius);
  padding: 0.625rem 0.875rem;
  color: var(--color-text-primary);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  outline: none;
  transition: all 0.2s ease;
}

.form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(245, 197, 24, 0.12);
}

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

select.form-control {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 2.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6L8 10L12 6' stroke='%238C959F' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.875rem center;
  background-size: 15px;
}

textarea.form-control {
  resize: vertical;
}

/* Tell the browser this field sits on a dark background so native chrome
   (date picker icon, number spinner arrows, time picker clock) renders
   light instead of the default black-on-black. */
input[type="date"].form-control,
input[type="time"].form-control,
input[type="number"].form-control,
input[type="datetime-local"].form-control {
  color-scheme: dark;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
  accent-color: var(--color-primary);
  width: 0.875rem;
  height: 0.875rem;
  cursor: pointer;
}

.flex-row-inputs {
  display: flex;
  gap: 1rem;
}

.flex-row-inputs>* {
  flex: 1;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid transparent;
}

.badge-default {
  background: var(--color-bg-elevated);
  border-color: var(--color-border-base);
  color: var(--color-text-secondary);
}

.badge-success {
  background: var(--color-success-bg);
  border-color: rgba(63, 185, 80, 0.2);
  color: var(--color-success);
}

.badge-warning {
  background: var(--color-warning-bg);
  border-color: rgba(210, 153, 34, 0.2);
  color: var(--color-warning);
}

.badge-danger {
  background: var(--color-danger-bg);
  border-color: rgba(248, 81, 73, 0.2);
  color: var(--color-danger);
}

.badge-primary {
  background: rgba(245, 197, 24, 0.12);
  border-color: rgba(245, 197, 24, 0.25);
  color: var(--color-primary);
}

.badge-blue {
  background: var(--color-blue-bg);
  border-color: rgba(88, 166, 255, 0.2);
  color: var(--color-blue);
}

/* Tables */
.table-responsive {
  overflow-x: auto;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

table.data-table th {
  background: rgba(31, 36, 44, 0.4);
  color: var(--color-text-secondary);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.07em;
  padding: 0.875rem 1.375rem;
  border-bottom: 1px solid var(--color-border-base);
  white-space: nowrap;
}

table.data-table td {
  padding: 0.875rem 1.375rem;
  border-bottom: 1px solid var(--color-border-base);
  color: var(--color-text-primary);
  vertical-align: middle;
}

table.data-table tr:last-child td {
  border-bottom: none;
}

table.data-table tr:hover td {
  background: rgba(31, 36, 44, 0.25);
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.125rem;
  border-top: 1px solid var(--color-border-base);
}

/* Modal  */
.modal-overlay {
  position: fixed !important;
  top: 30px !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9999 !important;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2.5rem 1rem;
  overflow-y: auto;
  animation: fadeIn 0.15s ease;
  /* Ensure this is not clipped by any parent transform/overflow */
  transform: none !important;
  will-change: auto;
}

.modal-box {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-base);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 5rem);
  animation: scaleIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  /* Ensure modals don't overflow viewport */
  max-width: calc(100vw - 2rem);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--color-border-base);
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 700;
}

.modal-close {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-base);
  color: var(--color-text-secondary);
  border-radius: 6px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
  transition: all 0.15s;
}

.modal-close:hover {
  background: var(--color-danger-bg);
  border-color: rgba(248, 81, 73, 0.3);
  color: var(--color-danger);
}

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.modal-body .form-group {
  margin-bottom: 0.75rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.625rem;
  padding: 0.875rem 1.25rem;
  border-top: 1px solid var(--color-border-base);
  flex-shrink: 0;
}

/* Login  */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
  background: var(--color-bg-base);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-base);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo-icon {
  width: 48px;
  height: 48px;
  background: var(--color-primary);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  margin: 0 auto 0.875rem;
}

.login-logo-icon .material-icons {
  font-size: 24px;
}

.login-logo h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  background: linear-gradient(135deg, #F5C518 0%, #FFDF6B 50%, #E0B412 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  letter-spacing: -0.03em;
}

.login-sub {
  font-size: 0.82rem;
  color: var(--color-text-secondary);
  margin-top: 0.3rem;
}

/* Welcome Banner */
@media (max-width:768px) {
  .welcome-banner {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Quick Links (Dashboard) */
.quick-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1rem;
  border: 1px solid var(--color-border-base);
  border-radius: var(--radius);
  background: var(--color-bg-elevated);
  transition: all 0.15s ease;
  cursor: pointer;
}

.quick-link:hover {
  background: var(--color-bg-accent);
  border-color: var(--color-border-hover);
}

.quick-link-left {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.quick-link-left .material-icons {
  font-size: 1.1rem;
}

.quick-link .arrow {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--color-text-secondary);
}

.empty-state .material-icons {
  font-size: 2.5rem;
  color: var(--color-text-muted);
  display: block;
  margin-bottom: 0.875rem;
}

.empty-state h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: 0.375rem;
}

.empty-state p {
  font-size: 0.82rem;
  color: var(--color-text-secondary);
}

/* Package/Service Builder */
.section-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-base);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.section-header {
  padding: 0.875rem 1.125rem;
  background: rgba(31, 36, 44, 0.4);
  border-bottom: 1px solid var(--color-border-base);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.section-details-form {
  padding: 1rem 1.125rem;
  border-bottom: 1px solid var(--color-border-base);
}

.section-services-list {
  padding: 1rem 1.125rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  min-height: 50px;
  background: rgba(13, 17, 23, 0.2);
}

.assigned-service-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto auto;
  align-items: center;
  gap: 0.875rem;
  padding: 0.75rem 1rem;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-base);
  border-radius: var(--radius);
}

@media (max-width:768px) {
  .assigned-service-item {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
}

.drag-handle {
  cursor: grab;
  color: var(--color-text-muted);
}

.drag-handle:active {
  cursor: grabbing;
}

.service-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.875rem;
  max-height: 280px;
  overflow-y: auto;
  padding: 0.5rem;
  border: 1px solid var(--color-border-base);
  border-radius: var(--radius);
  background: var(--color-bg-base);
}

.service-select-card {
  padding: 0.875rem 0.75rem;
  border: 1px solid var(--color-border-base);
  border-radius: var(--radius);
  background: var(--color-bg-elevated);
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}

.service-select-card:hover {
  border-color: var(--color-primary);
  background: rgba(245, 197, 24, 0.08);
}

/* Color Swatch */
.color-swatch {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  display: inline-block;
  vertical-align: middle;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Media Library */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 1.25rem;
}

.media-item {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-base);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
}

.media-preview-wrapper {
  flex: 1;
  background: #05070a;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.media-preview-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.media-item:hover .media-preview-wrapper img {
  transform: scale(1.05);
}

.media-meta {
  padding: 0.625rem;
  border-top: 1px solid var(--color-border-base);
}

.media-title {
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-size {
  font-size: 0.65rem;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.media-actions {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 10;
}

.media-item:hover .media-actions {
  opacity: 1;
}

.media-action-btn {
  padding: 0.3rem;
  border-radius: 6px;
  border: 1px solid var(--color-border-base);
  background: var(--color-bg-elevated);
  color: var(--color-text-primary);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-action-btn:hover {
  background: var(--color-border-base);
}

.media-action-btn.delete:hover {
  background: var(--color-danger-bg);
  border-color: rgba(248, 81, 73, 0.2);
  color: var(--color-danger);
}

/* Upload Dropzone */
.upload-dropzone {
  border: 2px dashed var(--color-border-base);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  text-align: center;
  cursor: pointer;
  background: rgba(22, 27, 34, 0.2);
  transition: all 0.2s ease;
  margin-bottom: 1.75rem;
}

.upload-dropzone:hover {
  border-color: var(--color-primary);
  background: rgba(245, 197, 24, 0.04);
}

.upload-icon {
  font-size: 2rem;
  color: var(--color-text-secondary);
  margin-bottom: 0.875rem;
}

/* Builder legacy layout (kept for compatibility) */
.builder-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width:1100px) {
  .builder-layout {
    grid-template-columns: 1fr;
  }
}

/* Responsive sidebar & overlay */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 45;
  display: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.sidebar-toggle-btn {
  display: none;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-base);
  color: var(--color-text-secondary);
  border-radius: 6px;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
  background: var(--color-border-base);
  color: var(--color-text-primary);
}

.sidebar-toggle-btn .material-icons {
  font-size: 1.25rem;
}

@media (max-width: 1024px) {
  :root {
    --sidebar-w: 0px;
  }

  .sidebar {
    transform: translateX(-100%);
    width: 248px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  body.sidebar-open .sidebar-overlay {
    display: block;
    opacity: 1;
  }

  .sidebar-toggle-btn {
    display: flex !important;
  }

  .main-content {
    margin-left: 0 !important;
  }

  .content-body {
    padding: 1.25rem;
  }

  .top-bar {
    padding: 0 1.25rem;
  }
}

@media (max-width: 991px) {
  .grid-cols-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {

  /* Card headers should stack vertically */
  .card-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.75rem !important;
  }

  .card-header>div,
  .card-header>form,
  .card-header>.btn {
    width: 100% !important;
  }

  /* Make sure forms inside card headers stack or wrap nicely */
  .card-header form {
    flex-wrap: wrap !important;
    width: 100% !important;
  }

  .card-header form>.form-control {
    flex: 1 1 120px !important;
    width: auto !important;
  }

  .card-header form>button,
  .card-header form>a {
    flex: 1 1 auto !important;
  }

  /* Flex inputs stacking */
  .flex-row-inputs {
    flex-direction: column !important;
    gap: 0.75rem !important;
  }

  /* Modal responsive sizing */
  .modal-box {
    max-height: calc(100vh - 2rem) !important;
    width: 95% !important;
    max-width: none !important;
  }

  .modal-body {
    padding: 1rem !important;
  }

  /* Inline styled grids should stack */
  div[style*="display:grid; grid-template-columns:1fr 1fr 1fr; gap:1rem;"],
  div[style*="display:grid; grid-template-columns:1fr 140px auto; gap:1rem; align-items:end;"],
  div[style*="display:grid; grid-template-columns:1fr 1fr; gap:0 1rem;"],
  div[style*="display:grid; grid-template-columns:1fr 1fr; gap: 1rem;"] {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }

  /* Studio Locations save buttons wrapper */
  div[style*="display:flex; gap:1rem; margin-top: 1.5rem;"] {
    flex-direction: column !important;
    gap: 0.75rem !important;
  }

  .stats-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 480px) {
  .top-bar-user-info {
    display: none;
  }
}