/* =========================================================
   ROYAL PRESTINE DESIGN SYSTEM - GLOBAL CSS
   Foundation Layer (DO NOT BREAK THIS FILE)
   ========================================================= */

/* =========================================================
   1. CSS RESET (MODERN + SAFE)
   ========================================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Remove default list styles */
ul,
ol {
  list-style: none;
}

/* Remove default link styles */
a {
  text-decoration: none;
  color: inherit;
}

/* Media elements responsive */
img,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

/* Form elements inherit font */
input,
button,
textarea,
select {
  font: inherit;
  outline: none;
  border: none;
  background: none;
}

/* =========================================================
   2. ROOT DESIGN TOKENS (DUAL THEME SYSTEM)
   ========================================================= */
:root {
  /* ========= CORE BACKGROUNDS ========= */

  /* App shell (sidebar + navbar - DARK) */
  --color-bg: #0b1020;

  /* Main content (LIGHT AREA) */
  --color-surface: #f8fafc;

  /* Cards inside LIGHT area */
  --color-card: #ffffff;

  /* Borders (light UI) */
  --color-border: #e2e8f0;

  /* ========= TEXT (LIGHT UI DEFAULT) ========= */

  --color-text: #0f172a;
  --color-text-muted: #64748b;

  /* ========= DARK UI (SIDEBAR / HEADER) ========= */

  --color-dark: #020617;
  --color-dark-soft: #0f172a;
  --color-dark-border: #1e293b;

  --color-dark-text: #e2e8f0;
  --color-dark-text-muted: #94a3b8;

  /* ========= BRAND COLORS ========= */

  --color-primary: #3c52ff;
  --color-primary-hover: #2c41e4;

  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;

  /* ========= SPACING ========= */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* ========= RADIUS ========= */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* ========= SHADOW (LIGHT UI) ========= */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 30px rgba(0, 0, 0, 0.12);

  /* ========= TYPOGRAPHY ========= */
  --font-base: "Inter", system-ui, -apple-system, sans-serif;

  --text-xs: 12px;
  --text-sm: 13px;
  --text-md: 14px;
  --text-lg: 16px;
  --text-xl: 20px;
  --text-2xl: 24px;
}

/* =========================================================
   3. BASE HTML / BODY
   ========================================================= */
html,
body {
  height: 100%;
}

body {
  font-family: var(--font-base);
  font-size: var(--text-md);

  /* Dark app shell */
  background: var(--color-bg);

  /* Default text assumes LIGHT surfaces */
  color: var(--color-text);

  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* =========================================================
   4. TYPOGRAPHY SYSTEM
   ========================================================= */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  line-height: 1.3;
  color: inherit;
}

h1 {
  font-size: var(--text-2xl);
}
h2 {
  font-size: var(--text-xl);
}
h3 {
  font-size: var(--text-lg);
}

p {
  color: var(--color-text-muted);
}

/* =========================================================
   5. BUTTON BASE
   ========================================================= */
button {
  cursor: pointer;
}

/* =========================================================
   6. SCROLLBAR (MODERN UI)
   ========================================================= */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-surface);
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary);
}

/* =========================================================
   7. SELECTION COLOR
   ========================================================= */
::selection {
  background: var(--color-primary);
  color: #fff;
}

/* =========================================================
   8. UTILITY HELPERS
   ========================================================= */

/* FLEX */
.u-flex {
  display: flex;
}

.u-flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.u-flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* GRID */
.u-grid {
  display: grid;
}

.u-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

/* SPACING */
.u-mt-sm {
  margin-top: var(--space-sm);
}
.u-mt-md {
  margin-top: var(--space-md);
}
.u-mt-lg {
  margin-top: var(--space-lg);
}

.u-p-md {
  padding: var(--space-md);
}
.u-p-lg {
  padding: var(--space-lg);
}

/* TEXT */
.u-text-muted {
  color: var(--color-text-muted);
}

/* =========================================================
   9. SURFACE SYSTEM (CRITICAL FOR CONSISTENCY)
   ========================================================= */

/* LIGHT CARD (main content) */
.surface {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

/* DARK PANEL (sidebar/header safe) */
.surface-dark {
  background: var(--color-dark-soft);
  border: 1px solid var(--color-dark-border);
}

/* =========================================================
   10. CONTAINER SYSTEM
   ========================================================= */
.container {
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

/* =========================================================
   🔻 RESPONSIVE FOUNDATION
   ========================================================= */

/* 32-INCH SCREENS */
@media (min-width: 1920px) {
  .container {
    max-width: 1600px;
  }
}

/* DESKTOP */
@media (max-width: 1280px) {
  .container {
    padding: 0 var(--space-md);
  }
}

/* TABLET */
@media (max-width: 1024px) {
  body {
    font-size: var(--text-sm);
  }
}

/* MOBILE */
@media (max-width: 768px) {
  .container {
    padding: 0 var(--space-sm);
  }
}

/* SMALL DEVICES */
@media (max-width: 480px) {
  body {
    font-size: 13px;
  }
}

/* =========================================================
   11. TOAST NOTIFICATION SYSTEM
   ========================================================= */

/* CONTAINER */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;

  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ITEM */
.toast__item {
  position: relative;

  min-width: 260px;
  max-width: 320px;

  border-radius: var(--radius-md);
  overflow: hidden;

  box-shadow: var(--shadow-md);

  transform: translateX(120%);
  opacity: 0;

  transition: all 0.3s ease;

  /* STACK EFFECT */
  margin-top: calc(var(--toast-index) * -6px);
}

/* SHOW */
.toast__item.show {
  transform: translateX(0);
  opacity: 1;
}

/* HIDE */
.toast__item.hide {
  transform: translateX(120%);
  opacity: 0;
}

/* CONTENT */
.toast__content {
  display: flex;
  justify-content: space-between;
  align-items: center;

  padding: 14px 16px;
  font-size: var(--text-sm);
}

/* TYPES */
.toast__item--success {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid var(--color-success);
  color: var(--color-success);
}

.toast__item--error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid var(--color-danger);
  color: var(--color-danger);
}

/* CLOSE */
.toast__close {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: inherit;
}

/* PROGRESS BAR */
.toast__progress {
  height: 3px;
  width: 100%;
  background: currentColor;
  opacity: 0.4;
}

/* ANIMATION */
@keyframes toastProgress {
  from {
    width: 100%;
  }
  to {
    width: 0%;
  }
}
