/* ==========================================================================
   Design Tokens - 楽市クーポン管理画面
   ========================================================================== */

/* ==========================================================================
   ダークモード（デフォルト）- SaaS Dashboard Style
   ========================================================================== */
:root {
  /* ==========================================================================
     Brand Colors (Rakuten Orange - Optimized for dark backgrounds)
     ========================================================================== */
  --color-primary: #f97316;
  --color-primary-hover: #fb923c;
  --color-primary-light: rgba(249, 115, 22, 0.15);
  --color-primary-50: rgba(249, 115, 22, 0.08);

  /* ==========================================================================
     Background Hierarchy (Deep neutral tones - Linear/Vercel inspired)
     ========================================================================== */
  --color-bg-canvas: #0a0a0b;     /* Deepest - page background */
  --color-bg-base: #111113;       /* Main content area */
  --color-bg-elevated: #18181b;   /* Cards, sidebar */
  --color-bg-surface: #27272a;    /* Interactive surface hover */
  --color-bg-sunken: #09090b;     /* Inset, input backgrounds */

  /* ==========================================================================
     Text Hierarchy
     ========================================================================== */
  --color-text-primary: #fafafa;    /* Headings, important text */
  --color-text-secondary: #a1a1aa;  /* Body text, labels */
  --color-text-tertiary: #71717a;   /* Captions, placeholders */
  --color-text-muted: #52525b;      /* Disabled text */
  --color-text-inverse: #09090b;    /* Text on primary buttons */

  /* ==========================================================================
     Border Colors (Subtle white overlays)
     ========================================================================== */
  --color-border-subtle: rgba(255, 255, 255, 0.06);   /* Minimal dividers */
  --color-border-light: rgba(255, 255, 255, 0.10);    /* Standard borders */
  --color-border-default: rgba(255, 255, 255, 0.12);  /* Form elements */
  --color-border-strong: rgba(255, 255, 255, 0.18);   /* Hover, focus */

  /* ==========================================================================
     Semantic Colors (Optimized for dark mode)
     ========================================================================== */
  /* Success */
  --color-success: #22c55e;
  --color-success-hover: #4ade80;
  --color-success-light: rgba(34, 197, 94, 0.15);

  /* Danger */
  --color-danger: #ef4444;
  --color-danger-hover: #f87171;
  --color-danger-light: rgba(239, 68, 68, 0.15);

  /* Warning */
  --color-warning: #f59e0b;
  --color-warning-hover: #fbbf24;
  --color-warning-light: rgba(245, 158, 11, 0.15);

  /* Info */
  --color-info: #3b82f6;
  --color-info-hover: #60a5fa;
  --color-info-light: rgba(59, 130, 246, 0.15);

  /* ==========================================================================
     Accent Colors
     ========================================================================== */
  --color-accent: #fbbf24;
  --color-accent-soft: rgba(251, 191, 36, 0.2);
  --color-accent-gold: #f59e0b;
  --color-accent-purple: #a855f7;
  --color-accent-cyan: #22d3ee;

  /* ==========================================================================
     Shadow System (Dark mode - deeper shadows + glow effects)
     ========================================================================== */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.7);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.8);

  /* Glow effects (signature dark mode feature) */
  --shadow-glow-primary: 0 0 30px rgba(249, 115, 22, 0.2);
  --shadow-glow-primary-sm: 0 0 15px rgba(249, 115, 22, 0.15);
  --shadow-glow-accent: 0 0 20px rgba(251, 191, 36, 0.15);
  --shadow-glow-success: 0 0 15px rgba(34, 197, 94, 0.2);
  --shadow-glow-danger: 0 0 15px rgba(239, 68, 68, 0.2);

  /* Focus ring */
  --shadow-focus: 0 0 0 2px var(--color-bg-base), 0 0 0 4px var(--color-primary);
  --shadow-focus-danger: 0 0 0 2px var(--color-bg-base), 0 0 0 4px var(--color-danger);

  /* ==========================================================================
     Typography
     ========================================================================== */
  --font-family-display: "Geist", "Noto Sans JP", system-ui, sans-serif;
  --font-family-body: "Noto Sans JP", "Geist", "Hiragino Kaku Gothic ProN", sans-serif;
  --font-family-mono: "Geist Mono", "JetBrains Mono", ui-monospace, monospace;

  /* Legacy support */
  --font-family-base: var(--font-family-body);

  --font-size-xs: 0.75rem;    /* 12px */
  --font-size-sm: 0.8125rem;  /* 13px */
  --font-size-base: 0.875rem; /* 14px */
  --font-size-md: 0.9375rem;  /* 15px */
  --font-size-lg: 1rem;       /* 16px */
  --font-size-xl: 1.125rem;   /* 18px */
  --font-size-2xl: 1.25rem;   /* 20px */
  --font-size-3xl: 1.5rem;    /* 24px */
  --font-size-4xl: 2rem;      /* 32px */

  --line-height-none: 1;
  --line-height-tight: 1.25;
  --line-height-snug: 1.375;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.625;

  --tracking-tight: -0.025em;
  --tracking-normal: 0;
  --tracking-wide: 0.025em;

  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* ==========================================================================
     Spacing Scale (4px base)
     ========================================================================== */
  --space-0: 0;
  --space-px: 1px;
  --space-0-5: 0.125rem;  /* 2px */
  --space-1: 0.25rem;     /* 4px */
  --space-1-5: 0.375rem;  /* 6px */
  --space-2: 0.5rem;      /* 8px */
  --space-2-5: 0.625rem;  /* 10px */
  --space-3: 0.75rem;     /* 12px */
  --space-4: 1rem;        /* 16px */
  --space-5: 1.25rem;     /* 20px */
  --space-6: 1.5rem;      /* 24px */
  --space-8: 2rem;        /* 32px */
  --space-10: 2.5rem;     /* 40px */
  --space-12: 3rem;       /* 48px */
  --space-16: 4rem;       /* 64px */
  --space-20: 5rem;       /* 80px */

  /* ==========================================================================
     Border Radius
     ========================================================================== */
  --radius-none: 0;
  --radius-sm: 0.25rem;   /* 4px */
  --radius-md: 0.5rem;    /* 8px */
  --radius-lg: 0.75rem;   /* 12px */
  --radius-xl: 1rem;      /* 16px */
  --radius-2xl: 1.5rem;   /* 24px */
  --radius-full: 9999px;

  /* ==========================================================================
     Transitions
     ========================================================================== */
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --duration-instant: 75ms;
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 350ms;
  --duration-slower: 500ms;

  --transition-fast: var(--duration-fast) var(--ease-in-out);
  --transition-base: var(--duration-normal) var(--ease-in-out);
  --transition-slow: var(--duration-slow) var(--ease-in-out);

  /* ==========================================================================
     Z-Index Scale
     ========================================================================== */
  --z-base: 0;
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-sidebar: 1035;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  --z-toast: 1080;

  /* ==========================================================================
     Layout
     ========================================================================== */
  --sidebar-width: 240px;
  --header-height: 64px;
  --mobile-header-height: 56px;
}

