
:root {
    --bg-color: #f8fafc;
    --sidebar-bg: #ffffff;
    --header-bg: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --brand-blue: #2563eb;
    --brand-green: #10b981;
    --sidebar-width: 260px;
    --header-height: 64px;
    --radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    /* Platform Colors */
    --color-google: #4285F4;
    --color-meta: #3b5998;
    --color-linkedin: #0077b5;
    --color-bing: #00897b;
    --color-tiktok: #000000;
    --color-snapchat: #FFFC00;
    --color-other: #9ca3af;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden; /* Prevent body scroll, handle inside layout */
}

/* --- 2. LAYOUT STRUCTURE --- */
.app-layout {
    display: flex;
    height: 100vh;
    width: 100%;
}

/* --- 3. SIDEBAR --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform 0.3s ease;
    z-index: 50;
}

.logo-area {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05)
}

.logo-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.logo-svg {
    width: 32px;
    height: 32px;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.02em;
}

    .logo-text span {
        color: var(--brand-green);
    }

.nav-links {
    padding: 24px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
}

    .nav-item:hover {
        background-color: #f1f5f9;
        color: var(--text-primary);
    }

    .nav-item.active {
        background-color: #eff6ff;
        color: var(--brand-blue);
    }

.nav-icon {
    width: 20px;
    height: 20px;
}

/* --- 4. MAIN CONTENT AREA --- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* --- 5. TOP HEADER --- */
.top-header {
    height: var(--header-height);
    background: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05)
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.hamburger-btn {
    display: none; /* Hidden on Desktop */
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
}

.page-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

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

/* Date Picker Group */
.date-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-input {
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    color: var(--text-primary);
    outline: none;
}

/* User Avatar & Dropdown */
.user-profile {
    position: relative;
}

.avatar-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e2e8f0;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--border-color);
    cursor: pointer;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dropdown-menu {
    position: absolute;
    top: 48px;
    right: 0;
    width: 180px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    padding: 6px;
    z-index: 100;
    display: none; /* Toggled via C# */
}

    .dropdown-menu.show {
        display: block;
    }

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    cursor: pointer;
}

    .dropdown-item:hover {
        background: #f8fafc;
        color: var(--text-primary);
    }

    .dropdown-item.text-red {
        color: #ef4444;
    }

        .dropdown-item.text-red:hover {
            background: #fef2f2;
        }

/* --- 6. SCROLLABLE DASHBOARD CONTENT --- */
.content-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 25px;
}

