/* =============================================
   GLOBAL THEME - Rubbrief Platform
   ============================================= */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@300;400;500;600;700;800;900&display=swap');

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

:root {
    /* Backgrounds */
    --bg-body: #09081A;
    --bg-header: #0D0B20;
    --bg-nav: #151330;
    --bg-card: #0E0D20;
    --bg-input: #13112A;
    --bg-card-hover: #12102a;
    --bg-glass: rgba(14, 12, 32, 0.7);
    
    /* Purple Palette */
    --purple-main: #7C3AED;
    --purple-vivid: #8B5CF6;
    --purple-deep: #6D28D9;
    --purple-glow: rgba(124, 58, 237, 0.25);
    --purple-light: #A78BFA;
    --purple-muted: rgba(124, 58, 237, 0.08);
    
    /* Accent Colors */
    --orange-hot: #FB923C;
    --orange-warm: #F59E0B;
    --blue-bright: #3B82F6;
    --cyan-bright: #06B6D4;
    --rose-bright: #F43F5E;
    --green-bright: #10B981;
    
    /* Text */
    --text-white: #F1F5F9;
    --text-gray: #94A3B8;
    --text-dim: #64748B;
    
    /* Borders */
    --border-subtle: rgba(124, 58, 237, 0.12);
    --border-focus: rgba(124, 58, 237, 0.50);
    --border-hover: rgba(124, 58, 237, 0.28);
    
    /* Status */
    --danger: #EF4444;
    --success: #10B981;
    --warning: #F59E0B;
    --info: #3B82F6;
    
    /* Spacing */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-pill: 50px;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
    --shadow-glow: 0 0 20px rgba(124,58,237,0.15);
    --shadow-glow-strong: 0 0 30px rgba(124,58,237,0.3);
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Noto Sans Thai', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-body);
    color: var(--text-white);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

a { text-decoration: none; color: inherit; }

/* =============================================
   HEADER
   ============================================= */
.site-header {
    background: linear-gradient(180deg, rgba(15, 13, 36, 0.98) 0%, rgba(13, 11, 32, 0.95) 100%);
    border-bottom: 1px solid rgba(124, 58, 237, 0.06);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.header-inner {
    max-width: 1340px;
    margin: 0 auto;
    padding: 0 40px;
    height: 72px;
    display: flex;
    align-items: center;
}

.logo { display: flex; align-items: center; text-decoration: none; flex-shrink: 0; margin-right: 40px; transition: transform var(--transition-fast); }
.logo:hover { transform: scale(1.02); }
.logo-img { width: 38px; height: 38px; }

.nav-bar {
    display: flex;
    align-items: center;
    gap: 2px;
    background: rgba(21, 19, 48, 0.6);
    border: 1px solid rgba(124, 58, 237, 0.12);
    border-radius: var(--radius-pill);
    padding: 4px 6px;
    backdrop-filter: blur(8px);
}

.nav-bar a {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    color: var(--text-gray);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-pill);
    transition: all var(--transition-normal);
    white-space: nowrap;
    position: relative;
}

.nav-bar a:hover { color: #fff; background: rgba(124, 58, 237, 0.15); }
.nav-bar a.active { 
    color: #fff; 
    background: rgba(124, 58, 237, 0.22);
    box-shadow: 0 0 12px rgba(124, 58, 237, 0.2);
}
.nav-bar a i { font-size: 13px; opacity: 0.7; width: 15px; text-align: center; transition: opacity var(--transition-fast); }
.nav-bar a:hover i { opacity: 1; }

.header-spacer { flex: 1; }

.header-right { display: flex; align-items: center; gap: 10px; }

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(21, 19, 48, 0.6);
    border: 1px solid rgba(124, 58, 237, 0.12);
    border-radius: var(--radius-pill);
    padding: 8px 16px;
    color: var(--text-dim);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-normal);
    backdrop-filter: blur(8px);
}

