/* Reset & Base Styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    transition: background-color 0.5s ease, border-color 0.5s ease, color 0.3s ease;
}

:root {
    /* Color Palette - Dark Mode (Default) */
    --bg-primary: #0a0c10;
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-1: #6366f1; /* Indigo */
    --accent-2: #a855f7; /* Purple */
    --accent-3: #ec4899; /* Pink */
    
    --badge-bg: rgba(99, 102, 241, 0.15);
    --badge-text: #818cf8;
    
    --btn-primary-bg: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    --btn-primary-text: #ffffff;
    --btn-secondary-bg: rgba(255, 255, 255, 0.05);
    --btn-secondary-border: rgba(255, 255, 255, 0.1);
    
    --shadow-color: rgba(0, 0, 0, 0.5);
    --card-shadow: 0 20px 40px -15px var(--shadow-color),
                  0 0 50px -10px rgba(99, 102, 241, 0.15);
                  
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
}

[data-theme="light"] {
    /* Color Palette - Light Mode */
    --bg-primary: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-border: rgba(99, 102, 241, 0.12);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --accent-1: #4f46e5;
    --accent-2: #9333ea;
    --accent-3: #db2777;
    
    --badge-bg: rgba(79, 70, 229, 0.1);
    --badge-text: #4f46e5;
    
    --btn-primary-bg: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    --btn-primary-text: #ffffff;
    --btn-secondary-bg: rgba(0, 0, 0, 0.03);
    --btn-secondary-border: rgba(0, 0, 0, 0.08);
    
    --shadow-color: rgba(99, 102, 241, 0.1);
    --card-shadow: 0 20px 40px -15px var(--shadow-color),
                  0 0 50px -10px rgba(79, 70, 229, 0.1);
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
    padding-bottom: 2rem;
}

/* Background Animated Orbs */
.glow-container {
    position: fixed; /* Keep orbs in place during scrolling */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.35;
    transition: transform 0.5s ease;
}

[data-theme="light"] .glow-orb {
    opacity: 0.18;
    filter: blur(100px);
}

.orb-1 {
    width: 450px;
    height: 450px;
    background: var(--accent-1);
    top: -10%;
    left: -10%;
    animation: float-slow 20s infinite alternate;
}

.orb-2 {
    width: 550px;
    height: 550px;
    background: var(--accent-2);
    bottom: -15%;
    right: -10%;
    animation: float-reverse 25s infinite alternate;
}

.orb-3 {
    width: 350px;
    height: 350px;
    background: var(--accent-3);
    top: 30%;
    left: 70%;
    animation: pulse-slow 15s infinite alternate;
}

/* Particle Canvas */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* Main Container Layout */
.main-container {
    position: relative;
    z-index: 2;
    padding: 6rem 2rem 3rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Theme Toggle Button */
.theme-btn {
    position: fixed;
    top: 1.5rem;
    right: 2rem;
    background: var(--btn-secondary-bg);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.1rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(0);
    z-index: 999;
}

.theme-btn:hover {
    transform: translateY(-2px);
    border-color: var(--accent-1);
    color: var(--accent-1);
}

.theme-btn:active {
    transform: translateY(0);
}

/* Dashboard Header */
.dashboard-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.badge {
    background: var(--badge-bg);
    border: 1px solid rgba(99, 102, 241, 0.2);
    padding: 0.5rem 1.2rem;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-1);
    box-shadow: 0 0 10px var(--accent-1);
    animation: pulse-dot 2s infinite;
}

.badge-text {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--badge-text);
}

.title-gradient {
    font-family: var(--font-heading);
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2), var(--accent-3));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-size: 200% 200%;
    animation: gradient-shift 6s ease infinite;
    line-height: 1.15;
}

.subtitle {
    font-size: 1.15rem;
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 800px;
    margin: 0 auto;
}

/* Glassmorphic Card (Common Base) */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--card-shadow);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Stats Row */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    width: 100%;
}

.stats-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    position: relative;
    overflow: hidden;
}

.stats-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-1);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.stats-icon.active-icon {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.2);
}

.stats-icon.ended-icon {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-secondary);
    border-color: rgba(148, 163, 184, 0.2);
}

.stats-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.stats-value {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stats-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Mid Section: Charts & Insights */
.dashboard-mid-section {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 1.5rem;
    width: 100%;
}

@media (max-width: 900px) {
    .dashboard-mid-section {
        grid-template-columns: 1fr;
    }
}

.section-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-primary);
}

.icon-gradient {
    color: var(--accent-1);
}

