/* ===================================
   KoreaWave Academy - Common Styles
   =================================== */

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Premium Color Palette */
    --navy-dark: #0f172a;
    --navy: #1e293b;
    --navy-light: #334155;
    --gold: #c9a227;
    --gold-light: #d4af37;
    --gold-pale: #f5e6c4;
    --warm-white: #fafaf9;
    --warm-gray: #57534e;
    --warm-gray-light: #a8a29e;
    --text-dark: #1c1917;
    --text-body: #44403c;
    --border-subtle: #e7e5e4;

    /* Blue Accent */
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;

    /* Responsive Breakpoints */
    --bp-mobile: 480px;
    --bp-tablet: 768px;
    --bp-laptop: 1024px;
    --bp-desktop: 1200px;

    /* Touch Target Minimum */
    --touch-target-min: 44px;

    /* Safe Area Insets (for notched devices) */
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-left: env(safe-area-inset-left, 0px);
    --safe-area-right: env(safe-area-inset-right, 0px);

    /* Mobile Viewport Height Fix */
    --vh: 1vh;
}

html {
    scroll-behavior: smooth;
}

/* Language transition effect */
[data-i18n],
[data-i18n-placeholder],
[data-i18n-title],
[data-i18n-html] {
    transition: opacity 0.15s ease;
}

.lang-switching [data-i18n],
.lang-switching [data-i18n-placeholder],
.lang-switching [data-i18n-title],
.lang-switching [data-i18n-html] {
    opacity: 0;
}

/* Header/Footer loading - prevent flicker */
#header-placeholder,
#footer-placeholder {
    opacity: 0;
    transition: opacity 0.2s ease;
}

#header-placeholder.loaded,
#footer-placeholder.loaded {
    opacity: 1;
}

/* SPA Page Transition */
#page-content {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

#page-content.page-exit {
    opacity: 0;
    transform: translateY(-10px);
}

#page-content.page-enter {
    opacity: 0;
    transform: translateY(10px);
}

html, body {
    width: 100%;
    min-height: 100%;
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    font-weight: 400;
    color: var(--text-dark);
    line-height: 1.6;
    background: var(--warm-white);
    overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--navy-dark);
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

img {
    max-width: 100%;
    height: auto;
}

/* Container */
.container {
    max-width: 1230px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.875rem 1.75rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
}

.btn-gold {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
    color: var(--navy-dark);
    box-shadow: 0 4px 20px rgba(201, 162, 39, 0.3);
}

.btn-gold:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(201, 162, 39, 0.4);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--navy-dark);
    color: var(--navy-dark);
}

.btn-outline:hover {
    background: var(--navy-dark);
    color: white;
}

.btn-glass {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.btn-glass:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Button Focus Styles - Accessibility */
.btn:focus {
    outline: none;
}

.btn:focus-visible {
    outline: 3px solid currentColor;
    outline-offset: 3px;
    opacity: 0.8;
}

.btn-primary:focus-visible {
    outline-color: var(--primary);
}

.btn-gold:focus-visible {
    outline-color: var(--gold);
}

.btn-outline:focus-visible {
    outline-color: var(--navy-dark);
}

.btn-glass:focus-visible {
    outline-color: rgba(255, 255, 255, 0.8);
}

/* General Focus-Visible for Interactive Elements */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:not([tabindex="-1"]):focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Section Common */
.section {
    padding: 5rem 0;
}

.section-inner {
    max-width: 1230px;
    margin: 0 auto;
    padding: 0 20px;
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
    color: var(--navy-dark);
    padding: 0.5rem 1.2rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 1rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.section-header h2 {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--navy-dark);
    margin-bottom: 1rem;
    letter-spacing: -0.5px;
}

.section-header p {
    color: var(--warm-gray);
    font-size: 1.05rem;
    max-width: 550px;
    margin: 0 auto;
    line-height: 1.7;
}

/* Page Title Banner */
.page-title-banner {
    background:
        url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E"),
        linear-gradient(135deg, #5a9be8 0%, #4A90D9 50%, #3d7cc7 100%);
    background-size: cover;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    color: white;
    text-align: center;
}

.page-title-banner h1 {
    color: #fff;
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.page-title-banner p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    list-style: none;
}

.breadcrumb li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

.breadcrumb li a {
    color: rgba(255, 255, 255, 0.8);
}

.breadcrumb li a:hover {
    color: white;
}

.breadcrumb .separator {
    color: rgba(255, 255, 255, 0.5);
}

/* Card Common */
.card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--border-subtle);
    overflow: hidden;
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1);
}

