@import url('colors_and_type.css');

* { box-sizing: border-box; }

html {
    color-scheme: dark;
    overflow-x: hidden; /* full-bleed 요소(margin: 0 calc(50% - 50vw))가 세로 스크롤바 너비만큼 우측으로 삐져나오는 현상 방지 */
}

body {
    margin: 0;
    font-family: var(--font-body);
    color: var(--fg);
    background: var(--bg);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

::selection { background: var(--accent); color: #0e0b1a; }

a { color: inherit; }

img { display: block; max-width: 100%; }

/* ── Layout ────────────────────────────────────────── */
.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 1.5rem;
}

main.container {
    padding-top: 2rem;
    padding-bottom: 5rem;
}

@media (max-width: 720px) {
    main.container {
        padding-top: 1.25rem;
        padding-bottom: calc(var(--tab-bar-h) + 2rem);
    }
}

/* ── Header ────────────────────────────────────────── */
.site-header {
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border-gold);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 30;
    backdrop-filter: blur(12px);
    background: rgba(16, 15, 28, 0.92);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: var(--accent);
}

.brand-logo {
    height: 100px;
    width: auto;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.header-username {
    color: var(--fg-muted);
    font-size: 0.84rem;
    font-weight: 500;
}

@media (max-width: 720px) {
    .brand-logo { height: 70px; }
    .header-username { display: none; }
    .header-user .btn { display: none; }
    .header-user .header-avatar { display: inline-flex; }
    .header-user .header-login-btn { display: inline-flex; }
}

.header-avatar {
    display: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-bg-strong);
    color: var(--accent);
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-family: var(--font-display);
    font-size: var(--fs-lg);
    border: 1px solid var(--border-gold);
    text-decoration: none;
}

/* ── Bottom tab bar (mobile) ──────────────────────── */
.tab-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--tab-bar-h);
    background: rgba(13, 12, 26, 0.96);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-gold);
    z-index: 40;
    padding: 0.25rem 0.5rem calc(0.25rem + env(safe-area-inset-bottom, 0));
    transition: transform 0.3s ease;
}

.tab-bar--hidden {
    transform: translateY(100%);
}

.tab-bar-inner {
    display: flex;
    height: 100%;
    align-items: stretch;
    max-width: 480px;
    margin: 0 auto;
}

.tab-link {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-decoration: none;
    color: var(--fg-dim);
    font-size: 0.68rem;
    letter-spacing: 0.02em;
    transition: color 0.15s;
    min-height: 48px;
    padding: 6px 4px;
    position: relative;
}

.tab-link svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.7;
}

.tab-link.active {
    color: var(--accent);
}

.tab-link.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 2px;
    background: var(--accent);
    border-radius: 0 0 3px 3px;
}

.tab-link.tab-add {
    color: var(--bg);
    position: relative;
}
.tab-link.tab-add .tab-add-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(232, 184, 75, 0.4);
    margin-bottom: 0;
}
.tab-link.tab-add .tab-add-circle svg { stroke: var(--bg); width: 22px; height: 22px; }
.tab-link.tab-add .label { color: var(--fg-dim); margin-top: 2px; }

@media (max-width: 720px) {
    .tab-bar { display: block; }
    .site-header { padding: 0.5rem 0; }
}

/* ── Footer ────────────────────────────────────────── */
.site-footer {
    margin-top: 5rem;
    padding: 2rem 0 2.5rem;
    border-top: 1px solid var(--border);
    color: var(--fg-faint);
    text-align: center;
    font-size: var(--fs-meta);
}

.tmdb-attribution {
    max-width: 540px;
    margin: 0 auto 1.25rem;
    padding: 0 1rem;
    line-height: 1.5;
    color: var(--fg-faint);
}

.tmdb-attribution img { margin: 0 auto 0.5rem; }
.tmdb-attribution p { margin: 0.2rem 0; }

@media (max-width: 720px) {
    .site-footer {
        margin-bottom: var(--tab-bar-h);
    }
}

