:root {
    --bg-main: #0b0f19;
    --bg-card: rgba(22, 28, 45, 0.6);
    --border-color: rgba(255, 255, 255, 0.08);
    --primary: #00f2fe;
    --primary-glow: rgba(0, 242, 254, 0.4);
    --secondary: #4facfe;
    --text-main: #ffffff;
    --text-muted: #8b99b5;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --card-radius: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(79, 172, 254, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(0, 242, 254, 0.08) 0%, transparent 50%);
    overflow-x: hidden;
}

.hidden { display: none !important; }

/* Dashboard Screens Visibility Control */
.hidden-screen { opacity: 0; transform: translateY(20px); transition: opacity 0.4s ease, transform 0.4s ease; }
.hidden-screen.active { opacity: 1; transform: translateY(0); display: block !important; }

/* Splash Screen */
.splash-screen {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.splash-content { text-align: center; }
.logo-icon.large { width: 80px; height: 80px; font-size: 3rem; border-radius: 20px; margin: 0 auto 1.5rem; }
.splash-logo { font-size: 2.5rem; margin-bottom: 2rem; }
.splash-logo span { color: var(--primary); font-weight: 300; }
.loader-bar { width: 250px; height: 4px; background: rgba(255,255,255,0.05); border-radius: 10px; margin: 0 auto 1.5rem; overflow: hidden; position: relative; }
.loader-progress { width: 0%; height: 100%; background: var(--primary); box-shadow: 0 0 15px var(--primary-glow); animation: loadProgress 2s forwards ease-in-out; }
.splash-tagline { color: var(--text-muted); letter-spacing: 2px; text-transform: uppercase; font-size: 0.8rem; opacity: 0; animation: fadeIn 0.5s 1s forwards; }

@keyframes loadProgress { 0% { width: 0%; } 100% { width: 100%; } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Login Screen */
.login-screen {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    background-image: 
        radial-gradient(circle at 50% 50%, rgba(0, 242, 254, 0.05) 0%, transparent 70%);
}

.login-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    padding: 3rem;
    border-radius: var(--card-radius);
    width: 400px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.4);
}

.login-card h2 { margin: 1.5rem 0 0.5rem; font-size: 1.8rem; }
.login-subtitle { color: var(--text-muted); margin-bottom: 2.5rem; font-size: 0.9rem; }

.input-group {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.8rem 1.2rem;
    margin-bottom: 1.2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
}

.input-group:focus-within { border-color: var(--primary); box-shadow: 0 0 15px rgba(0, 242, 254, 0.1); }
.input-group i { color: var(--text-muted); width: 18px; }
.input-group input { background: transparent; border: none; outline: none; color: white; width: 100%; }

.login-error { color: var(--danger); font-size: 0.85rem; margin-bottom: 1.2rem; background: rgba(239, 68, 68, 0.1); padding: 0.5rem; border-radius: 8px; border: 1px solid rgba(239, 68, 68, 0.2); }

/* Base Layout Container */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: 280px;
    background: rgba(11, 15, 25, 0.8);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 2rem;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 3rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.5rem;
    color: #fff;
    box-shadow: 0 0 20px var(--primary-glow);
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo-text span {
    color: var(--primary);
    font-weight: 300;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 12px;
    transition: var(--transition);
    font-weight: 500;
}

.nav-item i {
    width: 20px;
}

.nav-item:hover, .nav-item.active {
    background: rgba(255,255,255,0.05);
    color: var(--text-main);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(0, 242, 254, 0.1) 0%, transparent 100%);
    border-left: 3px solid var(--primary);
}

.nav-item.active i {
    color: var(--primary);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

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

.avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
    padding: 2px;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 0.95rem;
}

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

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 2rem 3rem;
}

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

.header-search {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 0.8rem 1.5rem;
    border-radius: 100px;
    width: 400px;
    transition: var(--transition);
}

.header-search:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.2);
}

.header-search i {
    color: var(--text-muted);
    margin-right: 0.8rem;
}

.header-search input {
    background: transparent;
    border: none;
    color: var(--text-main);
    outline: none;
    width: 100%;
    font-size: 0.95rem;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.icon-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}

.icon-btn:hover {
    background: rgba(255,255,255,0.1);
}

.badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    border: 2px solid var(--bg-main);
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 100px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 5px 15px rgba(0, 242, 254, 0.3);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 242, 254, 0.4);
}

/* Dashboard Grid Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: auto auto auto;
    gap: 1.5rem;
}

.card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--card-radius);
    padding: 1.5rem;
    transition: var(--transition);
}

.card:hover {
    border-color: rgba(255,255,255,0.15);
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.stat-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    position: relative;
    overflow: hidden;
}

.card-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.status-success { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.status-warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.status-info { background: rgba(0, 242, 254, 0.1); color: var(--primary); }

.stat-info h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.trend {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: 500;
}

.trend.positive { color: var(--success); }
.trend.negative { color: var(--danger); }
.trend.neutral { color: var(--text-muted); }

/* Custom Timer Card */
.timer-card {
    background: linear-gradient(135deg, rgba(0, 242, 254, 0.05), rgba(79, 172, 254, 0.1));
    border-color: rgba(0, 242, 254, 0.3);
}

