/* FONT IMPORT */
@import url('https://fonts.googleapis.com/css2?family=Work+Sans:wght@300;400;600&display=swap');

/* CSS VARIABLES - ADSWERVE BRAND PALETTE */
:root {
    /* Primary */
    --fearless-pink: #FF00CE;
    --sunny-yellow: #EEE707;
    --smart-plum: #653D62;
    --deep-graphite: #353535;
    --bright-white: #FFFFFF;
    --lively-blue: #2EC5FF;

    /* Neutrals */
    --neutral-gray-1: #DADCE0; /* Border color */
    --neutral-gray-2: #5F6368; /* Subdued text */
    --neutral-gray-3: #F8F9FA; /* Sidebar bg */
    --neutral-gray-4: #E8EAED; /* Hover bg */

    /* System */
    --background-color: var(--bright-white);
    --text-color: var(--deep-graphite);
    --header-color: var(--deep-graphite);
}

/* GENERAL RESETS & BODY STYLES */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Work Sans', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    -webkit-font-smoothing: antialiased;
    font-weight: 400;
}

h1, h2 {
    font-weight: 400;
    color: var(--header-color);
}

/* APP LAYOUT */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background-color: var(--neutral-gray-3);
    border-right: 1px solid var(--neutral-gray-1);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    flex-shrink: 0;
}

.content {
    flex-grow: 1;
    padding: 2rem 3rem;
    overflow-y: auto;
}

/* SIDEBAR STYLES */
.sidebar-header {
    padding: 0 0.5rem;
    margin-bottom: 2.5rem;
}

.adswerve-logo {
    width: 140px;
    height: auto;
}

/* This is the key change: Target the classes within the SVG */
.adswerve-logo .logo-text {
    color: var(--deep-graphite);
}

.adswerve-logo .logo-mark {
    color: var(--fearless-pink);
}

.sidebar-title {
    font-size: 1.1rem;
    font-weight: 400;
    margin-top: 0.75rem;
    color: var(--header-color);
    line-height: 1.4;
}

.sidebar-nav {
    padding: 0 0.5rem;
}

.sidebar-nav ul {
    list-style-type: none;
}

.sidebar-nav li a {
    display: block;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--text-color);
    border-radius: 6px;
    font-weight: 400;
    margin-bottom: 0.5rem;
    transition: background-color 0.2s ease-in-out;
}

.sidebar-nav li a:hover {
    background-color: var(--neutral-gray-4);
}

.sidebar-nav li a.active {
    background-color: var(--smart-plum);
    color: var(--bright-white);
    font-weight: 600;
}

/* MAIN CONTENT STYLES */
.page-header {
    margin-bottom: 2.5rem;
}

.page-header h1 {
    font-size: 2.25rem;
    margin-bottom: 0.5rem;
}

.page-header p {
    font-size: 1rem;
    color: var(--neutral-gray-2);
    max-width: 800px;
}

.card {
    background: var(--bright-white);
    border: 1px solid var(--neutral-gray-1);
    border-radius: 8px;
    margin-bottom: 2rem;
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--neutral-gray-1);
}

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 400;
}

.card-content {
    padding: 2rem 1.5rem;
}

.card-content pre {
    background-color: var(--neutral-gray-3);
    padding: 1rem;
    border-radius: 4px;
    white-space: pre-wrap;
    font-size: 0.85rem;
    color: var(--text-color);
    border: 1px solid var(--neutral-gray-1);
}

.kpi-metrics {
    display: flex;
    justify-content: space-around;
    align-items: center;
    text-align: center;
    padding: 1rem 0;
}

.kpi {
    display: flex;
    flex-direction: column;
}

.kpi-value {
    font-size: 2.5rem;
    font-weight: 400;
    color: var(--lively-blue);
    line-height: 1.1;
}

.kpi-label {
    font-size: 1rem;
    color: var(--neutral-gray-2);
    margin-top: 0.75rem;
}

/* CHART & INSIGHT CARD STYLES */
.chart-container {
    width: 100%;
    height: 500px; /* Default height */
}

.insight-card {
    border-left: 4px solid var(--sunny-yellow);
}

.insight-card .card-content ul {
    list-style-position: inside;
    padding-left: 0.5rem;
}

.insight-card .card-content li {
    margin-bottom: 0.75rem;
}

.insight-card .card-content li strong {
    font-weight: 600;
}

/* CHANNEL SELECTOR STYLES */
.channel-selector {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
}

.channel-btn {
    font-family: 'Work Sans', sans-serif;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--neutral-gray-1);
    background-color: var(--bright-white);
    color: var(--text-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.channel-btn:hover {
    background-color: var(--neutral-gray-3);
    border-color: var(--neutral-gray-2);
}

.channel-btn.active {
    background-color: var(--smart-plum);
    color: var(--bright-white);
    border-color: var(--smart-plum);
    font-weight: 600;
}

/* GRID CONTAINER FOR SIDE-BY-SIDE CHARTS */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

/* INTERACTIVE SLIDER STYLES */
.slider-wrapper {
    display: grid;
    grid-template-columns: 100px 1fr 100px;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}
.slider-wrapper label {
    font-weight: 600;
}
.slider-wrapper span {
    text-align: right;
    font-family: monospace;
    font-size: 1rem;
}
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: #ddd;
    border-radius: 5px;
    outline: none;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--smart-plum);
    cursor: pointer;
    border-radius: 50%;
}
input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--smart-plum);
    cursor: pointer;
    border-radius: 50%;
}

/* OPTIMIZER CONTROLS */
.optimizer-controls {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 1rem;
    align-items: end;
}
.optimizer-controls div {
    display: flex;
    flex-direction: column;
}
.optimizer-controls label {
    font-size: 0.9rem;
    color: var(--neutral-gray-2);
    margin-bottom: 0.5rem;
}
.optimizer-controls input {
    padding: 0.5rem;
    border: 1px solid var(--neutral-gray-1);
    border-radius: 4px;
    font-family: 'Work Sans', sans-serif;
    font-size: 1rem;
}
.optimizer-controls button {
    padding: 0.6rem;
    border: none;
    background-color: var(--smart-plum);
    color: white;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}
.optimizer-controls button:hover {
    background-color: var(--fearless-pink);
}
.optimizer-controls button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* SLIDER TRACK & MARKER */
.slider-track {
    position: relative;
    display: flex;
    align-items: center;
}
.optimal-marker {
    position: absolute;
    width: 2px;
    height: 16px;
    background-color: var(--fearless-pink);
    opacity: 0.7;
    transform: translateX(-1px); /* Center the line */
    pointer-events: none; /* Make it non-interactive */
}

/* SPINNER FOR BUTTON */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-left: 8px;
    vertical-align: middle;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}