/* CSS Variables for Theming */
:root {
    /* Dark Theme (Default) */
    --bg-primary: #06091d;
    --bg-secondary: #111732;
    --bg-glass: rgba(26, 31, 58, 0.6);
    --bg-glass-hover: rgba(26, 31, 58, 0.8);
    --text-primary: #ffffff;
    --text-secondary: #b8bcc8;
    --text-muted: #7a7f8f;
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] {
    /* Light Theme */
    --bg-primary: #e8ecf5;
    --bg-secondary: #f5f7fa;
    --bg-glass: rgba(255, 255, 255, 0.6);
    --bg-glass-hover: rgba(255, 255, 255, 0.8);
    --text-primary: #1a1f3a;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --accent-primary: #667eea;
    --accent-secondary: #764ba2;
    --accent-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --border-color: rgba(0, 0, 0, 0.1);
    --shadow-glass: 0 8px 32px 0 rgba(102, 126, 234, 0.2);
    --shadow-card: 0 4px 16px rgba(102, 126, 234, 0.15);
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Force-hide elements with the HTML `hidden` attribute (safety net) */
[hidden] {
    display: none !important;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
    position: relative;
    overflow-x: hidden;
}

/* Animated Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--accent-gradient);
    opacity: 0.1;
    z-index: -1;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {

    0%,
    100% {
        transform: scale(1) rotate(0deg);
    }

    50% {
        transform: scale(1.1) rotate(5deg);
    }
}

/* ===== MOBILE-FIRST HEADER (starts at mobile) ===== */
.header {
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    background: var(--bg-glass);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-glass);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    position: relative;
}

/* Logo - Mobile First */
.logo {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
    z-index: 1002;
}

.logo-main {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.logo-subtitle {
    display: inline;
    font-size: 0.65rem;
    font-weight: 300;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
}

/* Mobile Menu Toggle - visible by default on mobile */
.mobile-menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    background: var(--bg-glass-hover);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    padding: 10px;
    width: 48px;
    height: 48px;
    transition: all 0.3s ease;
    z-index: 1002;
}

.mobile-menu-toggle:hover {
    background: var(--bg-secondary);
    transform: scale(1.05);
}

.mobile-menu-toggle span {
    width: 22px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Navigation - Mobile First (dropdown style) */
.nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--bg-secondary);
    backdrop-filter: blur(20px);
    padding: 0;
    border-bottom: 1px solid var(--border-color);
    gap: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease, padding 0.3s ease;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.nav.active {
    max-height: 500px;
    opacity: 1;
    padding: 0.5rem 0;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    padding: 1rem 1.5rem;
    transition: all 0.3s ease;
    border-bottom: 1px solid var(--border-color);
    display: block;
    width: 100%;
    text-align: left;
}

.nav-link:hover {
    color: var(--text-primary);
}

.nav-link-primary {
    background: var(--accent-gradient);
    color: white;
    padding: 1rem 1.5rem;
    margin: 0.5rem 1rem;
    border-radius: 10px;
    text-align: center;
    border-bottom: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: calc(100% - 2rem);
    width: calc(100% - 2rem);
    display: block;
    box-sizing: border-box;
}

.nav-link-primary:hover {
    transform: translateY(-2px);
    box-shadow:
        0 6px 20px rgba(99, 102, 241, 0.6),
        0 0 30px rgba(99, 102, 241, 0.4),
        0 0 60px rgba(99, 102, 241, 0.2);
    filter: brightness(1.1);
}

.nav-link-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
    filter: brightness(1);
}

.nav-user {
    color: var(--text-primary);
    font-weight: 600;
    pointer-events: none;
}

.nav-logout {
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: calc(100% - 2rem);
    width: calc(100% - 2rem);
    margin: 0.5rem 1rem;
    text-align: center;
    padding: 1rem 1.5rem;
    border-radius: 10px;
}

.nav-logout:hover {
    transform: translateY(-2px);
    box-shadow:
        0 6px 20px rgba(99, 102, 241, 0.6),
        0 0 30px rgba(99, 102, 241, 0.4),
        0 0 60px rgba(99, 102, 241, 0.2);
    filter: brightness(1.1);
}

