/* =================================
   EduFLIX 통합 변수 시스템
   Version: 1.0
   Created: 2025-10-09
   Description: 모든 CSS 파일에서 공통으로 사용하는 변수 통합
   ================================= */

/* === 색상 시스템 === */
:root {
    /* 브랜드 색상 */
    --color-primary: #e50914;
    --color-primary-hover: #c40812;
    --color-secondary: #ff6b35;
    --color-accent: #f7931e;

    /* 중립 색상 */
    --color-white: #ffffff;
    --color-white-secondary: rgba(255, 255, 255, 0.9);
    --color-white-tertiary: rgba(255, 255, 255, 0.8);
    --color-white-muted: rgba(255, 255, 255, 0.7);
    --color-white-light: rgba(255, 255, 255, 0.5);

    /* 배경 색상 */
    --color-black: #141414;
    --color-black-secondary: #181818;
    --color-black-tertiary: #232323;
    --color-surface: #1a1a1a;
    --color-surface-light: #2a2a2a;
    --color-surface-lighter: #3a3a3a;

    /* 텍스트 색상 */
    --color-text: #ffffff;
    --color-text-secondary: rgba(255, 255, 255, 0.9);
    --color-text-muted: rgba(255, 255, 255, 0.7);
    --color-text-light: rgba(255, 255, 255, 0.5);

    /* 상태 색상 */
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-error: #ef4444;
    --color-info: #3b82f6;

    /* 그라데이션 */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-hero: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-netflix: linear-gradient(135deg, #e50914 0%, #f7931e 100%);
    --gradient-surface: linear-gradient(135deg, rgba(20, 20, 20, 0.9) 0%, rgba(35, 35, 35, 0.9) 100%);

    /* 글래스 효과 */
    --glass-bg: rgba(255, 255, 255, 0.01);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* === 타이포그래피 시스템 === */
:root {
    /* 폰트 패밀리 */
    --font-family-primary: "Netflix Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
    --font-family-secondary: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-family-mono: "Fira Code", "Monaco", "Courier New", monospace;

    /* 폰트 크기 */
    --font-size-xs: 0.75rem;    /* 12px */
    --font-size-sm: 0.875rem;   /* 14px */
    --font-size-base: 1rem;     /* 16px */
    --font-size-lg: 1.125rem;   /* 18px */
    --font-size-xl: 1.25rem;    /* 20px */
    --font-size-2xl: 1.5rem;    /* 24px */
    --font-size-3xl: 1.875rem;  /* 30px */
    --font-size-4xl: 2.25rem;   /* 36px */
    --font-size-5xl: 3rem;      /* 48px */
    --font-size-6xl: 3.75rem;   /* 60px */

    /* 제목 크기 */
    --font-size-h1: 3.5rem;
    --font-size-h2: 2.5rem;
    --font-size-h3: 1.875rem;
    --font-size-h4: 1.5rem;
    --font-size-h5: 1.25rem;
    --font-size-h6: 1.125rem;

    /* 폰트 두께 */
    --font-weight-thin: 100;
    --font-weight-light: 300;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --font-weight-extrabold: 800;
    --font-weight-black: 900;

    /* 줄 높이 */
    --line-height-tight: 1.25;
    --line-height-snug: 1.375;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.625;
    --line-height-loose: 2;
}

/* === 간격 시스템 === */
:root {
    /* 기본 간격 */
    --spacing-0: 0;
    --spacing-1: 0.25rem;   /* 4px */
    --spacing-2: 0.5rem;    /* 8px */
    --spacing-3: 0.75rem;   /* 12px */
    --spacing-4: 1rem;      /* 16px */
    --spacing-5: 1.25rem;   /* 20px */
    --spacing-6: 1.5rem;    /* 24px */
    --spacing-8: 2rem;      /* 32px */
    --spacing-10: 2.5rem;   /* 40px */
    --spacing-12: 3rem;     /* 48px */
    --spacing-16: 4rem;     /* 64px */
    --spacing-20: 5rem;     /* 80px */
    --spacing-24: 6rem;     /* 96px */
    --spacing-32: 8rem;     /* 128px */

    /* 별칭 */
    --spacing-xs: var(--spacing-2);
    --spacing-sm: var(--spacing-4);
    --spacing-md: var(--spacing-6);
    --spacing-lg: var(--spacing-8);
    --spacing-xl: var(--spacing-12);
    --spacing-2xl: var(--spacing-16);
    --spacing-3xl: var(--spacing-24);
}

/* === 테두리 반경 시스템 === */
:root {
    --radius-none: 0;
    --radius-sm: 0.125rem;   /* 2px */
    --radius-base: 0.25rem;  /* 4px */
    --radius-md: 0.375rem;   /* 6px */
    --radius-lg: 0.5rem;     /* 8px */
    --radius-xl: 0.75rem;    /* 12px */
    --radius-2xl: 1rem;      /* 16px */
    --radius-3xl: 1.5rem;    /* 24px */
    --radius-full: 9999px;

    /* 별칭 */
    --radius-small: var(--radius-sm);
    --radius-medium: var(--radius-md);
    --radius-large: var(--radius-xl);
    --radius-xlarge: var(--radius-2xl);
}

/* === 그림자 시스템 === */
:root {
    /* 기본 그림자 */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-base: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);

    /* Netflix 스타일 그림자 */
    --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 10px 30px rgba(255, 74, 0, 0.2);
    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);

    /* EduFLIX 특화 그림자 */
    --shadow-episode: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-course: 0 8px 25px rgba(0, 0, 0, 0.3);
    --shadow-button: 0 2px 8px rgba(229, 9, 20, 0.3);
}

