/* ============================================================================
  Mobile responsive key breakpoints.
   ============================================================================ */

   /* Tablet */
@media (max-width: 768px) {
    .topbar-container {
        flex-direction: column;
        padding: 12px;
    }
    
    .nav-links {
        flex-direction: column;
        width: 100%;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .dashboard-container {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        display: none; /* Or make it a dropdown */
    }
}

/**
 * UpThread Performance Analytics Styles
 * Matching the dashboard design system exactly
 */

/* ═══════════════════════════════════════════════════════════════════════════
   VARIABLES (Matching dashboard)
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    --linkedin-blue: #0A66C2;
    --linkedin-blue-dark: #004182;
    --linkedin-blue-light: #378FE9;
    --linkedin-white: #FFFFFF;
    --linkedin-gray-100: #F3F2EF;
    --linkedin-gray-200: #E9E5DF;
    --linkedin-gray-300: #00000099;
    --linkedin-gray-400: #00000066;
    --text-primary: #000000E6;
    --text-secondary: #00000099;
    --border-color: #00000014;
    --success: #057642;
    --danger: #CC1016;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-primary);
    background: var(--linkedin-gray-100);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.user-menu-btn:hover {
    background: #f3f2ef;
    border-color: #0a66c2;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #0a66c2;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

/* User Dropdown - CRITICAL: Use .active class */
.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 280px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.user-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

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

.user-avatar-large {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #0a66c2;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 18px;
}

.user-name-large {
    font-weight: 600;
    color: #333;
    font-size: 16px;
}

.user-dropdown-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 12px 0;
}

.dropdown-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 12px;
    text-align: left;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    color: #333;
    text-decoration: none;
    font-size: 14px;
}

.dropdown-link:hover {
    background: #f3f2ef;
}

/* Tier Badge */
.tier-badge {
    font-size: 16px;
    margin-left: auto;
    animation: pulse-gem 2s ease-in-out infinite;
}

@keyframes pulse-gem {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   MAIN LAYOUT (Matching dashboard exactly)
   ═══════════════════════════════════════════════════════════════════════════ */

.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SIDEBAR (Matching dashboard exactly)
   ═══════════════════════════════════════════════════════════════════════════ */

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

.sidebar-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.sidebar-section h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.sidebar-link {
    display: block;
    padding: 12px;
    margin-bottom: 4px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.sidebar-link:hover {
    background: var(--linkedin-gray-100);
    color: var(--text-primary);
}

.sidebar-link.primary {
    background: var(--linkedin-blue);
    color: white;
}

.sidebar-link.primary:hover {
    background: var(--linkedin-blue-dark);
}

.select-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    background: white;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.select-input:hover {
    border-color: var(--linkedin-blue);
}

.select-input:focus {
    outline: none;
    border-color: var(--linkedin-blue);
    box-shadow: 0 0 0 3px rgba(10, 102, 194, 0.1);
}

.btn-secondary-small {
    display: inline-block;
    padding: 8px 16px;
    background: var(--linkedin-gray-100);
    color: var(--linkedin-blue);
    text-decoration: none;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-secondary-small:hover {
    background: var(--linkedin-gray-200);
}

/* Quick Stats in Sidebar */
.quick-stat-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.quick-stat-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.quick-stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.quick-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   MAIN CONTENT (Matching dashboard exactly)
   ═══════════════════════════════════════════════════════════════════════════ */

.content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.welcome-section {
    background: white;
    border-radius: 12px;
    padding: 32px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.welcome-section h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.welcome-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
}

/* Info Banner (matching dashboard analytics notice) */
.info-banner {
    background: white;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    display: flex;
    gap: 16px;
    border-left: 4px solid var(--linkedin-blue);
}

.info-banner-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.info-banner-content {
    flex: 1;
}

.info-banner-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.info-banner-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════════════════
   STATS GRID (Matching dashboard exactly)
   ═══════════════════════════════════════════════════════════════════════════ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

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

.stat-icon {
    font-size: 20px;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-change {
    font-size: 12px;
    font-weight: 500;
}

.stat-change.positive {
    color: var(--success);
}

.stat-change.neutral {
    color: var(--text-secondary);
}

/* Loading Shimmer */
.loading-shimmer {
    width: 100%;
    height: 24px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

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

/* ═══════════════════════════════════════════════════════════════════════════
   SECTION HEADERS
   ═══════════════════════════════════════════════════════════════════════════ */

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.section-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.table-controls {
    display: flex;
    gap: 12px;
}

.search-input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    width: 250px;
    font-family: inherit;
}

.search-input:focus {
    outline: none;
    border-color: var(--linkedin-blue);
    box-shadow: 0 0 0 3px rgba(10, 102, 194, 0.1);
}

/* ═══════════════════════════════════════════════════════════════════════════
   CHARTS
   ═══════════════════════════════════════════════════════════════════════════ */

.charts-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.chart-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.chart-card-full {
    background: white;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.chart-header {
    margin-bottom: 20px;
}

.chart-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.chart-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
}

.chart-container {
    position: relative;
    height: 300px;
}

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

/* ═══════════════════════════════════════════════════════════════════════════
   TABS & TOP POSTS
   ═══════════════════════════════════════════════════════════════════════════ */

.tabs-container {
    display: flex;
    gap: 8px;
    background: white;
    border-radius: 12px;
    padding: 8px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.2s;
    font-family: inherit;
}

.tab-btn:hover {
    background: var(--linkedin-gray-100);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--linkedin-blue);
    color: white;
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.post-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}

.post-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* ═══════════════════════════════════════════════════════════════════════════
   TABLE
   ═══════════════════════════════════════════════════════════════════════════ */

.table-card {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.performance-table {
    width: 100%;
    border-collapse: collapse;
}

.performance-table thead {
    background: var(--linkedin-gray-100);
    border-bottom: 2px solid var(--border-color);
}

.performance-table th {
    padding: 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.performance-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    color: var(--text-primary);
}

.performance-table tbody tr:hover {
    background: var(--linkedin-gray-100);
}

.performance-table tbody tr:last-child td {
    border-bottom: none;
}

.loading-state {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
    .main-container {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .charts-row {
        grid-template-columns: 1fr;
    }
}

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

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .table-controls {
        width: 100%;
        flex-direction: column;
    }

    .search-input {
        width: 100%;
    }

    .table-card {
        overflow-x: auto;
    }

    .posts-grid {
        grid-template-columns: 1fr;
    }

    .tabs-container {
        flex-wrap: wrap;
    }
}