@import "tailwindcss";
@plugin '@tailwindcss/forms';
@plugin '@tailwindcss/typography';

/* ═══════════════════════════════════════════════════
   Theme Variables
   ═══════════════════════════════════════════════════ */

:root,
[data-theme="light"] {
  /* Surfaces */
  --bg-base: #f0f0f0;
  --bg-surface: #ffffff;
  --bg-surface-alt: #f8f9fb;
  --bg-elevated: #ffffff;
  --bg-inset: #f9fafb;
  --bg-gradient-from: #3498db;
  --bg-gradient-to: #2980b9;

  /* Borders */
  --border-default: #e0e0e0;
  --border-subtle: #eef0f3;
  --border-strong: #d1d5db;

  /* Text */
  --text-primary: #2c3e50;
  --text-secondary: #666666;
  --text-muted: #8492a6;
  --text-faint: #6b7280;
  --text-inverse: #ffffff;

  /* Accent */
  --accent: #3498db;
  --nav-hover-bg: rgba(0, 0, 0, 0.04);
  --nav-active-bg: rgba(52, 152, 219, 0.08);
  --nav-active-color: #3498db;
  --nav-active-border: #3498db;

  /* Header */
  --header-bg: #ffffff;
  --header-text: #2c3e50;
  --header-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  --accent-bar-from: #2980b9;
  --accent-bar-to: #3498db;
  --accent-bar-height: 0;

  /* Cards */
  --card-bg: #f8f9fb;
  --card-hover-bg: #ffffff;
  --card-border: #eef0f3;
  --card-hover-border: #d0d9e8;
  --card-hover-shadow:
    0 8px 24px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
  --card-active-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  --card-focus-ring: #3498db;
  --card-arrow-color: #cbd5e1;

  /* Avatar */
  --avatar-gradient-from: #3498db;
  --avatar-gradient-to: #2980b9;

  /* Inputs */
  --input-bg: #f9fafb;
  --input-focus-bg: #ffffff;
  --input-border: #d1d5db;
  --input-focus-border: #3498db;
  --input-focus-ring: rgba(52, 152, 219, 0.12);
  --input-text: #374151;
  --input-placeholder: #9ca3af;

  /* Pagination */
  --page-btn-bg: #ffffff;
  --page-btn-border: #d1d5db;
  --page-btn-hover-bg: #f3f4f6;
  --page-btn-hover-border: #9ca3af;
  --page-btn-active-bg: #2c3e50;
  --page-btn-active-border: #2c3e50;
  --page-btn-active-color: #ffffff;
  --page-btn-color: #374151;

  /* Overlay */
  --overlay-bg: rgba(255, 255, 255, 0.8);
  --spinner-track: #eef0f3;
  --spinner-accent: #3498db;

  /* Scrollbar */
  --scrollbar-thumb: rgba(0, 0, 0, 0.15);
  --scrollbar-thumb-hover: rgba(0, 0, 0, 0.25);

  /* Status labels */
  --status-active-bg: #dcfce7;
  --status-active-color: #15803d;
  --status-inactive-bg: #fee2e2;
  --status-inactive-color: #b91c1c;
  --status-pending-bg: #fef3c7;
  --status-pending-color: #a16207;
  --status-reserved-bg: #dbeafe;
  --status-reserved-color: #1d4ed8;
  --status-provisioning-bg: #fef3c7;
  --status-provisioning-color: #a16207;
  --status-neutral-bg: #f1f5f9;
  --status-neutral-color: #64748b;
  --status-neutral-dot: #d1d5db;
  --status-neutral-dot-ring: rgba(209, 213, 219, 0.3);

  /* Toggle */
  --toggle-bg: rgba(0, 0, 0, 0.08);
  --toggle-hover-bg: rgba(0, 0, 0, 0.12);
  --toggle-color: #666666;

  /* Error illustration */
  --error-circle-outer: #fef2f2;
  --error-circle-stroke: #fecaca;
  --error-circle-inner: #fee2e2;

  color-scheme: light;
}

