/* =====================================================
   STYLEE GLOBAL UI TOKENS + DARK MODE + TOGGLE
   ===================================================== */

/* ========================= */
/* 1. PRIMITIVE TOKENS       */
/* ========================= */
:root {
  /* Core colors */
  --stc-color-white: #ffffff;
  --stc-color-black: #000000;

  /* Grey scale (light mode base) */
  --stc-color-grey-100: #f5f5f5;
  --stc-color-grey-200: #e5e5e5;
  --stc-color-grey-300: #d4d4d4;
  --stc-color-grey-400: #a3a3a3;
  --stc-color-grey-500: #737373;
  --stc-color-grey-600: #525252;
  --stc-color-grey-700: #404040;
  --stc-color-grey-800: #262626;
  --stc-color-grey-900: #171717;

  /* Neutral Dark Scale */
  --stc-color-neutral-dark-950: #111111;
  --stc-color-neutral-dark-900: #171717;
  --stc-color-neutral-dark-850: #1a1a1a;
  --stc-color-neutral-dark-800: #222222;

  --stc-color-neutral-dark-700: #2a2a2a;
  --stc-color-neutral-dark-600: #3a3a3a;
  --stc-color-neutral-dark-500: #555555;

  --stc-color-neutral-dark-400: #888888;
  --stc-color-neutral-dark-300: #a3a3a3;
  --stc-color-neutral-dark-200: #dddddd;
  --stc-color-neutral-dark-100: #f5f5f5;


  /* Brand */
  --stc-color-brand-red: #ce1118;
  --stc-color-brand-red-hover: #ff2020;
  --stc-color-brand-grey: #707070;

  /* States */
  --stc-color-success: #22c55e;
  --stc-color-warning: #f59e0b;
  --stc-color-danger: #ef4444;
  --stc-color-info: #3b82f6;
}

/* ========================= */
/* 2. SEMANTIC UI TOKENS     */
/* ========================= */
:root {
  /* Surfaces */
  --stc-surface-primary: var(--stc-color-white);
  --stc-surface-secondary: var(--stc-color-grey-100);
  --stc-surface-tertiary: var(--stc-color-grey-200);
  --stc-surface-card: var(--stc-color-white);
  --stc-surface-overlay: rgba(0, 0, 0, 0.5);
  --stc-surface-inverse: var(--stc-color-grey-900);

  --stc-surface-primary-light-only: var(--stc-color-white);
  --stc-surface-secondary-light-only: var(--stc-color-grey-100);
  --stc-surface-tertiary-light-only: var(--stc-color-grey-200);
  --stc-surface-card-light-only: var(--stc-color-white);
  --stc-surface-overlay-light-only: rgba(0, 0, 0, 0.5);
  --stc-surface-inverse-light-only: var(--stc-color-grey-900);

  --stc-surface-glass:rgba(255,255,255,0.95);

  /* Text */
  --stc-text-primary: var(--stc-color-grey-900);
  --stc-text-secondary: var(--stc-color-grey-700);
  --stc-text-muted: var(--stc-color-grey-500);
  --stc-text-inverse: var(--stc-color-white);
  --stc-text-inverse-muted: var(--stc-color-grey-300);

  --stc-text-primary-light-only: var(--stc-color-grey-900);
  --stc-text-secondary-light-only: var(--stc-color-grey-700);
  --stc-text-muted-light-only: var(--stc-color-grey-500);
  --stc-text-inverse-light-only: var(--stc-color-white);
  --stc-text-inverse-muted-light-only: var(--stc-color-grey-300);

  /* Borders */
  --stc-border-soft: var(--stc-color-grey-200);
  --stc-border-medium: var(--stc-color-grey-300);
  --stc-border-strong: var(--stc-color-grey-400);

  --stc-border-soft-light-only: var(--stc-color-grey-200);
  --stc-border-medium-light-only: var(--stc-color-grey-300);
  --stc-border-strong-light-only: var(--stc-color-grey-400);

  /* Actions */
  --stc-action-primary: var(--stc-color-brand-red);
  --stc-action-primary-hover: var(--stc-color-brand-red-hover);
  --stc-action-secondary: var(--stc-color-grey-500);
  --stc-action-secondary-hover: var(--stc-color-grey-600);

  /* Shadows */
  --stc-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --stc-shadow-md: 0 4px 10px rgba(0, 0, 0, 0.08);
  --stc-shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);

  /* Radius */
  --stc-radius-sm: 4px;
  --stc-radius-md: 8px;
  --stc-radius-lg: 14px;

  /* Transitions */
  --stc-transition-fast: 0.15s ease;
  --stc-transition-normal: 0.25s ease;
  --stc-transition-slow: 0.4s ease;
}