.timer-card .card-icon {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 0 15px var(--primary-glow);
}

.timer-display {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--primary);
    text-shadow: 0 0 10px rgba(0, 242, 254, 0.3);
    font-variant-numeric: tabular-nums;
    letter-spacing: 2px;
}

.subtitle {
    font-size: 0.85rem;
    margin-top: 0.2rem;
}
.text-primary { color: var(--primary); }

/* Pulse Animation */
.pulse-ring {
    position: absolute;
    top: -50px;
    right: -50px;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 242, 254, 0.2) 0%, transparent 70%);
    animation: pulse 3s infinite cubic-bezier(0.215, 0.61, 0.355, 1);
}

@keyframes pulse {
    0% { transform: scale(0.8); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: scale(2); opacity: 0; }
}

/* Charts & Main Sections */
.main-chart-card {
    grid-column: span 3;
    display: flex;
    flex-direction: column;
}

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

.card-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-container {
    flex: 1;
    position: relative;
    width: 100%;
    height: 300px;
}

.custom-select {
    background: rgba(255,255,255,0.05);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    outline: none;
    font-family: inherit;
}

/* Trends List */
.trends-card {
    grid-column: span 1;
    display: flex;
    flex-direction: column;
}

.icon-flame {
    color: var(--warning);
    fill: var(--warning);
}

.trends-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.trend-item {
    display: flex;
    align-items: center;
    padding: 0.8rem;
    background: rgba(255,255,255,0.03);
    border-radius: 12px;
    transition: var(--transition);
}

.trend-item:hover {
    background: rgba(255,255,255,0.06);
}

.rank {
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--text-muted);
    width: 30px;
}