.search-box:hover { 
    border-color: rgba(124, 58, 237, 0.35); 
    background: rgba(21, 19, 48, 0.8);
    box-shadow: var(--shadow-glow);
}
.search-box i { font-size: 13px; }
.search-box .label { flex: 1; }
.search-box .kbd {
    font-size: 11px;
    color: var(--text-dim);
    background: rgba(255,255,255,0.05);
    padding: 2px 7px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.06);
    font-family: -apple-system, sans-serif;
}

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    color: var(--text-gray);
    font-size: 16px;
    border-radius: var(--radius-pill);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.icon-btn:hover { color: #fff; background: rgba(124,58,237,0.12); transform: scale(1.05); }

.sep { width: 1px; height: 22px; background: rgba(255,255,255,0.07); margin: 0 4px; }

.btn-login {
    color: var(--text-gray);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    transition: all var(--transition-fast);
}

.btn-login:hover { color: #fff; background: rgba(124,58,237,0.08); }

.btn-register {
    background: linear-gradient(135deg, var(--purple-main), var(--purple-deep));
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 24px;
    border-radius: var(--radius-pill);
    text-decoration: none;
    transition: all var(--transition-normal);
    box-shadow: 0 2px 12px rgba(124,58,237,0.3);
}

.btn-register:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(124,58,237,0.4);
}

/* User menu (logged in) */
.user-menu {
    position: relative;
}

.user-avatar-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 14px 5px 5px;
    background: rgba(21, 19, 48, 0.6);
    border: 1px solid rgba(124, 58, 237, 0.12);
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: all var(--transition-normal);
    color: var(--text-gray);
    font-size: 14px;
    font-weight: 500;
    backdrop-filter: blur(8px);
}

.user-avatar-btn:hover { 
    border-color: rgba(124, 58, 237, 0.35); 
    color: #fff;
    box-shadow: var(--shadow-glow);
}

.user-avatar-btn .avatar-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--purple-main), var(--purple-deep));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(124,58,237,0.3);
}
.user-avatar-btn img.avatar-circle {
    background: transparent;
    padding: 0;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 220px;
    background: rgba(21, 19, 48, 0.95);
    border: 1px solid rgba(124, 58, 237, 0.2);
    border-radius: var(--radius-lg);
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.98);
    transition: all var(--transition-normal);
    box-shadow: 0 16px 48px rgba(0,0,0,0.5), var(--shadow-glow);
    z-index: 100;
    backdrop-filter: blur(20px);
}

.user-menu:hover .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.user-dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-gray);
    transition: all var(--transition-fast);
}

.user-dropdown a:hover { background: rgba(124, 58, 237, 0.12); color: #fff; transform: translateX(2px); }
.user-dropdown a i { width: 16px; text-align: center; font-size: 14px; }
.user-dropdown .divider { height: 1px; background: rgba(255,255,255,0.06); margin: 4px 8px; }

/* =============================================
   FOOTER
   ============================================= */
.site-footer {
    background: var(--bg-header);
    border-top: 1px solid rgba(124, 58, 237, 0.06);
    padding: 40px 40px 32px;
    margin-top: auto;
}

.footer-inner {
    max-width: 1340px;
    margin: 0 auto;
}

.footer-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
}

.footer-brand { display: flex; flex-direction: column; gap: 10px; }

.footer-text { font-size: 13px; color: var(--text-dim); }

.footer-contact {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.footer-contact span,
.footer-contact a {
    font-size: 12px;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color var(--transition-fast);
}

.footer-contact a:hover { color: var(--text-white); }
.footer-contact i { color: var(--purple-light); font-size: 12px; }

.footer-links { display: flex; gap: 28px; flex-wrap: wrap; align-items: center; }
.footer-links a { font-size: 13px; color: var(--text-dim); transition: color var(--transition-fast); white-space: nowrap; }
.footer-links a:hover { color: var(--text-white); }

@media (max-width: 768px) {
    .site-footer { padding: 28px 20px 22px; }
    .footer-top { flex-direction: column; gap: 16px; }
    .footer-links { gap: 16px; }
}

/* =============================================
   AUTH PAGES (Login / Register)
   ============================================= */
.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    position: relative;
}