.nav-logout:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
    filter: brightness(1);
}

/* ===== NAVBAR DROPDOWNS ===== */
.nav-dropdown {
    position: relative;
}

.nav-link-dropdown {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.dropdown-arrow {
    transition: transform 0.3s ease;
}

.nav-dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    min-width: 200px;
    background: var(--bg-secondary);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.5rem;
    box-shadow: var(--shadow-glass);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1001;
}

.dropdown-menu-wide {
    min-width: 300px;
}

.nav-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.dropdown-loading {
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.dropdown-item {
    display: block;
    padding: 0.65rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.dropdown-item:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
}

/* Popular dropdown item with extra info */
.dropdown-item-popular {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
}

.dropdown-item-rank {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent-gradient);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
}

.dropdown-item-content {
    flex: 1;
    min-width: 0;
}

.dropdown-item-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dropdown-item-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.dropdown-item-comments {
    color: var(--accent-primary);
    font-weight: 600;
}

/* Mobile: Dropdowns act differently */
@media (max-width: 767px) {
    .nav-dropdown {
        width: 100%;
    }

    .nav-link-dropdown {
        justify-content: space-between;
        width: 100%;
    }

    .dropdown-menu {
        position: static;
        transform: none;
        width: 100%;
        max-height: 0;
        overflow: hidden;
        opacity: 1;
        visibility: visible;
        padding: 0;
        border: none;
        box-shadow: none;
        background: var(--bg-glass);
    }

    .nav-dropdown.active .dropdown-menu {
        max-height: 400px;
        padding: 0.5rem;
        overflow-y: auto;
    }

    .nav-dropdown:hover .dropdown-menu {
        transform: none;
    }
}

/* Create Topic Button */
.create-topic-btn {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.75rem 1.25rem;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    color: var(--bg-primary);
    white-space: nowrap;
    display: block;
    width: calc(100% - 2rem);
    margin: 0.5rem 1rem;
    text-align: center;
}

/* Light theme - black background for create-topic on mobile */
[data-theme="light"] .create-topic-btn {
    background: #1a1f3a;
    color: white;
}

.create-topic-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.5);
}

.create-topic-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

/* ===== MAIN CONTENT - Mobile First ===== */
.main-content {
    padding: 1.25rem 0.75rem;
    min-height: calc(100vh - 200px);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

.forum-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 0.5rem 0;
}

/* ===== FORUM CARDS - Mobile Optimized ===== */
.forum-card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.25rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-card);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.forum-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.forum-card:active {
    transform: scale(0.98);
}

.forum-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    gap: 0.75rem;
}

.forum-card-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    flex: 1;
}

.forum-card-badge {
    background: var(--accent-gradient);
    color: white;
    padding: 0.25rem 0.65rem;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
    flex-shrink: 0;
}

.badge-popular {
    background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
}

.forum-card-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 1rem;
}

/* Limit description to 3 lines only on homepage cards */
.forum-grid .forum-card-description {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.forum-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.forum-card-author {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Comments Section */
.comments-section {
    margin-top: 2rem;
}

.comments-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.comment-form-container {
    margin-bottom: 2.5rem;
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Hide posts section - comments are shown in comments-section only */
.posts-section {
    display: none;
}

.author-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.8rem;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
    flex-shrink: 0;
}

.author-name {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.85rem;
}

.forum-card-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.meta-date {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.meta-comments {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
}

/* Topic Page Styles */
.topic-header {
    margin-bottom: 1.25rem;
}

.post-card {
    position: relative;
}

.post-delete-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    height: 28px;
    width: 28px;
    border-radius: 999px;
    border: 1px solid rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.14);
    color: #fecaca;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    padding: 0;
}

[data-theme="light"] .post-delete-btn {
    color: #7f1d1d;
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.25);
}

