@import url('https://fonts.googleapis.com/css2?family=Mulish:wght@400;500;600;700&display=swap');

/* =================================================================
   tokens.css — Design tokens, resets, typography, and button system
   Load this file FIRST before all other CSS files.
   ================================================================= */

/* ===== Theme Variables (Light Mode) ============================== */

:root {
  /* light theme - PANW brand palette with warm neutrals */
  --bg: #faf8f6;
  --bg-card: #ffffff;
  --bg-elevated: #ffffff;
  --bg-header: #ffffff;
  --bg-hover: #f5f0ed;

  --fg: #1c1917;
  --fg-muted: #78716c;

  --border-subtle: #e7e5e4;

  /* accent + status colours – PANW palette */
  --accent: #FA582D;
  --accent-soft: #FECDC0;
  --accent-hover: #E14F28;
  --accent-text: #C84624;
  --danger: #C94727;
  --danger-soft: #F6E4DF;
  --warning: #FFCB06;
  --warning-soft: #FDF0D0;
  --success: #00CC66;
  --success-soft: #D6ECD8;
  --info: #00C0E8;
  --info-soft: #DAF0F6;

  --accent-light: #ff8a65;

  /* Role badge colors */
  --role-ciso: #E55539;
  --role-ciso-soft: #F6E4DF;
  --role-ciso-fg: #8B2D1A;
  --role-tdm: #2563EB;
  --role-tdm-soft: #DBEAFE;
  --role-tdm-fg: #1E3A5F;
  --role-contributor: #00CC66;
  --role-contributor-soft: #D6ECD8;
  --role-contributor-fg: #166534;
  --role-default: #78716C;
  --role-default-soft: #F5F0ED;
  --role-default-fg: #44403C;

  --shadow-soft: 0 10px 25px rgba(28, 25, 23, 0.08);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-card-hover: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.08);

  /* Sidebar – always dark, NOT overridden in [data-theme="dark"] */
  --sidebar-bg: #0c0a09;
  --sidebar-bg-hover: #292524;
  --sidebar-bg-active: rgba(250, 88, 45, 0.12);
  --sidebar-fg: #e7e5e4;
  --sidebar-fg-muted: #a8a29e;
  --sidebar-border: #44403c;
  --sidebar-accent: #FA582D;
}

/* ===== Theme Variables (Dark Mode) =============================== */

:root[data-theme="dark"],
[data-theme="dark"] {
  --bg: #0c0a09;
  --bg-card: #1c1917;
  --bg-elevated: #292524;
  --bg-header: #0c0a09;
  --bg-hover: #292524;

  --fg: #e7e5e4;
  --fg-muted: #a8a29e;

  --border-subtle: #44403c;

  --accent: #FA582D;
  --accent-soft: rgba(250, 88, 45, 0.15);
  --accent-hover: #E55539;
  --accent-text: #FDAC96;

  --danger: #E55539;
  --danger-soft: rgba(201, 71, 39, 0.15);

  --warning: #E5C148;
  --warning-soft: rgba(255, 203, 6, 0.12);
  --success: #40A557;
  --success-soft: rgba(0, 204, 102, 0.12);
  --info: #6EC2D6;
  --info-soft: rgba(0, 192, 232, 0.12);

  --accent-light: #ff8a65;

  /* Role badge colors (dark mode) */
  --role-ciso: #E55539;
  --role-ciso-soft: rgba(229, 85, 57, 0.15);
  --role-ciso-fg: #FDAC96;
  --role-tdm: #60A5FA;
  --role-tdm-soft: rgba(96, 165, 250, 0.15);
  --role-tdm-fg: #BFDBFE;
  --role-contributor: #40A557;
  --role-contributor-soft: rgba(0, 204, 102, 0.12);
  --role-contributor-fg: #BBF7D0;
  --role-default: #a8a29e;
  --role-default-soft: rgba(168, 162, 158, 0.15);
  --role-default-fg: #d6d3d1;

  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.7);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-card-hover: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
}

/* ===== z-index Scale ============================================
   1       default
   10      dropdowns, tooltips
   100     sticky headers, floating elements
   1000    modals, overlays, sidebar
   10000   topmost (loading overlay, critical notifications)
   ================================================================= */

/* ===== Base Resets ================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: 'Mulish', sans-serif;
  background: var(--bg);
  color: var(--fg);
}

/* ===== Base Typography =========================================== */

h2 {
  margin-top: 0;
  font-size: 1.3rem;
}

/* ===== Base Utilities ============================================ */

.hidden {
  display: none !important;
}

.hint {
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: 4px;
}

.error {
  color: var(--danger);
  margin-top: 8px;
}

/* ===== Base Form Elements ======================================== */

button {
  border-radius: 999px;
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  cursor: pointer;
  font-size: 0.85rem;
}

button:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

input[type="email"],
input[type="name"],
input[type="password"],
input[type="date"] {
  padding: 0.3rem 0.5rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--fg);
}

input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ===== Unified Button System ===================================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--fg);
}

.btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.btn--primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn--icon {
  padding: 8px;
  border: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn--icon svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.75;
}

.btn--icon:hover {
  background: var(--accent-soft);
}

.btn--icon:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-icon {
  font-size: 1rem;
}

.btn-label {
  font-size: 0.875rem;
}

.btn--sm {
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.btn--success {
  background: var(--success, #00CC66);
  color: #fff;
}

.btn--success:hover {
  background: color-mix(in srgb, var(--success) 80%, black);
}

.btn--danger {
  background: var(--danger, #C94727);
  color: #fff;
}

.btn--danger:hover {
  background: color-mix(in srgb, var(--danger) 80%, black);
}

.btn--sm:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ===== Mobile Touch Targets ===================================== */

@media (max-width: 768px) {
  .btn {
    min-height: 44px;
  }

  .btn--icon {
    min-width: 44px;
    min-height: 44px;
  }

  .btn--sm {
    min-height: 36px;
    padding: 6px 14px;
  }
}
