/* ========================================
   MettShort - Core Styles
   Variables, reset, header, footer, pagination, error, responsive
   ======================================== */

/* ========== Base: Variables & Reset ========== */
:root {
    --bg-primary: #000000;
    --bg-secondary: #0f0f0f;
    --bg-card: #1a1a1a;
    --bg-hover: #252525;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;
    --accent: #e83a57;
    --accent-hover: #ff4d6a;
    --border: #222222;
    --radius: 6px;
    --radius-lg: 10px;
    --shadow: 0 4px 24px rgba(0,0,0,0.5);
    --max-width: 1400px;
    --header-height: 56px;
    --transition: all 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; transition: var(--transition); }
img { max-width: 100%; display: block; }

/* Lazy Load */
.lazy-img {
    opacity: 0;
}
.lazy-img.lazy-loaded {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 16px;
}

/* Common layout: main fills remaining space, footer sticks to bottom */
main {
    flex: 1;
}

/* Common Buttons */
.btn-primary {
    display: inline-block;
    padding: 12px 32px;
    background: var(--accent);
    color: white;
    border-radius: 24px;
    font-size: 15px;
    font-weight: 600;
    transition: var(--transition);
}
.btn-primary:hover { background: var(--accent-hover); transform: scale(1.02); }

.btn-secondary {
    display: inline-block;
    padding: 10px 24px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
}
.btn-secondary:hover { background: var(--bg-hover); }

/* VIP Badge (small) */
.vip-badge-sm {
    display: inline-block;
    background: linear-gradient(135deg, #ffc107, #ff9800);
    color: #000;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    vertical-align: middle;
}

/* ========== Header ========== */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(0,0,0,0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    height: var(--header-height);
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    height: 100%;
    gap: 28px;
}

.logo {
    font-size: 20px;
    font-weight: 900;
    white-space: nowrap;
    letter-spacing: -0.5px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #a855f7, #6366f1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.logo-img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.nav { display: flex; gap: 24px; flex-shrink: 0; }
.nav-link {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 4px 0;
    white-space: nowrap;
}
.nav-link:hover, .nav-link.active { color: var(--text-primary); }

/* Header Right */
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    flex-shrink: 0;
}

.header-icon-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: var(--transition);
    text-decoration: none;
    font-size: 10px;
}
.header-icon-link:hover { color: var(--text-primary); }
.header-icon-link span { font-size: 10px; font-weight: 500; }

/* User Avatar */
.user-menu { position: relative; }
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition);
}
.user-avatar:hover { border-color: var(--accent); }
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-avatar-guest {
    background: var(--bg-hover);
    color: var(--text-secondary);
    border: 1.5px solid var(--border);
}
.user-avatar-guest:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    padding: 4px;
    flex-shrink: 0;
    order: -1;
}
.menu-toggle span {
    width: 20px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: var(--transition);
}

/* ========== Footer ========== */
.footer {
    margin-top: 40px;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}
.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 40px 24px 20px;
}
.footer-links {
    display: flex;
    gap: 48px;
    margin-bottom: 32px;
}
.footer-links h4 { font-size: 13px; font-weight: 700; margin-bottom: 12px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.footer-links a { display: block; font-size: 13px; color: var(--text-muted); padding: 3px 0; }
.footer-links a:hover { color: var(--text-primary); }

.footer-copy { font-size: 12px; color: var(--text-muted); border-top: 1px solid var(--border); padding-top: 20px; }

/* ========== Pagination ========== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 24px 0;
}
.page-btn {
    padding: 8px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}
.page-btn:hover, .page-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}
.page-dots { padding: 8px 6px; color: var(--text-muted); }

/* ========== Error Page ========== */
.error-page {
    text-align: center;
    padding: 80px 16px;
}
.error-page h1 { font-size: 80px; font-weight: 800; color: var(--accent); }
.error-page p { font-size: 18px; color: var(--text-secondary); margin: 16px 0 24px; }

/* ========== Responsive ========== */
@media (max-width: 1024px) {
    .drama-grid { grid-template-columns: repeat(4, 1fr); }
    .slider-card { width: 148px; }
}

@media (max-width: 768px) {
    .nav { display: none; }
    .menu-toggle { display: flex; }

    .header-inner {
        position: relative;
        padding: 0 16px;
        gap: 0;
    }
    .logo {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        font-size: 18px;
    }

    .header.menu-open .nav {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        background: var(--bg-primary);
        padding: 16px 24px;
        border-bottom: 1px solid var(--border);
        gap: 12px;
    }

    .header-right .header-icon-link span { display: none; }
    .header-right .header-icon-link:nth-child(2) { display: none; }

    .hero-carousel { height: 50vh; min-height: 320px; max-height: 400px; }
    .carousel-content { padding-bottom: 60px; }
    .carousel-title { font-size: 24px; }
    .carousel-play { padding: 10px 28px; font-size: 14px; }
    .carousel-arrow { width: 40px; height: 40px; display: none; }
    .carousel-prev { left: 12px; }
    .carousel-next { right: 12px; }

    .floor-container { padding: 0 16px; }

    .drama-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
    .detail-hero { flex-direction: column; gap: 16px; }
    .detail-cover { width: 160px; align-self: center; }
    .detail-title { font-size: 22px; }

    .auth-card { padding: 28px 20px; }
    .auth-title { font-size: 20px; }

    .user-profile-card { flex-direction: column; text-align: center; padding: 24px 16px; }
}

@media (max-width: 480px) {
    .drama-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .card-info { padding: 6px 8px; }
    .card-title { font-size: 12px; }
    .detail-cover { width: 140px; }
    .hero-carousel { height: 45vh; min-height: 280px; }
    .carousel-title { font-size: 20px; }
    .carousel-play { padding: 10px 24px; }
    .carousel-dots { right: 16px; bottom: 20px; }
}