/* ========================= */
/* 3. DARK MODE OVERRIDES    */
/* ========================= */
html.stc-dark {
  /* Surfaces */
  --stc-surface-primary: var(--stc-color-neutral-dark-950);
  --stc-surface-secondary: var(--stc-color-neutral-dark-900);
  --stc-surface-tertiary: var(--stc-color-neutral-dark-800);
  --stc-surface-card: var(--stc-color-neutral-dark-850);
  --stc-surface-overlay: rgba(0, 0, 0, 0.7);

  --stc-surface-glass:rgba(0,0,0,0.85);

  /* Text */
  --stc-text-primary: var(--stc-color-neutral-dark-100);
  --stc-text-secondary: var(--stc-color-neutral-dark-200);
  --stc-text-muted: var(--stc-color-neutral-dark-300);

  /* Borders */
  --stc-border-soft: var(--stc-color-neutral-dark-700);
  --stc-border-medium: var(--stc-color-neutral-dark-600);
  --stc-border-strong: var(--stc-color-neutral-dark-500);

  /* Actions */
  --stc-action-primary: #ff3030;
  --stc-action-primary-hover: #ff4d4d;
  --stc-action-secondary: var(--stc-color-neutral-dark-400);
  --stc-action-secondary-hover: var(--stc-color-neutral-dark-300);

  /* Shadows */
  --stc-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.6);
  --stc-shadow-md: 0 4px 10px rgba(0, 0, 0, 0.7);
  --stc-shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.8);
}

/* Scrollbar polish */
html.stc-dark ::-webkit-scrollbar {
  width: 8px;
}

html.stc-dark ::-webkit-scrollbar-thumb {
  background: var(--stc-border-medium);
  border-radius: 8px;
}


/* ========================= */
/* 4. GLOBAL TRANSITIONS     */
/* ========================= */
html {
  scroll-behavior: smooth;
}

body,
footer,
header,
section,
nav,
.stc-card,
.stc-block,
.stc-dropdown-menu,
a,
input,
textarea,
select {
  transition: background-color 0.45s cubic-bezier(.4, 0, .2, 1),
    color 0.45s cubic-bezier(.4, 0, .2, 1),
    border-color 0.45s cubic-bezier(.4, 0, .2, 1);
}


/* ========================= */
/* 5. FLOATING DARK MODE TOGGLE */
/* ========================= */
.stc-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 52px;
  height: 52px;
  background: var(--stc-surface-primary);
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12),
    0 8px 24px rgba(0, 0, 0, 0.18);
  z-index: 9999;
  transition: background 0.35s cubic-bezier(.4, 0, .2, 1),
    transform 0.25s ease,
    box-shadow 0.35s ease;
  backdrop-filter: blur(8px);
}

.stc-toggle:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18),
    0 12px 32px rgba(0, 0, 0, 0.22);
}

.stc-toggle:active {
  transform: scale(0.94);
}

/* Icon styling */
.stc-toggle img {
  width: 24px;
  height: 24px;
  transition: transform 0.6s cubic-bezier(.4, 0, .2, 1),
    filter 0.35s ease,
    opacity 0.35s ease;
}

/* Rotate icon smoothly */
html.stc-dark .stc-toggle img {
  transform: rotate(180deg) scale(1.1);
}

html:not(.stc-dark) .stc-toggle img {
  transform: rotate(0deg) scale(1);
}

/* Dark/light icon classes */
.stc-toggle img.stc-sun {
  filter: brightness(1.2) invert(1);
}

.stc-toggle img.stc-moon {
  filter: none;
}

/* Toggle background + shadow in dark mode */
html.stc-dark .stc-toggle {
  background: var(--stc-surface-secondary);
  box-shadow:
    0 4px 12px rgba(255, 255, 255, 0.08),
    0 8px 24px rgba(0, 0, 0, 0.2);
}

html.stc-dark .stc-toggle:hover {
  box-shadow:
    0 6px 18px rgba(255, 255, 255, 0.12),
    0 12px 32px rgba(0, 0, 0, 0.25);
}

/* Responsive toggle size */
@media (max-width: 768px) {
  .stc-toggle {
    width: 44px;
    height: 44px;
    bottom: 21px;
    right: 16px;
  }

  .stc-toggle img {
    width: 20px;
    height: 20px;
  }
}