.auth-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 70% 50% at 50% 0%, rgba(124, 58, 237, 0.18) 0%, transparent 55%),
        radial-gradient(ellipse 50% 40% at 50% 10%, rgba(109, 40, 217, 0.12) 0%, transparent 45%),
        radial-gradient(circle at 30% 80%, rgba(59, 130, 246, 0.05) 0%, transparent 40%),
        linear-gradient(180deg, #0D0B20 0%, var(--bg-body) 100%);
    z-index: 0;
}

.auth-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 460px;
}

.auth-icon {
    width: 68px;
    height: 68px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--purple-main), var(--purple-deep));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    font-size: 28px;
    color: #fff;
    box-shadow: 0 8px 24px rgba(124,58,237,0.4);
}

.auth-title {
    font-size: 32px;
    font-weight: 800;
    text-align: center;
    margin-bottom: 8px;
    color: var(--text-white);
}

.auth-subtitle {
    font-size: 15px;
    color: var(--text-gray);
    text-align: center;
    margin-bottom: 36px;
}

.auth-card {
    background: rgba(14, 13, 30, 0.85);
    border: 1px solid rgba(124, 58, 237, 0.12);
    border-radius: var(--radius-xl);
    padding: 32px;
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-lg);
}

.auth-google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-md);
    color: var(--text-white);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    font-family: inherit;
}

.auth-google-btn:hover { 
    background: rgba(255,255,255,0.08); 
    border-color: rgba(255,255,255,0.18);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}
.auth-google-btn svg { width: 20px; height: 20px; }

.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,0.08);
}

.auth-divider span { font-size: 13px; color: var(--text-dim); white-space: nowrap; }

.form-group { margin-bottom: 20px; }

.form-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-white);
    margin-bottom: 8px;
}

.form-label a { color: var(--purple-vivid); font-weight: 500; font-size: 13px; transition: color var(--transition-fast); }
.form-label a:hover { color: #C4B5FD; }

.form-input-wrap {
    position: relative;
}

.form-input-wrap i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 15px;
    color: var(--text-dim);
    pointer-events: none;
    transition: color var(--transition-fast);
}

.form-input {
    width: 100%;
    padding: 14px 14px 14px 42px;
    background: var(--bg-input);
    border: 1px solid rgba(124, 58, 237, 0.15);
    border-radius: var(--radius-md);
    color: var(--text-white);
    font-size: 15px;
    font-family: inherit;
    transition: all var(--transition-normal);
    outline: none;
}

.form-input::placeholder { color: var(--text-dim); }

.form-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
    background: rgba(19, 17, 42, 0.9);
}

.form-input:focus + i,
.form-input:focus ~ i { color: var(--purple-vivid); }

.form-input-wrap:has(.form-input:focus) i { color: var(--purple-vivid); }

.auth-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--purple-main), var(--purple-deep));
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: all var(--transition-normal);
    font-family: inherit;
    margin-top: 8px;
    box-shadow: 0 4px 16px rgba(124,58,237,0.3);
}

.auth-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(124,58,237,0.45);
}

.auth-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.auth-footer {
    text-align: center;
    margin-top: 28px;
    font-size: 14px;
    color: var(--text-gray);
}

.auth-footer a { color: var(--purple-vivid); font-weight: 600; transition: color var(--transition-fast); }
.auth-footer a:hover { color: #C4B5FD; }

.auth-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #FCA5A5;
    font-size: 13px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.auth-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #6EE7B7;
    font-size: 13px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* =============================================
   CONTENT PAGES (Courses, Ebooks, Documents)
   ============================================= */
.page-hero {
    text-align: center;
    padding: 60px 24px 40px;
    position: relative;
    overflow: hidden;
}

.page-hero-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 50% -10%, rgba(124, 58, 237, 0.22) 0%, transparent 55%),
        linear-gradient(180deg, #0D0B20 0%, var(--bg-body) 100%);
    z-index: 0;
}