.post-delete-btn:hover {
    width: auto;
    min-width: 140px;
    border-radius: 20px;
    background: rgba(239, 68, 68, 0.25);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.post-delete-btn:active {
    transform: scale(0.95);
}

.post-delete-x {
    font-weight: 800;
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.post-delete-btn:hover .post-delete-x {
    transform: rotate(90deg);
}

.post-delete-text {
    display: none;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 600;
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.post-delete-btn:hover .post-delete-text {
    display: inline-block;
    opacity: 1;
    transform: translateX(0);
}


/* ===== FOOTER - Mobile First (Minimal) ===== */
.footer {
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    background: var(--bg-glass);
    border-top: 1px solid var(--border-color);
    padding: 2rem 1rem;
    margin-top: 2rem;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    text-align: center;
}

.footer-left,
.footer-right {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Footer legal link */
.footer-legal {
    max-width: 1400px;
    margin: 0.75rem auto 0;
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    position: relative;
    left: 10px;
}

.footer-policy-link {
    appearance: none;
    background: transparent;
    border: none;
    padding: 0.35rem 0.5rem;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 10px;
    transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.footer-policy-link:hover,
.footer-policy-link:focus-visible {
    color: var(--text-primary);
    background: var(--bg-glass-hover);
    outline: none;
}

.footer-policy-link:active {
    transform: scale(0.98);
}

/* Theme Switcher */
.theme-switcher {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    width: 100%;
}

.theme-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--bg-glass-hover);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    flex: 1;
    min-width: 140px;
}

.theme-btn:hover,
.theme-btn:active {
    background: var(--accent-gradient);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    border-color: transparent;
}

.theme-btn svg {
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.theme-btn:hover svg {
    transform: rotate(15deg);
}

.theme-btn.active {
    background: var(--accent-gradient);
    color: white;
    border-color: transparent;
}

/* ===== MODALS & AUTH - Mobile First ===== */
.auth-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 0;
}

.auth-modal.active {
    display: flex;
}

.auth-backdrop {
    position: absolute;
    inset: 0;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: rgba(0, 0, 0, 0.6);
}

.auth-dialog {
    position: relative;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.5rem;
    overflow-y: auto;
}

.auth-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--bg-glass-hover);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-close:active {
    transform: scale(0.95);
}

.auth-title {
    margin: 2rem 0 0 0;
    font-size: 1.75rem;
    color: var(--text-primary);
}

.auth-subtitle {
    margin: 0;
    color: var(--text-secondary);
    font-size: 1rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.auth-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: -0.5rem;
}

.auth-input {
    width: 100%;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-size: 16px;
    /* Prevents iOS zoom on focus */
}

.auth-input:focus {
    border-color: rgba(99, 102, 241, 0.5);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

textarea.auth-input {
    resize: vertical;
    min-height: 120px;
}

/* Comment form textarea - taller for better UX */
.comment-form-container textarea.auth-input {
    min-height: 150px;
}

.auth-submit {
    margin-top: 0.5rem;
    padding: 1rem;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    background: var(--accent-gradient);
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.auth-submit:active {
    transform: scale(0.98);
}

.auth-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    flex-wrap: wrap;
}

.auth-forgot-container {
    display: flex;
    justify-content: center;
    margin-top: 0.65rem;
}

.auth-forgot-panel {
    margin-top: 0.75rem;
    padding: 1rem;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    background: var(--bg-glass-hover);
    box-shadow: var(--shadow-card);
}

.auth-forgot-panel .auth-submit {
    margin-top: 0.25rem;
}

.auth-soft-link {
    appearance: none;
    background: transparent;
    border: none;
    padding: 0.25rem 0.5rem;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 10px;
    transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.auth-soft-link:hover,
.auth-soft-link:focus-visible {
    color: var(--text-primary);
    background: var(--bg-glass-hover);
    outline: none;
}

.auth-soft-link:active {
    transform: scale(0.99);
}

.auth-soft-link:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    text-decoration: none;
}

.auth-feedback {
    margin-top: 0.75rem;
    min-height: 1.2em;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: center;
}

.auth-feedback[data-type="success"] {
    color: #86efac;
}

.auth-feedback[data-type="error"] {
    color: #fca5a5;
}

[data-theme="light"] .auth-feedback[data-type="success"] {
    color: #166534;
}

[data-theme="light"] .auth-feedback[data-type="error"] {
    color: #7f1d1d;
}

.auth-register {
    color: var(--accent-primary);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
}

.auth-register:hover {
    color: var(--accent-secondary);
}

/* Auth Page (login.html) */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-container {
    width: 100%;
    max-width: 480px;
}

.auth-panel {
    width: 100%;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
    border-radius: 20px;
    padding: 1.75rem;
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
}

.auth-terms-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.5rem 0;
}

.auth-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.auth-checkbox:checked {
    background: var(--accent-gradient);
    border-color: transparent;
}

.auth-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.auth-checkbox-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.terms-link {
    color: var(--accent-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
    font-weight: 500;
}

.terms-link:hover {
    color: var(--accent-secondary);
}

/* About Modal Specific Styles */
.about-dialog {
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
}

.about-content {
    margin: 1.5rem 0;
    line-height: 1.8;
}

.about-content p {
    margin-bottom: 1.25rem;
    color: var(--text-secondary);
    text-align: justify;
}

.about-content p:last-child {
    margin-bottom: 0;
}

.about-ok-btn {
    margin-top: 1rem;
}

/* ===== PRIVACY POLICY MODAL (Liquid Glass) ===== */
.privacy-modal .auth-backdrop {
    /* Slightly stronger glass blur for long text reading */
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    background: rgba(0, 0, 0, 0.55);
}

[data-theme="light"] .privacy-modal .auth-backdrop {
    background: rgba(10, 12, 22, 0.35);
}

.privacy-dialog {
    /* Override auth-dialog's solid background so it stays glassy on all breakpoints */
    background: var(--bg-glass);
    backdrop-filter: blur(22px) saturate(180%);
    -webkit-backdrop-filter: blur(22px) saturate(180%);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-glass);
}

.privacy-content {
    margin: 1rem 0 0;
}

.privacy-text {
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: 0.95rem;
    line-height: 1.8;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Custom scrollbar for about modal */
.about-dialog::-webkit-scrollbar {
    width: 8px;
}

.about-dialog::-webkit-scrollbar-track {
    background: var(--bg-glass);
    border-radius: 10px;
}

.about-dialog::-webkit-scrollbar-thumb {
    background: var(--accent-gradient);
    border-radius: 10px;
}

.about-dialog::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}


/* ===== TABLET AND UP (768px+) ===== */
@media (min-width: 768px) {
    .header-content {
        padding: 1rem 2rem;
    }

    .logo-main {
        font-size: 1.75rem;
    }

    .logo-subtitle {
        display: inline;
        font-size: 0.8rem;
        font-weight: 300;
        color: var(--text-secondary);
        letter-spacing: 0.5px;
    }

    .mobile-menu-toggle {
        display: none;
    }

    .nav {
        display: flex;
        position: static;
        flex-direction: row;
        background: transparent;
        padding: 0;
        border: none;
        max-height: none;
        opacity: 1;
        box-shadow: none;
        gap: 1.5rem;
        align-items: center;
        overflow: visible;
    }

    .nav-dropdown {
        position: relative;
        display: flex;
        align-items: center;
    }

    .nav-link-dropdown {
        display: flex;
        align-items: center;
        gap: 0.35rem;
    }

    .nav-link {
        padding: 0.5rem 1rem;
        border: none;
        border-radius: 8px;
        font-size: 0.95rem;
        width: auto;
        background: transparent;
    }

    .nav-link:not(.nav-link-primary):hover {
        background: transparent;
    }

    .nav-link-primary {
        margin: 0;
        padding: 0.6rem 1.5rem;
        background: var(--accent-gradient);
    }

    .create-topic-btn {
        width: auto;
        margin: 0;
        padding: 0.6rem 1.25rem;
        font-size: 0.9rem;
        background: white;
        color: var(--bg-primary);
    }

    [data-theme="light"] .create-topic-btn {
        background: #1a1f3a;
        color: white;
    }

    .main-content {
        padding: 2rem 1.5rem;
    }

    .forum-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    .forum-card {
        padding: 1.75rem;
    }

    .forum-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 12px 40px rgba(99, 102, 241, 0.3);
        border-color: rgba(99, 102, 241, 0.3);
    }

    .forum-card:hover::before {
        opacity: 0.05;
    }

    .forum-card-title {
        font-size: 1.3rem;
    }

    .forum-card-description {
        font-size: 0.95rem;
    }

    .author-avatar {
        width: 36px;
        height: 36px;
    }

    .author-name {
        font-size: 0.9rem;
    }

    .post-delete-btn {
        width: auto;
        padding: 0 0.5rem;
    }

    .post-delete-btn:hover {
        width: 140px;
        padding: 0 1rem;
    }

    .post-delete-text {
        display: block;
        white-space: nowrap;
        font-weight: 700;
        font-size: 0.85rem;
        opacity: 0;
        transform: translateX(-6px);
        transition: opacity 200ms ease, transform 200ms ease;
    }

    .post-delete-btn:hover .post-delete-text {
        opacity: 1;
        transform: translateX(0);
    }

    .footer-content {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }

    .theme-switcher {
        width: auto;
    }

    .theme-btn {
        flex: 0;
        min-width: auto;
    }

    .auth-dialog {
        width: min(480px, 92vw);
        height: auto;
        border-radius: 18px;
        padding: 2rem;
        background: var(--bg-glass);
        max-height: 90vh;
    }

    .auth-title {
        margin-top: 0;
        font-size: 1.5rem;
    }
}

/* ===== DESKTOP (1024px+) ===== */
@media (min-width: 1024px) {
    .header-content {
        max-width: 1600px;
        margin: 0 auto;
        padding: 1.2rem 3rem;
    }

    .logo-main {
        font-size: 2rem;
    }

    .nav {
        gap: 1.5rem;
    }

    .main-content {
        padding: 3rem 2rem;
    }

    .forum-grid {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
        gap: 2rem;
    }

    .forum-card {
        padding: 2rem;
    }

    .forum-card-title {
        font-size: 1.4rem;
    }

    .footer {
        padding: 2.5rem 2rem;
        margin-top: 4rem;
    }
}

/* Smooth Scroll */
html {
    scroll-behavior: smooth;
}

/* Selection */
::selection {
    background: var(--accent-primary);
    color: white;
}

::-moz-selection {
    background: var(--accent-primary);
    color: white;
}

/* ===== FORUM LAYOUT WITH SIDEBARS ===== */
.forum-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

/* Sidebar Styles */
.sidebar {
    background: var(--bg-glass);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.25rem;
    box-shadow: var(--shadow-card);
}

.sidebar-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

/* Categories Sidebar */
.categories-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.category-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-btn:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

.category-btn.active {
    background: var(--accent-gradient);
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

/* Popular Topics Sidebar */
.popular-topics-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.popular-topic-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 12px;
    background: var(--bg-glass-hover);
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.popular-topic-item:hover {
    background: var(--bg-secondary);
    transform: translateX(4px);
}

.popular-topic-rank {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-gradient);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.popular-topic-content {
    flex: 1;
    min-width: 0;
}

.popular-topic-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.popular-topic-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.popular-topic-comments {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--accent-primary);
    font-weight: 600;
}

/* Topics Area */
.topics-area {
    min-width: 0;
}

/* Mobile: Stack everything */
@media (max-width: 767px) {
    .forum-layout {
        grid-template-columns: 1fr;
    }

    .categories-sidebar {
        order: 1;
    }

    .topics-area {
        order: 2;
    }

    .popular-sidebar {
        order: 3;
    }
}

/* Tablet: Two columns */
@media (min-width: 768px) and (max-width: 1199px) {
    .forum-layout {
        grid-template-columns: 1fr 280px;
    }

    .categories-sidebar {
        grid-column: 1 / -1;
    }

    .popular-sidebar {
        position: sticky;
        top: 100px;
        height: fit-content;
    }
}

/* Desktop: Three columns */
@media (min-width: 1200px) {
    .forum-layout {
        grid-template-columns: 220px 1fr 280px;
    }

    .categories-sidebar {
        position: sticky;
        top: 100px;
        height: fit-content;
    }

    .categories-list {
        flex-direction: column;
    }

    .category-btn {
        width: 100%;
        text-align: left;
    }

    .popular-sidebar {
        position: sticky;
        top: 100px;
        height: fit-content;
    }
}