:root {
    --bg-dark: #0f172a;
    --text-primary: #f8fafc;
    --text-light: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #ec4899;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    --success: #10b981;
    --danger: #ef4444;
    --nav-bg: rgba(15, 23, 42, 0.7);
    --panel-bg: rgba(0, 0, 0, 0.2);
    --input-color: white;
}

body.light-mode {
    --bg-dark: #f1f5f9;
    --text-primary: #1e293b;
    --text-light: #1e293b;
    --text-muted: #64748b;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(99, 102, 241, 0.1);
    --glass-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
    --nav-bg: rgba(255, 255, 255, 0.8);
    --panel-bg: rgba(255, 255, 255, 0.5);
    --input-color: #1e293b;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.15), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(236, 72, 153, 0.15), transparent 25%);
}

body.light-mode {
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.05), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(236, 72, 153, 0.05), transparent 25%);
}

h1, h2, h3, .logo {
    font-family: 'Outfit', sans-serif;
}

/* Glassmorphism Utilities */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
}

.gradient-text {
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Typography & Layout */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    padding-top: 100px;
}

.w-100 { width: 100%; }

/* Buttons */
.btn {
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-light);
}

.btn-outline:hover {
    border-color: var(--text-light);
    background: rgba(255, 255, 255, 0.05);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: 0.2s;
    font-size: 1.1rem;
}

.btn-icon:hover { color: var(--primary); transform: scale(1.1); }
.btn-icon.active-upvote { color: var(--success); }
.btn-icon.active-downvote { color: var(--danger); }
.btn-icon.active-save { 
    color: var(--secondary); 
    text-shadow: 0 0 10px rgba(236, 72, 153, 0.5);
}

/* Navigation */
.glass-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--nav-bg);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--glass-border);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo i { color: var(--primary); }

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    margin-right: 1.5rem;
    font-weight: 500;
    transition: 0.3s;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--text-light);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Hero Section */
.hero {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease backwards;
}

.hero h1 { font-size: 3.5rem; line-height: 1.2; margin-bottom: 1rem; }
.hero p { color: var(--text-muted); font-size: 1.1rem; margin-bottom: 2rem; }

/* Filter & Search */
.search-filter-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem;
    justify-content: space-between;
    align-items: center;
}

.search-box {
    flex: 1;
    min-width: 250px;
    display: flex;
    align-items: center;
    background: var(--panel-bg);
    border-radius: 8px;
    padding: 0 1rem;
    border: 1px solid var(--glass-border);
}

.search-box i { color: var(--text-muted); }
.search-box input {
    background: transparent;
    border: none;
    color: var(--input-color);
    padding: 0.8rem;
    width: 100%;
    outline: none;
}

.filters { display: flex; gap: 1rem; }
.filters select {
    background: var(--panel-bg);
    border: 1px solid var(--glass-border);
    color: var(--input-color);
    padding: 0.8rem;
    border-radius: 8px;
    outline: none;
}
.filters select option { background: var(--bg-dark); color: var(--text-primary); }

/* Grid & Cards */
.terms-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.term-card {
    padding: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: fadeInUp 0.6s ease backwards;
    display: flex;
    flex-direction: column;
}

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

.term-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.term-header h3 { font-size: 1.3rem; margin: 0; }
.badge {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.term-def { margin-bottom: 1rem; color: var(--text-light); line-height: 1.5; flex-grow: 1;}
.term-example {
    background: var(--panel-bg);
    padding: 1rem;
    border-radius: 8px;
    border-left: 3px solid var(--secondary);
    font-size: 0.9rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 1rem;
}

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

.votes { display: flex; align-items: center; gap: 1rem; }
.vote-item { display: flex; align-items: center; gap: 0.3rem; font-size: 0.9rem; color: var(--text-muted); }

.author-info { font-size: 0.8rem; color: var(--text-muted); }

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active { display: flex; opacity: 1; }

.modal {
    width: 90%;
    max-width: 400px;
    padding: 2rem;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal { transform: scale(1); }

.close-btn {
    position: absolute;
    top: 1rem; right: 1rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
}

.form-group { margin-bottom: 1.2rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-size: 0.9rem; color: var(--text-muted); }
.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    padding: 0.8rem;
    background: var(--panel-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--input-color);
    outline: none;
}
.form-group input:focus, .form-group textarea:focus { border-color: var(--primary); }
.form-footer { margin-top: 1.2rem; text-align: center; font-size: 0.9rem; }
.form-footer a { color: var(--primary); text-decoration: none; }

/* Dashboard Tables */
.admin-panel { padding: 2rem; }
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
th, td { padding: 1rem; text-align: left; border-bottom: 1px solid var(--glass-border); }
th { color: var(--text-muted); font-weight: 500; }
.action-btns { display: flex; gap: 0.5rem; }
.btn-small { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
.btn-success { background: rgba(16, 185, 129, 0.2); color: var(--success); border: 1px solid var(--success); }
.btn-success:hover { background: var(--success); color: white; }
.btn-danger { background: rgba(239, 68, 68, 0.2); color: var(--danger); border: 1px solid var(--danger); }
.btn-danger:hover { background: var(--danger); color: white; }

/* Animations */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Layout Upgrade */
.home-grid-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
}

.section-title { margin-bottom: 2rem; font-size: 1.8rem; }

/* Side Column Panels */
.trending-panel, .leaderboard-panel {
    padding: 1.5rem;
    position: sticky;
    top: 100px;
}

.trending-item, .lead-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--glass-border);
}

.trending-item:last-child { border: none; }

/* Stat Cards */
.analytics-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    padding: 1.5rem;
    text-align: center;
}

.stat-card h4 { color: var(--text-muted); font-size: 0.9rem; text-transform: uppercase; margin-bottom: 0.5rem; }
.stat-card p { font-size: 2rem; font-weight: 800; color: var(--primary); }

/* Notifications */
.nav-right { display: flex; align-items: center; gap: 1.5rem; }
.notifications-bell { position: relative; cursor: pointer; font-size: 1.2rem; color: var(--text-muted); }
.notif-badge {
    position: absolute;
    top: -5px; right: -5px;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    padding: 2px 5px;
    border-radius: 50%;
}

.notif-dropdown {
    position: absolute;
    top: 150%; right: 0;
    width: 300px;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
}

.notif-dropdown.active { display: block; }

.notif-item {
    padding: 1rem;
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.85rem;
    transition: 0.2s;
}

.notif-item:hover { background: rgba(255,255,255,0.05); }

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

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

/* Glowing Buttons */
.btn-primary {
    position: relative;
    overflow: hidden;
}

.btn-primary::after {
    content: '';
    position: absolute;
    top: -50%; left: -50%; width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 70%);
    opacity: 0;
    transition: 0.5s;
}

.btn-primary:hover::after { opacity: 1; }

/* Comments */
.comments-list { max-height: 300px; overflow-y: auto; padding-right: 0.5rem; }
.comment-item {
    padding: 1rem;
    background: var(--panel-bg);
    border-radius: 8px;
    margin-bottom: 0.8rem;
}
.comment-author { font-weight: 600; font-size: 0.85rem; color: var(--primary); margin-bottom: 0.2rem; }
.comment-text { font-size: 0.9rem; color: var(--text-primary); }

@media (max-width: 900px) {
    .home-grid-layout { grid-template-columns: 1fr; }
    .side-column { display: none; }
}
