/* =========================
   CSS Variables & Color Themes
========================= */
:root {
    /* Dark Theme - CrossFit Games Style */
    --bg-primary: #17171c;
    --bg-secondary: #1e1e24;
    --bg-tertiary: #2c2c35;
    --bg-body: #121417;
    --text-primary: #f9fafb;
    --text-secondary: #b0b8c1;
    --text-tertiary: #6b7684;

    /* Brand Colors - CrossFit Lime */
    --accent-primary: #e0fd53;
    --accent-secondary: #c8e019;
    --accent-tertiary: #e8ff7a;
    --crossfit-black: #191f28;
    --crossfit-dark: #333d4b;

    /* Navigation & UI */
    --nav-bg: #1e1e24;
    --nav-active: var(--accent-primary);
    --nav-hover: rgba(224, 253, 83, 0.15);

    /* Buttons */
    --btn-primary: var(--accent-primary);
    --btn-primary-hover: var(--accent-tertiary);
    --btn-secondary: #3c4049;
    --btn-secondary-hover: #4e5968;

    /* Links */
    --link-color: var(--accent-primary);
    --link-hover: var(--accent-secondary);

    /* Borders & Shadows */
    --border-light: rgba(255, 255, 255, 0.08);
    --border-medium: rgba(255, 255, 255, 0.15);
    --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.5);

    /* Font Sizes */
    --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 */

    /* Line Heights */
    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.75;
}

/* =========================
   Accessibility
========================= */
/* Offline Banner */
.offline-banner {
    display: none;
    text-align: center;
    padding: 32px 20px;
    color: var(--text-tertiary);
    font-size: 14px;
    line-height: 1.6;
}

.offline-banner svg {
    display: block;
    margin: 0 auto 12px;
    stroke: var(--text-tertiary);
    opacity: 0.5;
}

.offline-banner strong {
    display: block;
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: fixed;
    top: -100%;
    left: 16px;
    z-index: 9999;
    padding: 12px 24px;
    background: #e0fd53;
    color: #1a1a1a;
    font-weight: 700;
    font-size: 14px;
    border-radius: 0 0 8px 8px;
    text-decoration: none;
    transition: top 0.2s;
}

.skip-link:focus {
    top: 0;
}

/* =========================
   PR History Modal
========================= */
.pr-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.pr-modal {
    background: #1e1e24;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pr-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.pr-modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: #f9fafb;
    margin: 0;
}

.pr-modal-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.pr-modal-body {
    padding: 16px 24px;
    overflow-y: auto;
    flex: 1;
}

.pr-exercise {
    margin-bottom: 16px;
}

.pr-exercise:last-child {
    margin-bottom: 0;
}

.pr-exercise-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.pr-exercise-name {
    font-size: 14px;
    font-weight: 600;
    color: #b0b8c1;
}

.pr-best {
    font-size: 18px;
    font-weight: 800;
    color: #e0fd53;
}

.pr-best.pr-empty {
    color: rgba(255, 255, 255, 0.2);
}

.pr-history-list {
    padding: 4px 0;
}

.pr-history-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
}

.pr-date {
    color: rgba(255, 255, 255, 0.25);
}

.pr-weight {
    color: rgba(255, 255, 255, 0.5);
}

.pr-note {
    color: rgba(255, 255, 255, 0.25);
    font-size: 11px;
    margin-left: 4px;
}

.pr-empty-message {
    text-align: center;
    color: rgba(255, 255, 255, 0.3);
    font-size: 14px;
    padding: 32px 0;
    line-height: 1.8;
}

.pr-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 24px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.pr-clear-btn {
    background: none;
    border: 1px solid rgba(255, 77, 77, 0.4);
    color: #ff4d4d;
    font-size: 12px;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.pr-clear-btn:hover {
    background: rgba(255, 77, 77, 0.1);
    border-color: #ff4d4d;
}

.pr-share-btn {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.3);
    font-size: 12px;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 8px;
}

.pr-share-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* =========================
   Reset & Base Styles
========================= */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);
    margin: 0;
    padding: 0;
    background-color: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
}

.wrapper {
    width: 100%;
    max-width: 1200px;
    margin: 56px auto 0;
    padding: 0 20px;
    background: var(--bg-primary);
    min-height: calc(100vh - 56px);
    box-shadow: var(--shadow-light);
}

