/* ============================================================
   Fitrip — common.css  v6
   라이트: Bold Explorer (네오브루탈리즘 에디토리얼)
   다크:   Dark Voyage (앰버 글로우)
   ============================================================ */

/* ── 1. CSS 변수 — 라이트 기본값 ─────────────────────────── */
:root {
    /* 브랜드 */
    --brand:        #ff4e00;
    --brand-hover:  #e63d00;
    --brand-soft:   rgba(255, 78, 0, 0.08);
    --brand-text:   #ffffff;

    /* 보조 색상 */
    --accent:       #0a2463;

    /* 상태 */
    --success:      #22c55e;
    --warning:      #f59e0b;
    --danger:       #ef4444;

    /* 배경 */
    --bg-body:      #fafaf8;
    --bg-surface:   #ffffff;
    --bg-surface-2: #f5f5f2;
    --bg-surface-3: #ececea;
    --bg-navbar:    #fafaf8;   /* 라이트: 바디와 동일 */

    /* 텍스트 */
    --text-1:       #0a0a0a;
    --text-2:       #4a4a4a;
    --text-3:       #9a9a9a;

    /* 테두리 */
    --border:        #d8d8d4;
    --border-strong: #b8b8b4;

    /* 그림자 — 하드 오프셋 (네오브루탈리즘) */
    --shadow-sm:    4px 4px 0 rgba(10, 36, 99, 0.08);
    --shadow-md:    8px 8px 0 rgba(10, 36, 99, 0.08);
    --shadow-lg:   12px 12px 0 rgba(10, 36, 99, 0.08);
    --shadow-brand: 6px 6px 0 rgba(255, 78, 0, 0.28);

    /* 반경 — 에디토리얼 직각 */
    --radius-sm:   2px;
    --radius-md:   4px;
    --radius-lg:   6px;
    --radius-pill: 999px;

    /* 레이아웃 */
    --navbar-h: 64px;

    /* ── 하위 호환 별칭 ── */
    --primary:       #ff4e00;
    --primary-dark:  #e63d00;
    --primary-soft:  rgba(255, 78, 0, 0.08);
    --text-main:     #0a0a0a;
    --text-sub:      #4a4a4a;
    --text-muted:    #9a9a9a;
    --bg-card:       #ffffff;
    --border-subtle: #d8d8d4;
    --shadow-card:   8px 8px 0 rgba(10, 36, 99, 0.08);
    --shadow-soft:   12px 12px 0 rgba(10, 36, 99, 0.08);
    --shadow-strong: 6px 6px 0 rgba(255, 78, 0, 0.28);
}

/* ── 1-B. CSS 변수 — 다크 오버라이드 ────────────────────── */
[data-theme="dark"] {
    /* 브랜드 */
    --brand:        #f5a623;
    --brand-hover:  #e8891a;
    --brand-soft:   rgba(245, 166, 35, 0.10);
    --brand-text:   #080e1d;

    /* 보조 색상 */
    --accent:       #e05c5c;

    /* 배경 */
    --bg-body:      #080e1d;
    --bg-surface:   #0f1929;
    --bg-surface-2: #151f32;
    --bg-surface-3: #1c2a42;
    --bg-navbar:    #080e1d;

    /* 텍스트 */
    --text-1:       #f1f5f9;
    --text-2:       #94a3b8;
    --text-3:       #64748b;

    /* 테두리 */
    --border:        rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);

    /* 그림자 — 앰버 글로우 + 하드 오프셋 */
    --shadow-sm:    0 0 16px rgba(245, 166, 35, 0.08), 3px 3px 0 rgba(245, 166, 35, 0.12);
    --shadow-md:    0 0 30px rgba(245, 166, 35, 0.10), 6px 6px 0 rgba(245, 166, 35, 0.15);
    --shadow-lg:    0 0 50px rgba(245, 166, 35, 0.12), 8px 8px 0 rgba(245, 166, 35, 0.18);
    --shadow-brand: 0 0 24px rgba(245, 166, 35, 0.30), 5px 5px 0 rgba(245, 166, 35, 0.25);

    /* 하위 호환 별칭 */
    --primary:      #f5a623;
    --primary-dark: #e8891a;
    --primary-soft: rgba(245, 166, 35, 0.10);
    --text-main:    #f1f5f9;
    --text-sub:     #94a3b8;
    --text-muted:   #64748b;
    --bg-card:      #0f1929;
    --border-subtle: rgba(255, 255, 255, 0.08);
    --shadow-card:  0 0 30px rgba(245, 166, 35, 0.10), 6px 6px 0 rgba(245, 166, 35, 0.15);
    --shadow-soft:  0 0 50px rgba(245, 166, 35, 0.12), 8px 8px 0 rgba(245, 166, 35, 0.18);
    --shadow-strong: 0 0 24px rgba(245, 166, 35, 0.30), 5px 5px 0 rgba(245, 166, 35, 0.25);

    color-scheme: dark;
}