.header-container {
    display: flex;
    justify-content: space-between; /* Pushes content to edges */
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap; /* Allows wrapping on mobile */
    gap: 16px;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* --- CARDS LAYOUT (5 in a row) --- */
.stats-grid {
    display: grid;
    gap: 20px;
    /* Default: Auto-fit for mobile/tablet (responsive) */
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Force 5 columns on Desktop (screens larger than 1200px) */
@media (min-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* --- IMPROVED ICONS & CARD STYLING --- */
.stat-card {
    background: #ffffff;
    border-radius: 16px; /* Softer corners */
    padding: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    transition: transform 0.2s ease;
}

    .stat-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    }

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

/* Icon Box - Soft Pastel Style */
.icon-box {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .icon-box svg {
        width: 24px;
        height: 24px;
        stroke-width: 2; /* Thicker lines for visibility */
    }

/* Modern Icon Colors */
.theme-blue {
    background-color: #eff6ff;
    color: #3b82f6;
}
/* Spending */
.theme-purple {
    background-color: #f5f3ff;
    color: #8b5cf6;
}
/* Leads */
.theme-green {
    background-color: #ecfdf5;
    color: #10b981;
}
/* Avg CPL */

.stat-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 1.10rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
    letter-spacing: -0.02em;
}

.charts-row {
    display: flex;
    gap: 24px;
    margin-bottom: 32px;
    flex-wrap: wrap;
    margin-top:32px;
}

.chart-card {
    background: white;
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    flex: 1;
    min-width: 300px;
    border: 1px solid var(--border-color);
}

.form-control {
    padding: 8px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

/* Apply Button Style */
.btn-primary {
    background-color: #2563eb; /* Brand Blue */
    color: white;
    border: none;
    padding: 10px 24px; /* Comfortable padding */
    border-radius: 8px; /* Matches your input fields */
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

    /* Hover State */
    .btn-primary:hover {
        background-color: #1d4ed8; /* Slightly darker blue */
    }

    /* Click/Active State */
    .btn-primary:active {
        transform: translateY(1px); /* Subtle press down effect */
        background-color: #1e40af;
    }

.chart-header {
    margin-top:0px !important;
}

.chart-area {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 200px;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    margin-top: 20px;
}

.bg-line {
    width: 100%;
    border-top: 1px dashed #f1f5f9;
    height: 0;
    position: absolute;
}

.chart-bg-lines {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    pointer-events: none;
}

.bar-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 12%;
    height: 100%;
    justify-content: flex-end;
    z-index: 1;
}

.bar {
    width: 100%;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    transition: 0.2s;
}

    .bar:hover {
        opacity: 0.8;
    }

.bar-label {
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

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

.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    white-space: nowrap;
}

    .data-table th {
        background: #f8fafc;
        color: var(--text-secondary);
        font-size: 0.75rem;
        font-weight: 700;
        text-transform: uppercase;
        padding: 14px 24px;
        text-align: left;
        border-bottom: 1px solid var(--border-color);
    }

    .data-table td {
        padding: 16px 24px;
        border-bottom: 1px solid #f1f5f9;
        color: var(--text-primary);
    }

.text-right {
    text-align: right !important;
}

.font-mono {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.85rem;
}

.dot {
    height: 8px;
    width: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-warn {
    background: #fef2f2;
    color: #ef4444;
}

.badge-good {
    background: #ecfdf5;
    color: #10b981;
}

.badge-neutral {
    background: #f1f5f9;
    color: #64748b;
}

.bg-google {
    background: var(--color-google);
}

.bg-meta {
    background: var(--color-meta);
}

.bg-linkedin {
    background: var(--color-linkedin);
}

.bg-bing {
    background: var(--color-bing);
}

.bg-other {
    background: var(--color-other);
}

/* --- 7. MOBILE RESPONSIVENESS --- */
@@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        transform: translateX(-100%); /* Hidden by default */
    }

        .sidebar.open {
            transform: translateX(0);
        }

    .hamburger-btn {
        display: block;
    }

    .date-group {
        display: none;
    }
    /* Hide dates on mobile header to save space */

    .overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 40;
        display: none;
    }

        .overlay.show {
            display: block;
        }

    .content-scroll {
        padding: 16px;
    }

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

    .charts-row {
        flex-direction: column;
    }

    .chart-card {
        min-width: 100%;
    }
}

/* --- STYLING --- */
.comments-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 24px;
}

/* Comment Input Area */
.comment-box {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    margin-bottom: 32px;
    margin-top:15px;
}

.box-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 16px;
}

.input-area {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
}

    .input-area:focus {
        border-color: #2563eb;
    }

.action-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}

.btn-post {
    background-color: #2563eb;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

    .btn-post:hover {
        background-color: #1d4ed8;
    }

    .btn-post:disabled {
        background-color: #94a3b8;
        cursor: not-allowed;
    }

/* Comment List */
.comments-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.comment-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #f1f5f9;
    display: flex;
    gap: 16px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.comment-content {
    flex: 1;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

.user-name {
    font-weight: 600;
    color: #0f172a;
    font-size: 0.95rem;
}

.time-stamp {
    color: #64748b;
    font-size: 0.8rem;
}

.comment-text {
    color: #334155;
    font-size: 0.95rem;
    line-height: 1.5;
    white-space: pre-wrap; /* Preserves newlines */
}

/* --- SPINNER ANIMATION --- */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

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

/* Update button to handle disabled state nicely */
.btn-login:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    background-color: #3b82f6; /* Keep it blue but lighter */
}

/* Green Notes Button Style */
.btn-notes {
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background-color: #10b981; /* Brand Green */
    border: 1px solid #059669; /* Slightly darker border */
    border-radius: 8px;
    color: #ffffff; /* White text */
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    margin-right:6px;
}

    .btn-notes:hover {
        background-color: #059669; /* Darker green on hover */
        transform: translateY(-1px);
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    }

    .btn-notes svg {
        width: 18px;
        height: 18px;
        color: #ffffff; /* White icon */
    }