.page-hero-content { position: relative; z-index: 1; }

.page-hero h1 {
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 10px;
    color: var(--text-white);
}

.page-hero p { font-size: 16px; color: var(--text-gray); }

.content-section {
    max-width: 1340px;
    margin: 0 auto;
    padding: 0 40px 72px;
}

.section-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 28px;
}

.section-header h2 { font-size: 22px; font-weight: 700; color: var(--text-white); }

.filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    background: rgba(21, 19, 48, 0.6);
    border: 1px solid rgba(124, 58, 237, 0.12);
    border-radius: var(--radius-pill);
    color: var(--text-gray);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    font-family: inherit;
    backdrop-filter: blur(8px);
}

.filter-btn:hover { 
    border-color: rgba(124, 58, 237, 0.3); 
    color: #fff;
    background: rgba(21, 19, 48, 0.8);
}
.filter-btn.active {
    background: linear-gradient(135deg, var(--purple-main), var(--purple-deep));
    border-color: transparent;
    color: #fff;
    box-shadow: 0 2px 12px rgba(124,58,237,0.3);
}

.items-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.item-card {
    background: rgba(14, 12, 32, 0.85);
    border: 1px solid rgba(124, 58, 237, 0.08);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-normal);
    cursor: pointer;
    position: relative;
}

.item-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-lg);
    padding: 1px;
    background: linear-gradient(135deg, transparent, rgba(124, 58, 237, 0.1));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity var(--transition-normal);
    pointer-events: none;
}

.item-card:hover {
    border-color: rgba(124, 58, 237, 0.20);
    transform: translateY(-6px);
    box-shadow: 0 20px 50px rgba(124, 58, 237, 0.12), var(--shadow-glow);
}

.item-card:hover::before { opacity: 1; }

.item-thumb {
    width: 100%;
    aspect-ratio: 16/10;
    background: linear-gradient(145deg, #18163a, #0D0B20);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.item-thumb::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 60%, rgba(9,8,26,0.6) 100%);
    pointer-events: none;
}

.item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.item-card:hover .item-thumb img { transform: scale(1.05); }

.item-thumb i { font-size: 34px; color: rgba(124,58,237,0.22); }

.item-tag {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(124,58,237,0.85);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    z-index: 1;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.item-body { padding: 18px; }
.item-title { 
    font-size: 15px; 
    font-weight: 600; 
    color: var(--text-white); 
    margin-bottom: 8px; 
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.item-desc { font-size: 13px; color: var(--text-dim); margin-bottom: 12px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.item-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 12px;
}

.item-meta i { font-size: 11px; }

.item-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.item-price { font-size: 18px; font-weight: 700; color: var(--orange-hot); }
.item-price .old { font-size: 13px; color: var(--text-dim); text-decoration: line-through; font-weight: 400; margin-left: 6px; }

.btn-buy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, var(--purple-main), var(--purple-deep));
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-pill);
    border: none;
    cursor: pointer;
    transition: all var(--transition-normal);
    font-family: inherit;
    box-shadow: 0 2px 8px rgba(124,58,237,0.25);
}

.btn-buy:hover { 
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(124,58,237,0.4);
}

.view-all-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--purple-vivid);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.view-all-link:hover { color: #C4B5FD; transform: translateX(2px); }
.view-all-link i { font-size: 11px; transition: transform var(--transition-fast); }
.view-all-link:hover i { transform: translateX(4px); }

/* =============================================
   SCROLLBAR
   ============================================= */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-body); }
