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

:root {
    --primary: #4F46E5;
    --primary-light: #6366F1;
    --primary-dark: #3730A3;
    --bg-dark: #0F172A;
    --bg-card: #1E293B;
    --bg-hover: #334155;
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-dark: #1E293B;
    --text-light: #64748B;
    --border: #E2E8F0;
    --border-dark: #334155;
    --white: #FFFFFF;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--white);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
}

/* ==================== LOGIN PAGE STYLES ==================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-box {
    background: var(--white);
    border-radius: 20px;
    padding: 48px 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
}

.login-header {
    text-align: center;
    margin-bottom: 36px;
}

.login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.login-logo .logo-icon {
    width: 60px;
    height: 60px;
}

.login-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.3;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-dark);
}

.form-group input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 15px;
    color: var(--text-dark);
    background: var(--white);
    transition: var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.login-btn {
    width: 100%;
    padding: 16px;
    background: var(--primary);
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition);
    margin-top: 12px;
}

.login-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.3);
}

.login-btn svg {
    width: 20px;
    height: 20px;
}

.login-footer {
    text-align: center;
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.login-footer p {
    font-size: 14px;
    color: var(--text-light);
}

.login-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.login-footer a:hover {
    text-decoration: underline;
}

/* ==================== DASHBOARD STYLES ==================== */
.dashboard-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--white);
}

/* Header */
.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left .logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 0;
}

.header-left .logo-icon {
    width: 36px;
    height: 36px;
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
}

.header-center {
    flex: 1;
    max-width: 500px;
    margin: 0 32px;
}

.search-container {
    display: flex;
    align-items: center;
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 4px;
    transition: var(--transition);
}

.search-container:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.search-icon {
    width: 20px;
    height: 20px;
    color: var(--text-light);
    margin-left: 12px;
}

.search-input {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: transparent;
    font-size: 15px;
    color: var(--text-dark);
    outline: none;
}

.search-input::placeholder {
    color: var(--text-light);
}

.search-btn {
    padding: 10px 20px;
    background: var(--primary);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: white;
    cursor: pointer;
    transition: var(--transition);
}

.search-btn:hover {
    background: var(--primary-dark);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-indicators {
    display: flex;
    gap: 10px;
}

.indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
}

.indicator svg {
    width: 16px;
    height: 16px;
}

.user-badge {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
}

.admin-badge {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.admin-badge svg {
    color: #059669;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    background: var(--bg-dark);
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.user-profile:hover {
    background: var(--bg-hover);
}

.avatar {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: white;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--white);
}

/* Main Content Layout */
.main-content {
    display: flex;
    flex: 1;
}

/* Left Sidebar */
.left-sidebar {
    width: 260px;
    background: var(--white);
    border-right: 1px solid var(--border);
    padding: 24px 16px;
    position: sticky;
    top: 73px;
    height: calc(100vh - 73px);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-light);
    padding: 0 12px;
    margin-bottom: 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 10px;
    color: var(--text-light);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: var(--transition);
}

.nav-item svg {
    width: 20px;
    height: 20px;
}

.nav-item:hover {
    background: rgba(79, 70, 229, 0.05);
    color: var(--primary);
}

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

.nav-item.active svg {
    color: white;
}

/* Content Area */
.content-area {
    flex: 1;
    padding: 32px;
    background: #f8fafc;
}

.section-header {
    margin-bottom: 28px;
}

.section-header h2 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.section-header p {
    color: var(--text-light);
    font-size: 15px;
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Trends Grid */
.trends-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 20px;
}

.trend-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    transition: var(--transition);
}

.trend-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.trend-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    color: white;
    margin-bottom: 16px;
}

.trend-info {
    margin-bottom: 16px;
}

.trend-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.trend-posts {
    color: var(--text-light);
    font-size: 14px;
}

.trend-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.trend-stats .stat {
    flex: 1;
    text-align: center;
    padding: 12px;
    background: #f1f5f9;
    border-radius: 10px;
}

.stat-value {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
}

.stat-label {
    display: block;
    font-size: 11px;
    color: var(--text-light);
    margin-top: 4px;
}

.trend-bar {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    background: #f1f5f9;
}

.bar-segment {
    height: 100%;
    transition: var(--transition);
}

.bar-segment.reddit {
    background: #FF4500;
}

.bar-segment.linkedin {
    background: #0A66C2;
}

.bar-segment.twitter {
    background: #1DA1F2;
}

/* Compare Section */
.compare-container {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.compare-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.platform-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    transition: var(--transition);
}

.platform-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.platform-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.platform-icon {
    width: 40px;
    height: 40px;
}

.platform-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-dark);
}

.platform-stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.platform-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f8fafc;
    border-radius: 10px;
}

.platform-stat.overall {
    background: rgba(79, 70, 229, 0.08);
    border: 1px solid rgba(79, 70, 229, 0.2);
}

.platform-stat .stat-label {
    color: var(--text-light);
    font-size: 14px;
}

.platform-stat .stat-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
}

.platform-stat .stat-value.positive {
    color: #10B981;
}

.platform-stat .stat-value.negative {
    color: #EF4444;
}

.platform-stat .stat-value.neutral {
    color: #F59E0B;
}