/* ── Buttons ───────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.1rem;
    min-height: 44px;
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    font-size: var(--fs-sm);
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, filter 0.15s,
                background-color 0.15s, border-color 0.15s, color 0.15s;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    color: #0e0b1a;
    box-shadow: 0 2px 12px rgba(232, 184, 75, 0.25);
}
.btn-primary:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 4px 22px rgba(232, 184, 75, 0.42);
}

.btn-secondary {
    background: transparent;
    color: var(--fg-muted);
    border-color: var(--border-strong);
}
.btn-secondary:hover {
    border-color: var(--border-gold-mid);
    color: var(--fg);
    background: var(--accent-bg);
}

.btn-ghost {
    background: transparent;
    color: var(--fg-muted);
    border-color: transparent;
}
.btn-ghost:hover { color: var(--fg); background: var(--accent-bg); }

.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover { background: var(--danger-hover); }

.btn-block { width: 100%; }
.btn-sm { padding: 0.4rem 0.85rem; font-size: var(--fs-fine); min-height: 36px; }

/* ── Forms ─────────────────────────────────────────── */
.form-control,
.form-field input[type="text"],
.form-field input[type="date"],
.form-field input[type="password"],
.form-field textarea {
    display: block;
    width: 100%;
    padding: 0.8rem 1rem;
    min-height: 48px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    color: var(--fg);
    font-size: var(--fs-lg);
    font-family: inherit;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.form-field textarea {
    min-height: 110px;
    resize: vertical;
    line-height: 1.6;
}

input[type="date"].form-control { min-width: 0; max-width: 100%; }
.form-group-date {
    min-width: 0;
}

.form-control:focus,
.form-field input:focus,
.form-field textarea:focus {
    outline: none;
    border-color: var(--border-gold-mid);
    background: rgba(232, 184, 75, 0.04);
    box-shadow: 0 0 0 3px rgba(232, 184, 75, 0.12);
}

.form-control::placeholder,
.form-field input::placeholder,
.form-field textarea::placeholder {
    color: var(--fg-faint);
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.label,
.form-field label,
.form-group label {
    font-size: var(--fs-label);
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--fg-muted);
}

.form-group { margin-bottom: 1.15rem; }

.field-error {
    color: var(--error);
    font-size: var(--fs-fine);
}

.field-hint {
    display: block;
    font-size: var(--fs-meta);
    margin-top: 0.4rem;
    color: var(--fg-dim);
    min-height: 1.1em;
}
.field-hint.field-success { color: var(--success); }
.field-hint.field-error { color: #ff8585; }

.char-counter {
    text-align: right;
    color: var(--fg-faint);
    font-size: var(--fs-2xs);
    font-variant-numeric: tabular-nums;
}


/* ── Flash ────────────────────────────────────────── */
.flash-message {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    color: var(--success);
    padding: 0.75rem 1rem;
    border-radius: var(--r-sm);
    margin-bottom: 1.25rem;
    font-size: var(--fs-sm);
}
.flash-message.error {
    background: rgba(255, 100, 100, 0.08);
    border-color: rgba(255, 100, 100, 0.25);
    color: #ff8585;
}


/* ── Error pages ──────────────────────────────────── */
.error-scene {
    min-height: calc(100vh - 240px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
    position: relative;
}
.error-card {
    max-width: 520px;
    width: 100%;
}
.error-code {
    font-family: var(--font-display);
    font-size: clamp(5rem, 4rem + 6vw, 8rem);
    font-weight: 700;
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-dark) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
    letter-spacing: -0.04em;
    margin: 0;
    text-shadow: 0 0 60px rgba(232, 184, 75, 0.15);
}
.error-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    margin: 0.6rem 0 0.6rem;
    color: var(--fg);
    font-weight: 600;
}
.error-desc {
    color: var(--fg-muted);
    font-size: var(--fs-lg);
    margin: 0 0 1.75rem;
    line-height: 1.6;
}
.error-actions {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ── Bolder variation overrides (variation B) ──── */
.variant-bold {
    --grid-cols: 4;
}
.variant-bold .site-header {
    background: linear-gradient(180deg, #15131f 0%, rgba(16, 15, 28, 0.92) 100%);
}
.variant-bold .toolbar h1 {
    font-size: clamp(2rem, 1.4rem + 2vw, 2.8rem);
    background: linear-gradient(180deg, var(--fg) 0%, rgba(240, 235, 224, 0.7) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.variant-bold .movie-card.style-side {
    background: linear-gradient(158deg, #1a1828 0%, #131220 100%);
}
.variant-bold .movie-card.style-side:hover {
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6),
                0 0 0 1px var(--border-gold-mid),
                0 0 60px rgba(232, 184, 75, 0.06);
}
.variant-bold .movie-thumb-rating {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #0e0b1a;
    border: none;
}
.variant-bold .stat-value {
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-dark) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.variant-bold .auth-container {
    background:
        linear-gradient(158deg, #221f33 0%, #131220 100%),
        radial-gradient(circle at 20% 0%, rgba(232, 184, 75, 0.12), transparent 60%);
    background-blend-mode: screen;
}


/* ── Header Search ─────────────────────────────────── */
.header-search {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.header-search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--border-gold);
    border-radius: 9999px;
    color: var(--fg);
    font-size: var(--fs-sm);
    padding: 0.4rem 2.4rem 0.4rem 1rem;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}

.header-search-input:focus {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.11);
}

.header-search-input::placeholder {
    color: var(--fg);
    opacity: 0.4;
}

.header-search-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--bg-alt);
    border: 1px solid var(--border-gold);
    border-radius: 12px;
    overflow: hidden;
    z-index: 100;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.header-search-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.85rem;
    text-decoration: none;
    color: var(--fg);
    transition: background 0.15s;
}

.header-search-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.header-search-thumb {
    width: 36px;
    height: 54px;
    object-fit: cover;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}

.header-search-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.header-search-title {
    font-size: var(--fs-sm);
    font-weight: 500;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.header-search-meta {
    font-size: var(--fs-2xs);
    opacity: 0.5;
}

.header-search-more {
    display: block;
    text-align: center;
    padding: 0.55rem;
    font-size: var(--fs-fine);
    color: var(--accent);
    text-decoration: none;
    border-top: 1px solid var(--border-gold);
    transition: background 0.15s;
}

.header-search-more:hover {
    background: rgba(255, 255, 255, 0.04);
}

.header-search-btn {
    position: absolute;
    right: 0.6rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: var(--fg);
    opacity: 0.45;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.15s;
    line-height: 1;
}

.header-search-btn:hover {
    opacity: 1;
}

.header-search-item--active {
    background: rgba(255, 255, 255, 0.08);
    outline: 1px solid rgba(255, 255, 255, 0.12);
    outline-offset: -1px;
}


.media-type-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: rgba(0, 0, 0, 0.75);
    color: var(--accent);
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    letter-spacing: 0.03em;
}

/* ── Hamburger toggle ── */
.menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--fg);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}