::-webkit-scrollbar-thumb { 
    background: linear-gradient(180deg, #1E1D3A, #151330); 
    border-radius: 4px; 
    border: 2px solid var(--bg-body);
}
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #2a2850, #1E1D3A); }

/* =============================================
   ANIMATIONS
   ============================================= */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.anim-up { animation: fadeUp 0.6s ease-out both; }
.anim-d1 { animation-delay: 0.08s; }
.anim-d2 { animation-delay: 0.16s; }
.anim-d3 { animation-delay: 0.24s; }
.anim-d4 { animation-delay: 0.32s; }
.anim-d5 { animation-delay: 0.40s; }

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, rgba(124,58,237,0.05) 25%, rgba(124,58,237,0.1) 50%, rgba(124,58,237,0.05) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1200px) {
    .items-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1024px) {
    .items-grid { grid-template-columns: repeat(2, 1fr); }
    .header-inner { padding: 0 24px; }
    .logo { margin-right: 24px; }
}

@media (max-width: 900px) {
    .nav-bar a { padding: 7px 14px; font-size: 13px; }
    .nav-bar a i { display: none; }
    .search-box .label, .search-box .kbd { display: none; }
    .search-box { padding: 8px 12px; }
    .btn-login, .btn-register { padding: 8px 16px; font-size: 13px; }
    .user-name-text { display: none; }
}

@media (max-width: 768px) {
    .nav-bar { display: none; }
    .header-inner { padding: 0 14px; height: 60px; gap: 8px; }
    .logo { margin-right: 12px; }
    .logo-img { width: 32px; height: 32px; }
    .search-box { display: none; }
    .sep { display: none; }
    .header-right { gap: 6px; }
    .icon-btn { width: 36px; height: 36px; font-size: 15px; }
    .btn-login { display: none; }
    .btn-register { padding: 8px 14px; font-size: 12px; white-space: nowrap; }
    .user-avatar-btn { padding: 4px 10px 4px 4px !important; }
    .avatar-circle { width: 30px !important; height: 30px !important; font-size: 13px !important; }
    .mobile-menu-btn { display: flex !important; width: 36px; height: 36px; font-size: 15px; }
    .items-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
    .content-section { padding: 0 16px 48px; }
    .page-hero h1 { font-size: 28px; }
    .footer-inner { flex-direction: column; gap: 16px; text-align: center; }
}

@media (max-width: 480px) {
    .header-inner { padding: 0 10px; height: 56px; }
    .logo { margin-right: 8px; }
    .logo-img { width: 28px; height: 28px; }
    .header-right { gap: 4px; }
    .icon-btn { width: 34px; height: 34px; font-size: 14px; }
    .btn-register { padding: 7px 12px; font-size: 11px; }
    .mobile-menu-btn { width: 34px; height: 34px; font-size: 14px; }
    .page-hero h1 { font-size: 24px; }
    .items-grid { grid-template-columns: 1fr; }
    .item-card { margin-bottom: 4px; }
}

/* =============================================
   UTILITY CLASSES
   ============================================= */