/* ── 2. 리셋 ──────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

* {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

html {
    scroll-behavior: smooth;
    background: var(--bg-body);
    transition: background 0.35s ease;
}

/* ── 3. Body ──────────────────────────────────────────────── */
body {
    background: var(--bg-body);
    color: var(--text-1);
    padding-top: var(--navbar-h);
    line-height: 1.65;
    min-height: 100vh;
    overflow-x: clip;
    transition: background 0.35s ease, color 0.35s ease;
}

/* ── 4. Navbar — Hard Edge ────────────────────────────────── */
.navbar {
    position: fixed;
    inset: 0 0 auto 0;
    height: var(--navbar-h);
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-navbar);
    border-bottom: 2px solid var(--brand);
    z-index: 1000;
    transition: background 0.35s ease;
}

/* 스크롤 시 그림자 */
.navbar.scrolled {
    box-shadow: 0 2px 0 var(--border);
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 32px;
}

.navbar-right,
.navbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── 5. 로고 — 순수 타이포 ────────────────────────────────── */
.logo {
    display: flex;
    align-items: center;
    gap: 0;
    font-size: 1.35rem;
    font-weight: 900;
    letter-spacing: -0.04em;
    color: var(--brand);
    cursor: pointer;
    text-decoration: none;
    user-select: none;
    text-transform: uppercase;
}

/* 아이콘 박스 숨김 — 타이포 로고로 전환 */
.logo-icon {
    display: none;
}

/* "rip" accent — 전체가 brand 색상이므로 inherit */
.logo-accent {
    color: inherit;
}

/* FITRIP. — 마침표 */
.logo > span:last-child::after {
    content: '.';
}

/* ── 6. 내비 링크 ─────────────────────────────────────────── */
.nav-desktop-only { display: inline-flex; }
.nav-mobile-only  { display: none; }

.nav-link {
    text-decoration: none;
    color: var(--text-2);
    font-weight: 700;
    font-size: 0.9rem;
    padding: 5px 10px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    border-radius: var(--radius-md);
    transition: color 0.15s ease, background 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.nav-link:hover {
    color: var(--brand);
    background: var(--brand-soft);
}


/* ── 7. 버튼 — Primary ────────────────────────────────────── */
.btn-primary {
    padding: 11px 24px;
    border-radius: var(--radius-md);
    border: none;
    background: var(--brand);
    color: var(--brand-text);
    font-size: 0.95rem;
    font-weight: 900;
    cursor: pointer;
    letter-spacing: 0.01em;
    box-shadow: var(--shadow-brand);
    transition:
        background 0.15s ease,
        transform 0.15s cubic-bezier(0.22, 0.61, 0.36, 1),
        box-shadow 0.15s ease;
}

.btn-primary:hover {
    background: var(--brand-hover);
    transform: translate(-2px, -2px);
    box-shadow: 8px 8px 0 rgba(255, 78, 0, 0.28);
}

[data-theme="dark"] .btn-primary {
    color: #080e1d;
}

[data-theme="dark"] .btn-primary:hover {
    box-shadow: 0 0 40px rgba(245, 166, 35, 0.4);
    transform: translate(0, -2px);
}

/* ── 8. 버튼 — Secondary ──────────────────────────────────── */
.btn-secondary,
.btn-login {
    height: 40px;
    padding: 0 20px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-strong);
    background: var(--bg-surface);
    color: var(--text-1);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    transition:
        border-color 0.15s ease,
        background 0.15s ease,
        color 0.15s ease,
        transform 0.15s ease,
        box-shadow 0.15s ease;
}