.menu-toggle:hover {
    background: var(--accent-bg);
    color: var(--accent);
}

@media (max-width: 720px) {
    .site-header .menu-toggle { display: none; }
}

/* ── Drawer overlay ── */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 45;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

body.drawer-open .drawer-overlay {
    opacity: 1;
    pointer-events: auto;
}

/* ── Side drawer ── */
.side-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100dvh;
    background: var(--bg-alt);
    border-right: 1px solid var(--border-gold);
    z-index: 50;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
}

body.drawer-open .side-drawer {
    transform: translateX(0);
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: 56px;
    border-bottom: 1px solid var(--border-gold);
    flex-shrink: 0;
}

.drawer-title {
    font-size: var(--fs-md);
    font-weight: 600;
    color: var(--fg-muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.drawer-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--fg-dim);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.drawer-close:hover {
    background: var(--accent-bg);
    color: var(--fg);
}

.drawer-nav {
    display: flex;
    flex-direction: column;
    padding: 12px 0;
}

.drawer-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--fg);
    text-decoration: none;
    font-size: var(--fs-lg);
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.drawer-link:hover {
    background: var(--accent-bg);
    color: var(--accent);
}

.drawer-link.active {
    background: var(--accent-bg-strong);
    color: var(--accent);
    border-left-color: var(--accent);
}