.glass-card {
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.glass-card-hover {
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: all var(--transition-normal);
}

.glass-card-hover:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.text-gradient {
    background: linear-gradient(135deg, var(--purple-main), var(--purple-vivid));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-gradient-warm {
    background: linear-gradient(135deg, var(--orange-hot), var(--orange-warm));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hover-lift {
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--purple-main), var(--purple-deep));
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    padding: 12px 24px;
    border-radius: var(--radius-pill);
    border: none;
    cursor: pointer;
    transition: all var(--transition-normal);
    font-family: inherit;
    text-decoration: none;
    box-shadow: 0 2px 12px rgba(124,58,237,0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(124,58,237,0.45);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(124,58,237,0.08);
    color: var(--purple-light);
    font-size: 14px;
    font-weight: 600;
    padding: 12px 24px;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(124,58,237,0.2);
    cursor: pointer;
    transition: all var(--transition-normal);
    font-family: inherit;
    text-decoration: none;
}

.btn-secondary:hover {
    background: rgba(124,58,237,0.15);
    border-color: rgba(124,58,237,0.4);
    color: #fff;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
}

.badge-purple {
    background: rgba(124,58,237,0.15);
    color: var(--purple-light);
    border: 1px solid rgba(124,58,237,0.2);
}

.badge-green {
    background: rgba(16,185,129,0.15);
    color: #34D399;
    border: 1px solid rgba(16,185,129,0.2);
}

.badge-orange {
    background: rgba(251,146,60,0.15);
    color: var(--orange-hot);
    border: 1px solid rgba(251,146,60,0.2);
}

.badge-red {
    background: rgba(239,68,68,0.15);
    color: #F87171;
    border: 1px solid rgba(239,68,68,0.2);
}

/* Focus visible for accessibility */
:focus-visible {
    outline: 2px solid var(--purple-main);
    outline-offset: 2px;
}

/* Selection color */
::selection {
    background: rgba(124,58,237,0.3);
    color: #fff;
}

/* =============================================
   LIGHT THEME — [data-theme="light"]
   ============================================= */
[data-theme="light"] {
    --bg-body: #F1F5F9;
    --bg-header: #FFFFFF;
    --bg-nav: #F8FAFC;
    --bg-card: #FFFFFF;
    --bg-input: #F1F5F9;
    --bg-card-hover: #F8FAFC;
    --bg-glass: rgba(255, 255, 255, 0.85);

    --text-white: #1E293B;
    --text-gray: #475569;
    --text-dim: #94A3B8;

    --border-subtle: rgba(124, 58, 237, 0.12);
    --border-focus: rgba(124, 58, 237, 0.50);
    --border-hover: rgba(124, 58, 237, 0.28);

    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.10);
    --shadow-glow: 0 0 20px rgba(124,58,237,0.08);
    --shadow-glow-strong: 0 0 30px rgba(124,58,237,0.15);
}
[data-theme="light"] body {
    background: var(--bg-body);
    color: var(--text-white);
}
[data-theme="light"] .site-header {
    background: #FFFFFF !important;
    border-bottom: 1px solid rgba(124,58,237,0.08);
}
[data-theme="light"] .site-header .logo { color: #1E293B; }
[data-theme="light"] .site-header .nav-bar { background: #F1F5F9; border-color: #E2E8F0; }
[data-theme="light"] .site-header .nav-bar a { color: #475569; }
[data-theme="light"] .site-header .nav-bar a:hover,
[data-theme="light"] .site-header .nav-bar a.active { color: #7C3AED; background: rgba(124,58,237,0.08); }
[data-theme="light"] .site-header .search-box { background: #F1F5F9; border-color: #E2E8F0; color: #64748B; }
[data-theme="light"] .site-header .icon-btn { color: #64748B; }
[data-theme="light"] .site-header .icon-btn:hover { background: rgba(124,58,237,0.06); color: #7C3AED; }
[data-theme="light"] .site-header .user-name-text { color: #1E293B; }
[data-theme="light"] .user-avatar-btn { background: rgba(255,255,255,0.85); border-color: #E2E8F0; color: #475569; }
[data-theme="light"] .user-avatar-btn:hover { border-color: rgba(124,58,237,0.3); color: #1E293B; background: #fff; }

/* Hero */
[data-theme="light"] .hero-bg {
    background:
        radial-gradient(ellipse 90% 65% at 50% -8%, rgba(124, 58, 237, 0.12) 0%, transparent 55%),
        linear-gradient(180deg, #FFFFFF 0%, #F1F5F9 100%) !important;
}
[data-theme="light"] .hero h1 { color: #1E293B; }
[data-theme="light"] .badge { background: rgba(124,58,237,0.08); color: #7C3AED; border-color: rgba(124,58,237,0.15); }
[data-theme="light"] .stat-card { background: #FFFFFF; border-color: rgba(124,58,237,0.08); }
[data-theme="light"] .stat-num { color: #1E293B; }
[data-theme="light"] .content-section .section-header h2,
[data-theme="light"] .cat-section .section-header h2 { color: #1E293B; }

/* Cards */
[data-theme="light"] .item-card,
[data-theme="light"] .feed-card { background: #FFFFFF; border-color: rgba(124,58,237,0.08); }
[data-theme="light"] .item-card:hover,
[data-theme="light"] .feed-card:hover { border-color: rgba(124,58,237,0.2); }
[data-theme="light"] .item-thumb,
[data-theme="light"] .feed-thumb { background: linear-gradient(145deg, #F1F5F9, #E2E8F0); }
[data-theme="light"] .item-thumb::after,
[data-theme="light"] .feed-thumb::after { background: linear-gradient(180deg, transparent 60%, rgba(241,245,249,0.6) 100%); }
[data-theme="light"] .item-title,
[data-theme="light"] .feed-title { color: #1E293B; }
[data-theme="light"] .item-meta,
[data-theme="light"] .feed-meta { color: #1E293B; }
[data-theme="light"] .item-meta i,
[data-theme="light"] .feed-meta i { color: rgba(30,41,59,0.5); }
[data-theme="light"] .item-desc { color: #64748B; }
[data-theme="light"] .item-bottom,
[data-theme="light"] .feed-bottom { border-top-color: rgba(124,58,237,0.06); }
[data-theme="light"] .btn-outline { background: rgba(124,58,237,0.04); border-color: rgba(124,58,237,0.15); color: #475569; }
[data-theme="light"] .btn-outline:hover { background: rgba(124,58,237,0.08); color: #7C3AED; }
[data-theme="light"] .view-all-link { color: #7C3AED; }

/* Footer */
[data-theme="light"] .site-footer { background: #FFFFFF; border-top: 1px solid rgba(124,58,237,0.08); }
[data-theme="light"] .site-footer .footer-text { color: #64748B; }
[data-theme="light"] .site-footer a { color: #475569; }
[data-theme="light"] .site-footer a:hover { color: #7C3AED; }

/* User dropdown */
[data-theme="light"] .user-dropdown { background: #FFFFFF; border-color: #E2E8F0; }
[data-theme="light"] .user-dropdown a { color: #475569; }
[data-theme="light"] .user-dropdown a:hover { background: rgba(124,58,237,0.06); color: #1E293B; }

/* Mobile menu */
[data-theme="light"] #mobileMenu > div { background: rgba(255,255,255,0.98); }
[data-theme="light"] #mobileMenu nav a { color: #475569; }

/* =============================================
   NORMAL THEME — [data-theme="normal"] (softer dark)
   ============================================= */
[data-theme="normal"] {
    --bg-body: #0F0E1F;
    --bg-header: #131228;
    --bg-nav: #191832;
    --bg-card: #141328;
    --bg-input: #1A1835;
    --bg-card-hover: #1A1835;
    --bg-glass: rgba(19, 18, 40, 0.80);

    --text-white: #E2E8F0;
    --text-gray: #94A3B8;
    --text-dim: #64748B;

    --shadow-sm: 0 2px 8px rgba(0,0,0,0.15);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.2);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.25);
}
[data-theme="normal"] body {
    background: var(--bg-body);
    color: var(--text-white);
}
[data-theme="normal"] .site-header { background: var(--bg-header); }
[data-theme="normal"] .site-header .search-box { background: var(--bg-input); }
[data-theme="normal"] .stat-card,
[data-theme="normal"] .item-card,
[data-theme="normal"] .feed-card { background: var(--bg-card); }
[data-theme="normal"] .item-thumb,
[data-theme="normal"] .feed-thumb { background: linear-gradient(145deg, #1A1835, var(--bg-body)); }
[data-theme="normal"] .site-footer { background: var(--bg-header); }