.btn-secondary:hover,
.btn-login:hover {
    border-color: var(--brand);
    color: var(--brand);
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0 rgba(255, 78, 0, 0.20);
}

/* ── 9. 버튼 — Ghost ──────────────────────────────────────── */
.btn-ghost {
    padding: 8px 14px;
    border-radius: var(--radius-md);
    border: none;
    background: transparent;
    color: var(--text-2);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.btn-ghost:hover {
    background: var(--brand-soft);
    color: var(--brand);
}

/* ── 10. 버튼 — 아이콘 사각형 ────────────────────────────── */
.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.92rem;
    transition:
        background 0.15s ease,
        color 0.15s ease,
        border-color 0.15s ease,
        transform 0.15s ease,
        box-shadow 0.15s ease;
}

.btn-icon:hover {
    background: var(--brand-soft);
    color: var(--brand);
    border-color: var(--brand);
    transform: translate(-2px, -2px);
    box-shadow: var(--shadow-sm);
}

.btn-icon.delete {
    background: rgba(239, 68, 68, 0.06);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.25);
}

.btn-icon.delete:hover {
    background: var(--danger);
    color: #ffffff;
    border-color: var(--danger);
    transform: translate(-2px, -2px);
}

.btn-icon.active {
    background: var(--brand-soft);
    color: var(--brand);
    border-color: var(--brand);
}

/* ── 11. 버튼 — 작은 사각형 (btn-circle 대체) ────────────── */
.btn-circle {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    flex-shrink: 0;
    align-self: center;
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    cursor: pointer;
    background: var(--bg-surface);
    color: var(--text-2);
    transition:
        transform 0.15s ease,
        background 0.15s ease,
        color 0.15s ease,
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

.btn-circle:active {
    transform: translate(2px, 2px);
    box-shadow: none;
}

.btn-plus {
    background: var(--brand);
    color: var(--brand-text);
    border-color: var(--brand);
    box-shadow: var(--shadow-brand);
}

.btn-plus:hover {
    background: var(--brand-hover);
    border-color: var(--brand-hover);
    transform: translate(-2px, -2px);
}

.btn-trash {
    color: var(--text-3);
}

.btn-trash:hover {
    background: rgba(239, 68, 68, 0.07);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
}

/* ── 12. 필터 버튼 ────────────────────────────────────────── */
.pill {
    padding: 8px 16px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-2);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease,
        transform 0.12s ease,
        box-shadow 0.15s ease;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
}

.pill:hover {
    border-color: var(--text-1);
    color: var(--text-1);
    transform: translate(-2px, -2px);
    box-shadow: var(--shadow-sm);
}

.pill.active {
    background: var(--brand);
    border-color: var(--brand);
    color: var(--brand-text);
    box-shadow: var(--shadow-brand);
}

.pill.active:hover {
    background: var(--brand-hover);
    border-color: var(--brand-hover);
    transform: translate(-2px, -2px);
}


/* ── 13. Beta 배지 ────────────────────────────────────────── */
.beta-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--brand-soft);
    border: 2px solid var(--brand);
    border-radius: var(--radius-md);
    font-size: 0.72rem;
    font-weight: 900;
    color: var(--brand);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.beta-badge .pulse {
    width: 5px;
    height: 5px;
    background: var(--brand);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.5; transform: scale(1.4); }
}