/* ==========================================================================
   ライトモード
   ========================================================================== */
[data-theme="light"] {
  /* ==========================================================================
     Brand Colors
     ========================================================================== */
  --color-primary: #ea580c;
  --color-primary-hover: #f97316;
  --color-primary-light: #fff7ed;
  --color-primary-50: rgba(234, 88, 12, 0.08);

  /* ==========================================================================
     Background Hierarchy
     ========================================================================== */
  --color-bg-canvas: #f8fafc;
  --color-bg-base: #ffffff;
  --color-bg-elevated: #ffffff;
  --color-bg-surface: #f1f5f9;
  --color-bg-sunken: #e2e8f0;

  /* ==========================================================================
     Text Hierarchy
     ========================================================================== */
  --color-text-primary: #0f172a;
  --color-text-secondary: #475569;
  --color-text-tertiary: #94a3b8;
  --color-text-muted: #cbd5e1;
  --color-text-inverse: #ffffff;

  /* ==========================================================================
     Border Colors
     ========================================================================== */
  --color-border-subtle: rgba(0, 0, 0, 0.04);
  --color-border-light: rgba(0, 0, 0, 0.08);
  --color-border-default: rgba(0, 0, 0, 0.12);
  --color-border-strong: rgba(0, 0, 0, 0.18);

  /* ==========================================================================
     Semantic Colors
     ========================================================================== */
  /* Success */
  --color-success: #059669;
  --color-success-hover: #047857;
  --color-success-light: #ecfdf5;

  /* Danger */
  --color-danger: #dc2626;
  --color-danger-hover: #b91c1c;
  --color-danger-light: #fef2f2;

  /* Warning */
  --color-warning: #d97706;
  --color-warning-hover: #b45309;
  --color-warning-light: #fffbeb;

  /* Info */
  --color-info: #2563eb;
  --color-info-hover: #1d4ed8;
  --color-info-light: #eff6ff;

  /* ==========================================================================
     Accent Colors
     ========================================================================== */
  --color-accent: #f59e0b;
  --color-accent-soft: #fef3c7;
  --color-accent-gold: #d4a017;

  /* ==========================================================================
     Shadow System (Light mode shadows)
     ========================================================================== */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.15);

  /* Glow effects (subtle in light mode) */
  --shadow-glow-primary: 0 0 20px rgba(234, 88, 12, 0.1);
  --shadow-glow-primary-sm: 0 0 10px rgba(234, 88, 12, 0.08);
  --shadow-glow-accent: 0 0 15px rgba(245, 158, 11, 0.1);
  --shadow-glow-success: 0 0 10px rgba(5, 150, 105, 0.1);
  --shadow-glow-danger: 0 0 10px rgba(220, 38, 38, 0.1);

  /* Focus ring */
  --shadow-focus: 0 0 0 2px var(--color-bg-base), 0 0 0 4px var(--color-primary);
}

/* ==========================================================================
   Reduced Motion Support
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-instant: 0ms;
    --duration-fast: 0ms;
    --duration-normal: 0ms;
    --duration-slow: 0ms;
    --duration-slower: 0ms;
    --transition-fast: 0ms;
    --transition-base: 0ms;
    --transition-slow: 0ms;
  }
}

/* ==========================================================================
   Theme Transition (applied during theme switch)
   ========================================================================== */
html.theme-transitioning,
html.theme-transitioning * {
  transition:
    background-color 0.3s ease,
    color 0.3s ease,
    border-color 0.3s ease,
    box-shadow 0.3s ease !important;
}

/* ==========================================================================
   Keyframe Animations
   ========================================================================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInFromRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInFromLeft {
  from {
    opacity: 0;
    transform: translateX(-100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes shimmer {
  from { background-position: -200% 0; }
  to { background-position: 200% 0; }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(249, 115, 22, 0.2);
  }
  50% {
    box-shadow: 0 0 30px rgba(249, 115, 22, 0.3);
  }
}