[data-theme="dark"] {
  /* Surfaces */
  --bg-base: #0e0e0e;
  --bg-surface: #1a1a1a;
  --bg-surface-alt: #141414;
  --bg-elevated: #1c1c1c;
  --bg-inset: #111111;
  --bg-gradient-from: #12161e;
  --bg-gradient-to: #181d28;

  /* Borders */
  --border-default: #2a2a2a;
  --border-subtle: #262626;
  --border-strong: #333333;

  /* Text */
  --text-primary: #e0e0e0;
  --text-secondary: #737373;
  --text-muted: #737373;
  --text-faint: #525252;
  --text-inverse: #0e0e0e;

  /* Accent */
  --accent: #333333;

  /* Nav */
  --nav-hover-bg: rgba(255, 255, 255, 0.04);
  --nav-active-bg: rgba(255, 255, 255, 0.06);
  --nav-active-color: #ffffff;
  --nav-active-border: #ffffff;

  /* Header */
  --header-bg: #1a1a1a;
  --header-text: #e0e0e0;
  --header-shadow: none;
  --accent-bar-from: #1a2a44;
  --accent-bar-to: #0e1b33;
  --accent-bar-height: 0;

  /* Cards */
  --card-bg: #141414;
  --card-hover-bg: #1c1c1c;
  --card-border: #262626;
  --card-hover-border: #3d3d3d;
  --card-hover-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  --card-active-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  --card-focus-ring: #a3a3a3;
  --card-arrow-color: #a3a3a3;

  /* Avatar */
  --avatar-gradient-from: #333333;
  --avatar-gradient-to: #262626;

  /* Inputs */
  --input-bg: #111111;
  --input-focus-bg: #161616;
  --input-border: #333333;
  --input-focus-border: #525252;
  --input-focus-ring: rgba(255, 255, 255, 0.04);
  --input-text: #d4d4d4;
  --input-placeholder: #525252;

  /* Pagination */
  --page-btn-bg: #1a1a1a;
  --page-btn-border: #333333;
  --page-btn-hover-bg: #262626;
  --page-btn-hover-border: #404040;
  --page-btn-active-bg: #ffffff;
  --page-btn-active-border: #ffffff;
  --page-btn-active-color: #0e0e0e;
  --page-btn-color: #a3a3a3;

  /* Overlay */
  --overlay-bg: rgba(14, 14, 14, 0.85);
  --spinner-track: #262626;
  --spinner-accent: #a3a3a3;

  /* Scrollbar */
  --scrollbar-thumb: rgba(255, 255, 255, 0.15);
  --scrollbar-thumb-hover: rgba(255, 255, 255, 0.3);

  /* Status labels */
  --status-active-bg: rgba(34, 197, 94, 0.12);
  --status-active-color: #4ade80;
  --status-inactive-bg: rgba(239, 68, 68, 0.12);
  --status-inactive-color: #f87171;
  --status-pending-bg: rgba(245, 158, 11, 0.12);
  --status-pending-color: #fbbf24;
  --status-reserved-bg: rgba(59, 130, 246, 0.12);
  --status-reserved-color: #60a5fa;
  --status-provisioning-bg: rgba(245, 158, 11, 0.12);
  --status-provisioning-color: #fbbf24;
  --status-neutral-bg: rgba(255, 255, 255, 0.06);
  --status-neutral-color: #737373;
  --status-neutral-dot: #525252;
  --status-neutral-dot-ring: rgba(82, 82, 82, 0.3);

  /* Toggle */
  --toggle-bg: rgba(255, 255, 255, 0.08);
  --toggle-hover-bg: rgba(255, 255, 255, 0.12);
  --toggle-color: #a3a3a3;

  /* Error illustration */
  --error-circle-outer: rgba(239, 68, 68, 0.08);
  --error-circle-stroke: rgba(239, 68, 68, 0.2);
  --error-circle-inner: rgba(239, 68, 68, 0.12);

  color-scheme: dark;
}

body {
  margin: 0;
  padding: 0;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════
   Theme Toggle Button
   ═══════════════════════════════════════════════════ */

.theme-toggle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: var(--toggle-bg);
  color: var(--toggle-color);
  cursor: pointer;
  transition:
    background 0.2s,
    color 0.2s;
  margin-left: auto;
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: var(--toggle-hover-bg);
  color: var(--text-primary);
}

.theme-icon {
  width: 18px;
  height: 18px;
  position: absolute;
  opacity: 0;
  transform: scale(0.6) rotate(-90deg);
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
}

.theme-icon.visible {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}