/* Category Bars Distribution */
.category-bars {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.category-bar-row {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.category-bar-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
}

.category-bar-name {
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.category-bar-count {
    color: var(--text-secondary);
}

.category-bar-outer {
    height: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 999px;
    overflow: hidden;
    width: 100%;
    position: relative;
    border: 1px solid var(--card-border);
}

[data-theme="light"] .category-bar-outer {
    background: rgba(0, 0, 0, 0.03);
}

.category-bar-inner {
    height: 100%;
    border-radius: 999px;
    width: 0;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Accordion */
.accordion {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.accordion-item {
    border: 1px solid var(--card-border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.01);
    overflow: hidden;
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

.accordion-item.active {
    border-color: rgba(99, 102, 241, 0.3);
    background: rgba(99, 102, 241, 0.02);
}

[data-theme="light"] .accordion-item.active {
    border-color: rgba(79, 70, 229, 0.2);
    background: rgba(79, 70, 229, 0.02);
}

.accordion-header {
    width: 100%;
    padding: 1.2rem;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.accordion-header i {
    transition: transform 0.3s ease;
    color: var(--text-secondary);
}

.accordion-item.active .accordion-header i {
    transform: rotate(180deg);
    color: var(--accent-1);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0 1.2rem;
}

.accordion-item.active .accordion-content {
    max-height: 500px;
    padding-bottom: 1.2rem;
}

.accordion-content p {
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* Controls Card */
.controls-card {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.search-box {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1.1rem;
    pointer-events: none;
}

.search-box input {
    width: 100%;
    padding: 1.1rem 1.1rem 1.1rem 3.2rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
}

[data-theme="light"] .search-box input {
    background: rgba(0, 0, 0, 0.01);
}

.search-box input:focus {
    border-color: var(--accent-1);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

[data-theme="light"] .search-box input:focus {
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.filter-label {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.filter-options {
    display: flex;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    padding: 0.3rem;
    border-radius: 12px;
    flex-wrap: wrap;
}

[data-theme="light"] .filter-options {
    background: rgba(0, 0, 0, 0.02);
}

.filter-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn:hover:not(.active) {
    color: var(--text-primary);
}

.filter-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .filter-btn.active {
    background: #ffffff;
    color: var(--accent-1);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.1);
}

.sort-group {
    margin-left: auto;
}

@media (max-width: 900px) {
    .sort-group {
        margin-left: 0;
    }
}

.sort-dropdown {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    padding: 0.5rem 1.5rem 0.5rem 1rem;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 10px;
    outline: none;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

[data-theme="light"] .sort-dropdown {
    background: #ffffff;
}

.sort-dropdown:focus {
    border-color: var(--accent-1);
}

/* Declarations Grid */
.declarations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    width: 100%;
}

@media (max-width: 480px) {
    .declarations-grid {
        grid-template-columns: 1fr;
    }
}

/* Declaration Card */
.declaration-card {
    --card-accent: var(--accent-1);
    --accent-rgb: 99, 102, 241;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    align-items: flex-start;
    text-align: left;
    padding: 1.75rem;
    position: relative;
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), 
                box-shadow 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), 
                border-color 0.3s ease;
}

.declaration-card:hover {
    transform: translateY(-5px);
    border-color: rgba(var(--accent-rgb), 0.35);
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.4),
                0 0 30px -10px rgba(var(--accent-rgb), 0.15);
}

[data-theme="light"] .declaration-card:hover {
    border-color: rgba(var(--accent-rgb), 0.3);
    box-shadow: 0 15px 30px -10px rgba(var(--accent-rgb), 0.12);
}

/* Card Glow Mouse Effect */
.card-glow-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), 
                                rgba(var(--accent-rgb), 0.08) 0%, 
                                transparent 50%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.declaration-card:hover .card-glow-overlay {
    opacity: 1;
}

/* Card Badges Row */
.card-badges {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.category-badge {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    background: rgba(var(--accent-rgb), 0.12);
    color: rgb(var(--accent-rgb));
    border: 1px solid rgba(var(--accent-rgb), 0.2);
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
}

.status-badge.active-status {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-badge.ended-status {
    background: rgba(148, 163, 184, 0.12);
    color: var(--text-secondary);
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.status-indicator-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-badge.active-status .status-indicator-dot {
    background: #10b981;
    box-shadow: 0 0 6px #10b981;
}

.status-badge.ended-status .status-indicator-dot {
    background: var(--text-secondary);
}

/* Card Content styling */
.card-main {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.card-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.4;
    transition: color 0.3s ease;
}

.declaration-card:hover .card-title {
    color: rgb(var(--accent-rgb));
}

.card-source-tag {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.card-dates-box {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border-left: 2px solid rgba(var(--accent-rgb), 0.25);
    padding-left: 0.75rem;
    margin: 0.2rem 0;
}

.date-item strong {
    color: var(--text-primary);
}

.card-desc {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

.card-footer {
    width: 100%;
    margin-top: auto;
    display: flex;
    justify-content: flex-end;
}

.source-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    transition: all 0.2s ease;
}

[data-theme="light"] .source-link-btn {
    background: rgba(0, 0, 0, 0.02);
}

.source-link-btn:hover {
    background: rgba(var(--accent-rgb), 0.1);
    border-color: rgba(var(--accent-rgb), 0.3);
    color: rgb(var(--accent-rgb));
    transform: translateX(2px);
}

/* No Results Panel */
.no-results {
    width: 100%;
    text-align: center;
    padding: 4rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.no-results-icon {
    font-size: 3rem;
    color: var(--text-secondary);
    opacity: 0.5;
}

.no-results h3 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    color: var(--text-primary);
}

.no-results p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    max-width: 400px;
}

/* Footer */
.dashboard-footer {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2rem;
    opacity: 0.7;
}

/* Animations and keyframes */
@keyframes float-slow {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(5%, 8%) scale(1.05); }
}

@keyframes float-reverse {
    0% { transform: translate(0, 0) scale(1.05); }
    100% { transform: translate(-5%, -8%) scale(0.95); }
}

@keyframes pulse-slow {
    0% { transform: scale(1); opacity: 0.25; }
    100% { transform: scale(1.1); opacity: 0.45; }
}

@keyframes pulse-dot {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 8px rgba(99, 102, 241, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
    }
}

@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .main-container {
        padding: 5rem 1rem 2rem 1rem;
        gap: 1.5rem;
    }
    
    .title-gradient {
        font-size: 2.5rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }

    .filters-row {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }

    .filter-options {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
        text-align: center;
    }

    .filter-btn {
        width: 100%;
        padding: 0.5rem 0.2rem;
    }

    .sort-dropdown {
        width: 100%;
    }
}