/* ── 14. 입력 필드 ────────────────────────────────────────── */
.input-box {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
    background: var(--bg-surface);
    font-size: 0.97rem;
    font-family: inherit;
    color: var(--text-1);
    outline: none;
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

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

.input-box:hover {
    border-color: var(--border-strong);
}

.input-box:focus {
    border-color: var(--brand);
    box-shadow: 4px 4px 0 rgba(255, 78, 0, 0.15);
}

.input-box[readonly] {
    background: var(--bg-surface-2);
    border-color: var(--border);
    color: var(--text-3);
    cursor: default;
}

textarea.input-box {
    resize: none;
    min-height: 120px;
    line-height: 1.7;
}

/* ── 15. 검색 박스 ────────────────────────────────────────── */
.search-box {
    flex: 1;
    min-width: 260px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    height: 48px;
    box-sizing: border-box;
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

.search-box:focus-within {
    border-color: var(--brand);
    box-shadow: 4px 4px 0 rgba(255, 78, 0, 0.15);
}

.search-box i {
    color: var(--text-3);
    flex-shrink: 0;
}

.search-box input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 0.97rem;
    font-family: inherit;
    color: var(--text-1);
}

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

.btn-clear {
    width: 26px;
    height: 26px;
    border-radius: var(--radius-md);
    border: none;
    background: var(--bg-surface-3);
    color: var(--text-3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.78rem;
    transition: background 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
}

.btn-clear:hover {
    background: var(--border-strong);
    color: var(--text-1);
}

/* ── 16. 정렬 박스 ────────────────────────────────────────── */
.sort-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    height: 48px;
    box-sizing: border-box;
    transition: border-color 0.15s ease;
}

.sort-box:focus-within {
    border-color: var(--brand);
}

.sort-box i {
    color: var(--text-3);
    flex-shrink: 0;
}

.sort-box select {
    border: none;
    outline: none;
    background: transparent;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text-1);
    font-weight: 700;
    cursor: pointer;
    height: auto;
    line-height: 1;
    padding: 0;
}

/* ── 17. Toast 알림 ───────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
    border-left-width: 4px;
    border-left-color: var(--border-strong);
    padding: 13px 16px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 9000;
    max-width: 320px;
    transform: translateY(100px);
    opacity: 0;
    transition:
        transform 0.3s cubic-bezier(0.22, 0.61, 0.36, 1),
        opacity 0.3s ease;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

.toast-icon { font-size: 1.1rem; flex-shrink: 0; }

.toast.success .toast-icon { color: var(--success); }
.toast.error   .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }

.toast-message {
    font-size: 0.93rem;
    color: var(--text-1);
    font-weight: 500;
    line-height: 1.4;
}

/* ── 18. 다크모드 토글 버튼 ──────────────────────────────── */
.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-strong);
    background: var(--bg-surface);
    color: var(--text-2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.92rem;
    transition:
        background 0.15s ease,
        color 0.15s ease,
        border-color 0.15s ease,
        transform 0.15s ease,
        box-shadow 0.15s ease;
}

.theme-toggle:hover {
    background: var(--brand-soft);
    color: var(--brand);
    border-color: var(--brand);
    transform: translate(-2px, -2px);
    box-shadow: var(--shadow-sm);
}

/* ── 19. 모바일 (≤ 768px) ─────────────────────────────────── */
@media (max-width: 768px) {
    :root {
        --navbar-h: 54px;
    }

    .navbar {
        padding: 0 16px;
    }

    .navbar-left { gap: 16px; }

    .navbar-right,
    .navbar-actions { gap: 6px; }

    .logo {
        font-size: 1.15rem;
    }

    .btn-primary {
        padding: 9px 18px;
        font-size: 0.9rem;
    }

    .btn-secondary,
    .btn-login {
        height: 36px;
        padding: 0 14px;
        font-size: 0.88rem;
    }

    .btn-icon,
    .theme-toggle {
        width: 36px;
        height: 36px;
        font-size: 0.85rem;
    }

    .btn-circle {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
        font-size: 0.88rem;
    }

    .nav-link {
        font-size: 0.82rem;
        padding: 4px 8px;
    }

    .nav-desktop-only { display: none !important; }
    .nav-mobile-only  { display: inline-flex !important; }

    .beta-badge {
        padding: 3px 8px;
        font-size: 0.65rem;
    }

    .pill {
        padding: 6px 12px;
        font-size: 0.82rem;
    }

    .toast {
        bottom: 16px;
        right: 16px;
        max-width: calc(100vw - 32px);
    }

    .search-box {
        min-width: unset;
        width: 100%;
        height: 44px;
        padding: 8px 12px;
    }

    .sort-box {
        height: 44px;
        padding: 8px 12px;
    }

    .input-box {
        padding: 9px 13px;
        font-size: 0.93rem;
    }
}

/* ── 20. 소형 모바일 (≤ 480px) ───────────────────────────── */
@media (max-width: 480px) {
    .navbar { padding: 0 12px; }
    .navbar-left { gap: 10px; }
    .navbar-right,
    .navbar-actions { gap: 4px; }
    .beta-badge { display: none; }
}