/* Form Elements */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

/* Utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.hidden { display: none !important; }

/* Responsive */
@media (max-width: 1024px) {
    .section-header h2 {
        font-size: 1.8rem;
    }
}

@media (max-width: 768px) {
    html, body {
        font-size: 15px;
    }

    .section {
        padding: 3rem 0;
    }

    .section-header h2 {
        font-size: 1.6rem;
    }

    .page-title-banner h1 {
        font-size: 1.8rem;
    }

    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .section-inner {
        padding: 0 15px;
    }
}

/* ===================================
   Accessibility & Motion Preferences
   =================================== */

/* Reduced Motion - for users who prefer less animation */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    html {
        scroll-behavior: auto;
    }

    /* Allow essential animations to still work slightly */
    .mobile-menu-panel,
    .mobile-menu-overlay {
        transition: opacity 0.1s ease !important;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --border-subtle: #000;
    }

    .btn {
        border: 2px solid currentColor;
    }

    .card {
        border-width: 2px;
    }
}

/* ===================================
   Touch Target & Mobile Enhancements
   =================================== */

/* Ensure minimum touch target size (44x44px) */
@media (pointer: coarse) {
    /* Navigation links on mobile */
    .mobile-nav a {
        min-height: var(--touch-target-min);
        display: flex;
        align-items: center;
    }

    /* Buttons */
    .btn {
        min-height: var(--touch-target-min);
    }

    /* Form elements */
    .form-group input,
    .form-group select,
    .form-group textarea {
        min-height: var(--touch-target-min);
    }

    /* Links in content areas - add padding for easier tapping */
    .card a,
    .footer-column a {
        padding: 8px 0;
        display: inline-block;
    }

    /* Language dropdown items */
    .lang-dropdown li a,
    .mobile-lang-list li a {
        min-height: var(--touch-target-min);
    }
}

/* Safe Area Padding for notched devices (iPhone X+) */
@supports (padding: env(safe-area-inset-bottom)) {
    .mobile-menu-panel {
        padding-bottom: calc(20px + var(--safe-area-bottom));
    }

    .footer {
        padding-bottom: calc(2rem + var(--safe-area-bottom));
    }

    /* Fixed bottom elements */
    .fixed-bottom-bar {
        padding-bottom: var(--safe-area-bottom);
    }
}

/* ===================================
   Mobile Viewport Height Fix
   =================================== */

/* Full height that accounts for mobile browser chrome */
.full-height {
    height: 100vh;
    height: calc(var(--vh, 1vh) * 100);
}

.min-full-height {
    min-height: 100vh;
    min-height: calc(var(--vh, 1vh) * 100);
}

/* ===================================
   Mobile Utility Classes
   =================================== */

/* Hide on mobile */
@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
}

/* Hide on desktop */
@media (min-width: 769px) {
    .hide-desktop {
        display: none !important;
    }
}

/* Stack on mobile (flex column) */
@media (max-width: 768px) {
    .stack-mobile {
        flex-direction: column !important;
    }

    .stack-mobile > * {
        width: 100% !important;
    }
}

/* Text alignment on mobile */
@media (max-width: 768px) {
    .text-center-mobile {
        text-align: center !important;
    }
}

/* Full width on mobile */
@media (max-width: 768px) {
    .full-width-mobile {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* Smaller spacing on mobile */
@media (max-width: 768px) {
    .gap-sm-mobile {
        gap: 0.5rem !important;
    }
}

/* ===================================
   Print Styles
   =================================== */

@media print {
    .header-wrapper,
    .footer,
    .mobile-menu-btn,
    .mobile-menu-panel,
    .btn {
        display: none !important;
    }

    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
        background: #fff;
    }

    a {
        color: #000;
        text-decoration: underline;
    }

    .container {
        max-width: 100%;
        padding: 0;
    }
}