.chart-container {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px;
}

.chart-container h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 20px;
    text-align: center;
}

.chart-container canvas {
    max-height: 380px;
}

/* Platform Analysis Section */
.analysis-section {
    margin-top: 48px;
}

.platforms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.platform-box {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 28px;
    transition: var(--transition);
}

.platform-box:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
}

.platform-title {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.platform-logo {
    width: 44px;
    height: 44px;
}

.platform-title h3 {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-dark);
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.metric-box {
    background: #f8fafc;
    border-radius: 14px;
    padding: 18px;
    text-align: center;
    transition: var(--transition);
}

.metric-box:hover {
    transform: scale(1.02);
}

.metric-value {
    display: block;
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 6px;
}

.metric-box.positive .metric-value {
    color: #10B981;
}

.metric-box.negative .metric-value {
    color: #EF4444;
}

.metric-box.neutral .metric-value {
    color: #F59E0B;
}

.metric-box.confidence .metric-value {
    color: var(--primary);
}

.metric-label {
    font-size: 13px;
    color: var(--text-light);
}

/* Topics Section */
.topics-section {
    margin-top: 48px;
}

.topics-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.topic-item {
    display: flex;
    align-items: center;
    padding: 20px 24px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 14px;
    transition: var(--transition);
}

.topic-item:hover {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.02);
}

.topic-name {
    flex: 1;
    font-size: 17px;
    font-weight: 600;
    color: var(--text-dark);
}

.topic-posts {
    color: var(--text-light);
    font-size: 14px;
    margin-right: 32px;
}

.topic-growth {
    font-size: 16px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
}

.topic-growth.positive {
    background: rgba(16, 185, 129, 0.1);
    color: #10B981;
}

/* Historical Section */
.historical-section {
    margin-top: 48px;
    margin-bottom: 48px;
}

.historical-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.historical-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.historical-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.year-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--primary);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: white;
}

.historical-card h3 {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: 16px;
    margin-top: 8px;
}

.historical-stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hist-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.hist-stat:last-child {
    border-bottom: none;
}

.hist-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
}

.hist-value.positive {
    color: #10B981;
}

.hist-label {
    color: var(--text-light);
    font-size: 14px;
}

.chart-section {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px;
}

.chart-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 20px;
    text-align: center;
}

.chart-section canvas {
    max-height: 350px;
}

/* Search Results Styles */
.search-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 16px;
}

.search-result-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
}

.search-result-card:hover {
    border-color: #4F46E5;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1);
}

.results-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    margin-top: 24px;
    border-top: 1px solid #e2e8f0;
    flex-wrap: wrap;
    gap: 16px;
}

#resultsCount {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

.sentiment-breakdown {
    display: flex;
    gap: 16px;
}

.sentiment-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
}

.sentiment-item.positive {
    color: #10B981;
}

.sentiment-item.neutral {
    color: #F59E0B;
}

.sentiment-item.negative {
    color: #EF4444;
}

.loading-state {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
}

.loading-state.active {
    display: flex;
}

.loader {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top-color: #4F46E5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-state p {
    margin-top: 16px;
    color: #64748B;
    font-size: 14px;
}

.no-results-state {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.no-results-state.active {
    display: flex;
}

.no-results-icon {
    width: 64px;
    height: 64px;
    background: #f1f5f9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.no-results-icon svg {
    width: 28px;
    height: 28px;
    color: #94a3b8;
}

.no-results-state h3 {
    font-size: 18px;
    color: #1e293b;
    margin-bottom: 8px;
}

.no-results-state p {
    color: #64748B;
    font-size: 14px;
}

.suggested-tag {
    cursor: pointer;
    padding: 8px 16px;
    background: linear-gradient(135deg, #4F46E5 0%, #6366F1 100%);
    color: white;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-block;
    margin: 4px;
    border: none;
}

.suggested-tag:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.suggested-topics h4 {
    font-size: 13px;
    font-weight: 600;
    color: #64748B;
    margin: 16px 0 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.suggested-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .left-sidebar {
        width: 220px;
    }
}

@media (max-width: 768px) {
    .main-header {
        flex-wrap: wrap;
        gap: 16px;
        padding: 16px;
    }
    
    .header-center {
        order: 3;
        width: 100%;
        margin: 0;
        max-width: none;
    }
    
    .header-right {
        gap: 12px;
    }
    
    .user-name {
        display: none;
    }
    
    .content-area {
        padding: 20px;
    }
    
    .trends-grid,
    .platforms-grid,
    .compare-cards,
    .historical-grid,
    .search-results-grid {
        grid-template-columns: 1fr;
    }
    
    .topic-item {
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .topic-posts {
        margin-right: 16px;
    }
    
    .main-content {
        flex-direction: column;
    }
    
    .left-sidebar {
        width: 100%;
        height: auto;
        position: static;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    
    .sidebar-nav {
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .nav-section {
        width: 100%;
        text-align: center;
    }
    
    .results-summary {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .login-box {
        padding: 32px 24px;
    }
    
    .login-title {
        font-size: 20px;
    }
    
    .user-indicators {
        display: none;
    }
    
    .nav-item span {
        display: none;
    }
}