.container {
    width: 100%;
    padding: 20px 0;
}

/* 페이지 헤더 */
.page-header {
    text-align: center;
    padding: 32px 0 8px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 800;
    color: #e0fd53;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 8px;
}

.page-header p {
    font-size: 14px;
    color: var(--text-tertiary);
    margin: 0 0 16px;
}

.page-header::after {
    content: '';
    display: block;
    height: 2px;
    background: linear-gradient(90deg, transparent, #e0fd53, transparent);
}

/* =========================
   Typography
========================= */
.container h2,
.movement-group h2,
.exercise-card h2 {
    font-size: var(--font-size-lg);
    margin-bottom: 10px;
    font-weight: 500;
    letter-spacing: -0.2px;
}

/* Description Styles */
.description .info-text {
    font-size: var(--font-size-sm);
    line-height: var(--line-height-relaxed);
    color: var(--text-primary);
}

.description h2 {
    font-size: var(--font-size-xl);
    font-weight: 600;
    margin: 24px 0 12px;
}

.description h3 {
    font-size: var(--font-size-base);
    font-weight: 600;
    margin: 20px 0 10px;
    color: var(--text-primary);
}

.description p {
    margin: 0 0 16px;
    font-size: var(--font-size-sm);
}

.description strong {
    color: var(--accent-primary);
    font-weight: 600;
}

/* Link Styles */
a:not(.nav-item):not(.sidebar-nav-item):not(.hero-btn):not(.feature-card):not(.section-cta):not(.showcase-cta):not(.hl-card-link):not(.apple-stat):not(.footer-link):not(.mega-item):not(.nav-trigger):not(.sidebar-ext-link):not(.header-title) {
    color: var(--link-color);
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 500;
}

a:not(.nav-item):not(.sidebar-nav-item):not(.hero-btn):not(.feature-card):not(.section-cta):not(.showcase-cta):not(.hl-card-link):not(.apple-stat):not(.footer-link):not(.mega-item):not(.nav-trigger):not(.sidebar-ext-link):not(.header-title):hover {
    color: var(--link-hover);
    background-color: rgba(224, 253, 83, 0.1);
    padding: 2px 4px;
    border-radius: 4px;
}

a:not(.nav-item):not(.sidebar-nav-item):not(.hero-btn):not(.feature-card):not(.section-cta):not(.showcase-cta):not(.hl-card-link):not(.apple-stat):not(.footer-link):not(.mega-item):not(.nav-trigger):not(.sidebar-ext-link):not(.header-title):focus {
    outline: 2px solid rgba(224, 253, 83, 0.3);
    outline-offset: 2px;
}

/* Info text specific links */
.info-text a {
    color: var(--link-color);
    border-bottom: 1px solid rgba(224, 253, 83, 0.3);
    padding-bottom: 1px;
}

.info-text a:hover {
    color: var(--link-hover);
    border-bottom-color: rgba(27, 100, 218, 0.6);
    background-color: rgba(224, 253, 83, 0.08);
}

/* =========================
   Form Elements
========================= */
select,
input {
    width: 100%;
    padding: 6px 8px;
    font-size: var(--font-size-sm);
    border: 1px solid var(--border-light);
    border-radius: 4px;
    margin-bottom: 8px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    box-sizing: border-box;
    height: 36px;
}

select:focus,
input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(224, 253, 83, 0.25);
}

input[type="number"] {
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.input-with-unit {
    position: relative;
    display: inline-block;
    width: 100%;
}

.input-with-unit input {
    padding-right: 40px;
    margin-bottom: 0;
}

.unit-display {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: 500;
    pointer-events: none;
}

/* =========================
   Search Box (shared)
========================= */
.search-box {
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 14px 16px 14px 44px;
    border: 1px solid var(--border-medium);
    border-radius: 12px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.search-box input:focus {
    border-color: var(--accent-primary);
}

.search-box input::placeholder {
    color: var(--text-tertiary);
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 43%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    pointer-events: none;
}

.search-count {
    font-size: 13px;
    color: var(--text-tertiary);
}

/* Autocomplete Dropdown */
.search-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-medium);
    border-top: none;
    border-radius: 0 0 12px 12px;
    max-height: 240px;
    overflow-y: auto;
    z-index: 50;
    display: none;
    scrollbar-width: thin;
    scrollbar-color: #444 transparent;
}