/* === 전환 효과 시스템 === */
:root {
    /* 지속 시간 */
    --duration-fast: 150ms;
    --duration-base: 200ms;
    --duration-slow: 300ms;
    --duration-slower: 500ms;

    /* 타이밍 함수 */
    --ease-linear: linear;
    --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);

    /* 별칭 */
    --transition-fast: var(--duration-fast) var(--ease-out);
    --transition-base: var(--duration-base) var(--ease-out);
    --transition-slow: var(--duration-slow) var(--ease-out);
    --transition-bounce: var(--duration-slow) cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* === 레이아웃 시스템 === */
:root {
    /* 컨테이너 */
    --container-sm: 640px;
    --container-md: 768px;
    --container-lg: 1024px;
    --container-xl: 1280px;
    --container-2xl: 1536px;
    --container-max: 1920px;

    /* 최대 너비 */
    --max-width-xs: 20rem;
    --max-width-sm: 24rem;
    --max-width-md: 28rem;
    --max-width-lg: 32rem;
    --max-width-xl: 36rem;
    --max-width-2xl: 42rem;
    --max-width-3xl: 48rem;
    --max-width-4xl: 56rem;
    --max-width-5xl: 64rem;
    --max-width-6xl: 72rem;
    --max-width-7xl: 80rem;
    --max-width-full: 100%;

    /* z-index */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
    --z-toast: 1080;
}

/* === 반응형 breakpoint === */
:root {
    --breakpoint-sm: 640px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 1024px;
    --breakpoint-xl: 1280px;
    --breakpoint-2xl: 1536px;
}

/* === 애니메이션 키프레임 === */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(-25%);
        animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
    }
    50% {
        transform: none;
        animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
    }
}

/* === 유틸리티 클래스용 변수 === */
:root {
    /* 디스플레이 */
    --display-none: none;
    --display-block: block;
    --display-inline: inline;
    --display-inline-block: inline-block;
    --display-flex: flex;
    --display-inline-flex: inline-flex;
    --display-grid: grid;

    /* 포지션 */
    --position-static: static;
    --position-fixed: fixed;
    --position-absolute: absolute;
    --position-relative: relative;
    --position-sticky: sticky;

    /* 오버플로우 */
    --overflow-auto: auto;
    --overflow-hidden: hidden;
    --overflow-visible: visible;
    --overflow-scroll: scroll;

    /* 텍스트 정렬 */
    --text-left: left;
    --text-center: center;
    --text-right: right;
    --text-justify: justify;

    /* 플렉스 */
    --flex-row: row;
    --flex-col: column;
    --flex-wrap: wrap;
    --flex-nowrap: nowrap;

    /* 정렬 */
    --justify-start: flex-start;
    --justify-center: center;
    --justify-end: flex-end;
    --justify-between: space-between;
    --justify-around: space-around;
    --justify-evenly: space-evenly;

    --items-start: flex-start;
    --items-center: center;
    --items-end: flex-end;
    --items-stretch: stretch;
    --items-baseline: baseline;
}

/* === 다크 테마 추가 변수 === */
@media (prefers-color-scheme: dark) {
    :root {
        --color-background: var(--color-black);
        --color-surface: var(--color-surface);
        --color-text: var(--color-text);
    }
}

/* === 라이트 테마 추가 변수 === */
@media (prefers-color-scheme: light) {
    :root {
        --color-background: #f8fafc;
        --color-surface: #ffffff;
        --color-surface-light: #f1f5f9;
        --color-text: #1e293b;
        --color-text-secondary: #475569;
        --color-text-muted: #64748b;
    }
}

/* === 고대비 모드 지원 === */
@media (prefers-contrast: high) {
    :root {
        --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
        --shadow-base: 0 2px 6px 0 rgba(0, 0, 0, 0.3);
        --shadow-md: 0 4px 8px 0 rgba(0, 0, 0, 0.3);
    }
}

/* === 접근성 향상 변수 === */
:root {
    /* 포커스 표시 */
    --focus-ring: 0 0 0 3px rgba(229, 9, 20, 0.5);
    --focus-ring-offset: 2px;

    /* 최소 터치 타겟 크기 */
    --min-touch-target: 44px;

    /* 애니메이션 감소 지원 */
    --animation-duration: var(--duration-slow);
}

@media (prefers-reduced-motion: reduce) {
    :root {
        --animation-duration: 0.01ms;
        --transition-fast: none;
        --transition-base: none;
        --transition-slow: none;
    }

    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
