:root {
    --bg: #f8fafc;
    --surface: #ffffff;
    --primary: #8b5cf6;
    --secondary: #ec4899;
    --accent: #3b82f6;
    --text: #0f172a;
    --text-dim: #64748b;
    --glass: rgba(255, 255, 255, 0.7);
    --border: rgba(139, 92, 246, 0.1);
    --glow: 0 10px 40px rgba(139, 92, 246, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
}

/* --- Header --- */
header {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 15px 5%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(15px);
    z-index: 1000;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.03);
}

.logo {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -1px;
    text-decoration: none;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 5px;
}

.logo span {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 32px;
}

nav a {
    color: var(--text-dim);
    text-decoration: none;
    margin-left: 25px;
    font-size: 14px;
    font-weight: 500;
    transition: 0.3s;
}

nav a:hover {
    color: var(--primary);
}

/* --- Hero --- */
.hero {
    padding: 180px 5% 120px;
    text-align: center;
    position: relative;
    background:
        radial-gradient(circle at 0% 0%, rgba(139, 92, 246, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 100% 100%, rgba(236, 72, 153, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 50% 30%, rgba(139, 92, 246, 0.05), transparent 70%);
}

.hero h1 {
    font-size: clamp(40px, 8vw, 72px);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 20px;
    color: var(--text);
    letter-spacing: -2px;
}

.hero h1 span {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    color: var(--text-dim);
    font-size: 20px;
    max-width: 600px;
    margin: 0 auto 40px;
}

.search-wrapper {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.search-input {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 22px 30px;
    border-radius: 24px;
    color: var(--text);
    font-size: 17px;
    outline: none;
    transition: 0.3s;
    box-shadow: 0 15px 45px rgba(139, 92, 246, 0.1);
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 15px 45px rgba(139, 92, 246, 0.15);
}

/* --- Categories --- */
.section-title {
    padding: 0 5%;
    margin-bottom: 40px;
    font-size: 32px;
    font-weight: 800;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 15px;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    padding: 0 5% 80px;
}

.cat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 35px;
    border-radius: 32px;
    text-decoration: none;
    color: var(--text);
    transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
}

.cat-card:hover {
    transform: translateY(-10px) scale(1.02);
    border-color: var(--primary);
    box-shadow: 0 20px 40px rgba(139, 92, 246, 0.1);
}

.cat-card i {
    margin-bottom: 25px;
    display: inline-flex;
    width: 60px;
    height: 60px;
    background: rgba(139, 92, 246, 0.05);
    border-radius: 20px;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}

.cat-card:hover i {
    background: var(--primary);
    color: white !important;
}

.cat-card h3 {
    font-size: 22px;
    margin-bottom: 12px;
    font-weight: 700;
}

.cat-card p {
    color: var(--text-dim);
    font-size: 15px;
    line-height: 1.6;
}

.glow-dot {
    position: absolute;
    top: 25px;
    right: 25px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
}

/* --- Content Layout --- */
.content-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 40px;
    padding: 50px 5%;
}

.main-article {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 50px;
    border-radius: 40px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.02);
}

.main-article h2 {
    font-size: 36px;
    margin-bottom: 30px;
    font-weight: 800;
    color: var(--text);
}

.main-article p {
    margin-bottom: 25px;
    color: var(--text-dim);
    font-size: 18px;
    line-height: 1.8;
}

.sidebar-card {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 30px;
    border-radius: 32px;
    margin-bottom: 30px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.02);
}

.sidebar-card h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
}

/* --- Footer --- */
footer {
    padding: 100px 5% 50px;
    background: #fff;
    border-top: 1px solid var(--border);
    text-align: center;
}

.footer-logo {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 30px;
}

.footer-links {
    margin-bottom: 50px;
}

.footer-links a {
    color: var(--text-dim);
    text-decoration: none;
    margin: 0 20px;
    font-size: 15px;
    font-weight: 500;
    transition: 0.3s;
}

.footer-links a:hover {
    color: var(--primary);
}

.copyright {
    color: #94a3b8;
    font-size: 14px;
}

@media (max-width: 1000px) {
    .content-layout {
        grid-template-columns: 1fr;
    }
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        opacity: 0.7;
    }

    50% {
        transform: scale(1.05);
        opacity: 1;
    }

    100% {
        transform: scale(0.95);
        opacity: 0.7;
    }
}

/* --- Chat Room Overlay --- */
#chatRoom {
    display: none;
    position: fixed;
    top: 80px;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg);
    z-index: 1000;
}

.chat-room-container {
    display: grid;
    grid-template-columns: 240px 1fr 240px;
    height: 100%;
    min-height: 0;
    background: #fff;
    border-radius: 30px;
    overflow: hidden;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border);
    margin: 20px 5%;
}

.chat-sidebar {
    background: #f8fafc;
    border-right: 1px solid var(--border);
    padding: 30px 20px;
    overflow-y: auto;
}

.chat-sidebar.right {
    border-right: none;
    border-left: 1px solid var(--border);
    background: #fff;
}

.chat-main {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 0;
    background: #fff;
    overflow: hidden;
}

.chat-header {
    padding: 20px 30px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.chat-messages {
    flex: 1;
    min-height: 0;
    padding: 30px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
}

.chat-input-area {
    padding: 20px 30px;
    border-top: 1px solid var(--border);
    background: #fff;
    flex-shrink: 0;
}

/* Mobile Chat Adjustments */
@media (max-width: 1000px) {
    #chatRoom {
        top: 0;
        z-index: 2000;
        background: #fff;
        /* Full screen on mobile */
    }

    .chat-room-container {
        grid-template-columns: 1fr;
        border-radius: 0;
        border: none;
        margin: 0;
        height: 100vh; /* Fallback */
        height: 100dvh;
    }

    .chat-sidebar {
        display: none;
        /* Hide sidebars on mobile initially */
    }
    
    .chat-header {
        position: sticky;
        top: 0;
        background: rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(10px);
        z-index: 10;
        padding: 15px;
    }

    .chat-input-area {
        position: sticky;
        bottom: 0;
        padding: 15px;
        background: #fff;
        padding-bottom: max(15px, env(safe-area-inset-bottom));
    }
}