.search-autocomplete.show {
    display: block;
}

.search-autocomplete-item {
    padding: 10px 16px 10px 44px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}

.search-autocomplete-item:hover,
.search-autocomplete-item.selected {
    background: rgba(224, 253, 83, 0.08);
    color: var(--text-primary);
}

.search-autocomplete-item mark {
    background: none;
    color: #e0fd53;
    font-weight: 700;
}

.search-autocomplete-item:last-child {
    border-radius: 0 0 12px 12px;
}

.search-box input.autocomplete-open {
    border-radius: 12px 12px 0 0;
}

/* =========================
   Coming Soon (placeholder)
========================= */
.coming-soon {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    padding: 40px 20px;
}

.coming-soon-inner h2 {
    font-size: 32px;
    font-weight: 800;
    color: #e0fd53;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 0 0 16px;
}

.coming-soon-inner p {
    font-size: 16px;
    color: #6b7684;
    margin: 0;
}

/* =========================
   Scroll Top Button (shared)
========================= */
.scroll-top-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent-primary);
    color: #000;
    border: none;
    font-size: 20px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    z-index: 100;
    transition: transform 0.2s;
}

.scroll-top-btn:hover {
    transform: scale(1.1);
}

.scroll-top-btn.visible {
    display: flex;
}

/* =========================
   No Results (shared)
========================= */
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-tertiary);
    font-size: 16px;
    grid-column: 1 / -1;
}

/* =========================
   Toast Messages
========================= */
#toast-container {
    position: fixed;
    left: 50%;
    bottom: 40px;
    transform: translateX(-50%);
    z-index: 9999;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.toast {
    background: var(--accent-primary);
    color: #1a1a1a;
    padding: 10px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
}

/* =========================
   Responsive Styles
========================= */
@media (min-width: 1200px) {
    .wrapper {
        padding: 0 20px;
    }
}

@media (min-width: 768px) and (max-width: 1199px) {
    .wrapper {
        max-width: 900px;
        padding: 0 16px;
        margin-top: 56px;
        min-height: calc(100vh - 56px);
    }

    .container {
        padding: 16px 0;
    }

    .page-header h1 {
        font-size: 22px;
    }

    .description {
        padding: 0 16px 16px;
    }

    .description h2 {
        font-size: var(--font-size-base);
        margin: 20px 0 10px;
    }

    .description h3 {
        font-size: var(--font-size-sm);
        margin: 16px 0 8px;
    }

    .description p {
        margin: 0 0 14px;
        font-size: var(--font-size-sm);
    }
}

@media (max-width: 768px) {
    .wrapper {
        padding: 0 15px;
        margin-top: 48px;
        min-height: calc(100vh - 48px);
    }

    .container {
        padding: 12px 0;
    }

    .description {
        padding: 0 15px 15px;
    }

    .description h2 {
        font-size: var(--font-size-base);
        margin: 18px 0 8px;
    }

    .description h3 {
        font-size: var(--font-size-base);
        margin: 16px 0 6px;
    }

    .description p {
        margin: 0 0 12px;
        font-size: var(--font-size-base);
    }

    #toast-container {
        bottom: 16px;
    }

    .toast {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .wrapper {
        padding: 0 10px;
        margin-top: 48px;
        min-height: calc(100vh - 48px);
    }

    .container {
        padding: 8px 0;
    }

    .page-header h1 {
        font-size: 18px;
    }

    .description {
        padding: 0 10px 10px;
    }

    .description h2 {
        font-size: var(--font-size-sm);
        margin: 14px 0 6px;
    }

    .description h3 {
        font-size: var(--font-size-sm);
        margin: 12px 0 4px;
    }

    .description p {
        margin: 0 0 10px;
        font-size: var(--font-size-sm);
    }

    #toast-container {
        bottom: 12px;
    }

    .toast {
        font-size: 12px;
    }
}

/* PWA 애니메이션 */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

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

.pwa-install-button:hover {
    background: #c8e019 !important;
    transform: scale(1.05);
}