.trend-details {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.trend-name {
    font-weight: 600;
    font-size: 0.95rem;
}

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

.trend-match {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.trend-match.high { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.trend-match.medium { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.trend-match.low { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

.secondary-btn {
    background: rgba(255,255,255,0.05);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.secondary-btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
}

.w-full { width: 100%; }
.mt-auto { margin-top: auto; }

/* Map Section */
.map-card {
    grid-column: span 4;
}

.map-container {
    height: 350px;
    border-radius: 12px;
    background: #1a1a1a;
    overflow: hidden;
    position: relative;
    z-index: 10;
}

.map-legend {
    display: flex;
    gap: 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.dot.high { background: var(--danger); box-shadow: 0 0 8px var(--danger); }
.dot.med { background: var(--warning); box-shadow: 0 0 8px var(--warning); }

/* Customize Leaflet Dark Mode inside the container */
.leaflet-container {
    background: #0b0f19;
    font-family: 'Outfit', sans-serif;
}

.leaflet-control-zoom a {
    background: var(--bg-card) !important;
    color: var(--text-main) !important;
    border: 1px solid var(--border-color) !important;
}

/* New Publications Card */
.publications-card { grid-column: span 1; display: flex; flex-direction: column; }
.publications-list { display: flex; flex-direction: column; gap: 0.8rem; }
.pub-item { display: flex; align-items: center; padding: 0.8rem; background: rgba(255,255,255,0.03); border-radius: 12px; transition: var(--transition); }
.pub-item:hover { background: rgba(255,255,255,0.06); }
.social-icon { width: 36px; height: 36px; padding: 6px; border-radius: 8px; margin-right: 1rem; color: white; display: flex; align-items: center; justify-content: center; }
.social-icon.twitter { background: #1DA1F2; }
.social-icon.instagram { background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%); }
.social-icon.facebook { background: #1877F2; }
.social-icon.tiktok { background: #000000; border: 1px solid #fff; }
.social-icon.youtube { background: #FF0000; }
.social-icon.whatsapp { background: #25D366; }
.pub-details { display: flex; flex-direction: column; flex: 1; }
.pub-name { font-weight: 600; font-size: 0.95rem; }
.pub-time { font-size: 0.75rem; color: var(--text-muted); }

/* Pie Chart Card */
.pie-chart-card { grid-column: span 1; display: flex; flex-direction: column; }
.pie-container { height: 250px; display: flex; justify-content: center; align-items: center; }

/* AI Design Card */
.ai-design-card { grid-column: span 2; display: flex; flex-direction: column; }
.span-2 { grid-column: span 2; }
.icon-sparkles { color: #8b5cf6; fill: #8b5cf6; margin-left: 0.5rem; }
.badge.prompt { background: rgba(139, 92, 246, 0.2); color: #c4b5fd; padding: 0.3rem 0.8rem; border-radius: 100px; font-size: 0.75rem; border: 1px solid rgba(139, 92, 246, 0.4); }
.ai-content-box { flex: 1; background: #0b0f19; border-radius: 12px; padding: 1.5rem; border: 1px solid var(--border-color); position: relative; overflow: hidden; }
.ai-status { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1rem; display: flex; align-items: center; gap: 0.5rem; }
.ai-status::before { content: ''; width: 8px; height: 8px; background: var(--primary); border-radius: 50%; display: inline-block; animation: blink 1s infinite alternate; }
.ai-generated-text { font-size: 1.05rem; line-height: 1.6; color: #e2e8f0; font-family: 'Outfit', monospace; position: relative; }
.ai-generated-text .cursor { display: inline-block; width: 8px; height: 1.2em; background: var(--primary); vertical-align: middle; animation: blink 1s infinite; margin-left: 4px; }

@keyframes blink { 0% { opacity: 1; } 100% { opacity: 0; } }

@keyframes blink { 0% { opacity: 1; } 100% { opacity: 0; } }

/* History Table Styles */
.history-card { grid-column: span 2; display: flex; flex-direction: column; }
.history-table-container { flex: 1; overflow-y: auto; margin-top: 1rem; }
.history-table { width: 100%; border-collapse: collapse; text-align: left; }
.history-table th { padding: 0.8rem; color: var(--text-muted); font-weight: 500; font-size: 0.85rem; border-bottom: 1px solid var(--border-color); }
.history-table td { padding: 1rem 0.8rem; border-bottom: 1px solid var(--border-color); font-size: 0.9rem; }
.history-table tr:last-child td { border-bottom: none; }
.status-pill { padding: 0.25rem 0.6rem; border-radius: 100px; font-size: 0.75rem; font-weight: 600; }
.status-pill.ok { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.status-pill.warn { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.table-icon { width: 18px; height: 18px; vertical-align: middle; }
.table-icon.tw { color: #1DA1F2; }
.table-icon.ig { color: #E1306C; }
.table-icon.fb { color: #1877F2; }
.table-icon.yt { color: #FF0000; }

/* Top Posts Styles */
.top-posts-card { grid-column: span 1; }
.top-list { display: flex; flex-direction: column; gap: 0.8rem; margin-top: 1rem; }
.top-item { display: flex; align-items: center; gap: 1rem; padding: 0.8rem; border-radius: 12px; background: rgba(255,255,255,0.02); transition: var(--transition); }
.top-item:hover { background: rgba(255,255,255,0.05); }
.medal { font-size: 1.5rem; }
.top-info { display: flex; flex-direction: column; }
.top-name { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.top-meta { font-size: 0.75rem; color: var(--text-muted); }
.icon-award { color: var(--warning); }

/* Impact Chart Styles */
.impact-stats-card { grid-column: span 1; }
.chart-container.mini { height: 180px; }

/* Responsive Enhancements */
@media (max-width: 1200px) {
    .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
    .main-chart-card { grid-column: span 2; }
    .trends-card { grid-column: span 1; }
    .map-card { grid-column: span 2; }
    .publications-card { grid-column: span 1; }
    .pie-chart-card { grid-column: span 1; }
    .ai-design-card.span-2 { grid-column: span 2; }
    .history-card.span-2 { grid-column: span 2; }
    .top-posts-card { grid-column: span 1; }
    .impact-stats-card { grid-column: span 1; }
}

@media (max-width: 900px) {
    .sidebar { width: 80px; padding: 1.5rem 1rem; }
    .logo-text, .user-info, .sidebar-footer, .nav-item span { display: none; }
    .main-content { margin-left: 80px; padding: 1.5rem; }
    .header-search { width: 250px; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .span-2, .main-chart-card, .map-card, .history-card, .ai-design-card { grid-column: span 1 !important; }
}

@media (max-width: 600px) {
    .main-content { padding: 1rem; }
    .top-header { flex-direction: column; gap: 1rem; align-items: stretch; }
    .header-search { width: 100%; }
    .header-actions { justify-content: space-between; }
    .stat-value { font-size: 1.5rem; }
    .timer-display { font-size: 1.8rem; }
    .history-table { display: block; overflow-x: auto; white-space: nowrap; }
}

/* Campaigns, Trends, Analytics & Settings Styles */
.campaign-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; margin-top: 2rem; }
.campaign-card { padding: 2rem; }
.campaign-header { display: flex; justify-content: space-between; align-items: start; margin-bottom: 1rem; }
.campaign-desc { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.5rem; }
.campaign-stats { display: flex; gap: 2rem; border-top: 1px solid var(--border-color); padding-top: 1rem; }
.campaign-stats .stat { display: flex; flex-direction: column; }
.campaign-stats span { font-size: 0.75rem; color: var(--text-muted); }

.word-cloud { display: flex; flex-wrap: wrap; gap: 1rem; padding: 2rem; justify-content: center; }
.tag { padding: 0.5rem 1rem; border-radius: 100px; background: rgba(0, 242, 254, 0.1); color: var(--primary); font-weight: 600; border: 1px solid var(--primary-glow); }
.tag.x-large { font-size: 2rem; padding: 1rem 2rem; }
.tag.large { font-size: 1.5rem; }
.tag.med { font-size: 1.2rem; }

.chart-container.large { height: 400px; }

.settings-container { max-width: 600px; margin-top: 2rem; }
.settings-form h3 { margin-bottom: 1.5rem; font-size: 1.1rem; }
.settings-form label { display: block; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.settings-form .input-group { border-color: rgba(255,255,255,0.1); }
