:root {
    --bg-color: #faf9f6; /* Off-white/cream background */
    --surface-color: #ffffff;
    --sidebar-bg: #f5f4ef;
    --border-color: #e5e3db;
    --text-primary: #1a1a1a; /* Charcoal/near black */
    --text-secondary: #6b7280;
    --accent-color: #27b657; /* Clairvo green */
    --accent-hover: #1e9947;
    --accent-light: rgba(39, 182, 87, 0.1);
    --blue-300: #60a5fa;
    --success-color: #059669;
    --danger-color: #ef4444;
    
    --font-sans: 'Inter', sans-serif;
    --font-serif: 'Fraunces', serif;
    
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.02);
    --shadow-lg: 0 12px 24px rgba(0,0,0,0.06), 0 4px 8px rgba(0,0,0,0.04);
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3 {
    font-family: var(--font-serif);
    font-weight: 500;
    letter-spacing: -0.02em;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px 20px;
    position: fixed;
    height: 100vh;
    z-index: 10;
}

.sidebar-header {
    margin-bottom: 40px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 22px;
    font-family: var(--font-serif);
    font-weight: 500;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.logo-img {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    object-fit: contain;
}

.nav-links {
    list-style: none;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-links li a {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
    padding: 10px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.nav-links li a i {
    font-size: 18px;
}

.nav-links li a:hover {
    background: rgba(0,0,0,0.03);
    color: var(--text-primary);
}

.nav-links li.active a {
    background: var(--surface-color);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--border-color);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: 14px;
}

.user-info .name {
    font-size: 13px;
    font-weight: 600;
}

.user-info .role {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    margin-left: 240px;
    padding: 48px 64px;
    max-width: 1400px;
    min-width: 0;
}

/* Forced Onboarding Mode */
body.onboarding-mode .sidebar {
    display: none !important;
}
body.onboarding-mode .main-content {
    margin-left: 0 !important;
    max-width: 100%;
}

#dashboard-view, #offers-view {
    display: flex;
    flex-direction: column;
    gap: 40px;
    width: 100%;
    min-width: 0;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.greeting h1 {
    font-size: 36px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

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

/* Buttons */
.btn-primary {
    background: var(--text-primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-primary:hover {
    background: #333;
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    border-radius: 6px;
    font-family: inherit;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: #f9f9f9;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.stats-grid.centered {
    grid-template-columns: repeat(3, 1fr);
    max-width: 900px;
    margin: 0 auto;
}

.stat-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.stat-details h3 {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    font-family: var(--font-sans);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.stat-details .stat-value {
    font-size: 32px;
    font-family: var(--font-serif);
    color: var(--text-primary);
    margin-bottom: 12px;
}

.trend {
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

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

.trend.negative {
    color: var(--danger-color);
}

/* General Cards */
.card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    min-width: 0;
    width: 100%;
}

/* Sections */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    border-bottom: 1px solid var(--border-color);
}

.section-header h2 {
    font-size: 20px;
}

#chart-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    max-width: 50%;
    margin-right: 16px;
}

.date-filter {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
    outline: none;
}

/* Chart */
.chart-container {
    position: relative;
    width: 100%;
    height: 320px;
    padding: 24px 32px;
}

/* Table Section */
.search-bar {
    position: relative;
    width: 280px;
}

.search-bar i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 16px;
}

.search-bar input {
    width: 100%;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    padding: 8px 12px 8px 36px;
    border-radius: 6px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s ease;
}

.search-bar input:focus {
    border-color: var(--text-secondary);
}

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

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 16px 16px;
    border-bottom: 1px solid var(--border-color);
    background: #faf9f6;
}

th.num-col, td.num-col {
    text-align: right;
}

td {
    padding: 16px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: #faf9f6;
}

.video-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.video-title-text {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

.tracking-link {
    color: var(--text-primary);
    text-decoration: underline;
    text-decoration-color: var(--border-color);
    text-underline-offset: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.tracking-link:hover {
    text-decoration-color: var(--text-primary);
}

.tracking-link i {
    color: var(--text-secondary);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(250, 249, 246, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--surface-color);
    width: 100%;
    max-width: 480px;
    padding: 32px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    transform: translateY(10px);
    transition: transform 0.2s ease;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-header h2 {
    font-size: 24px;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.close-btn:hover {
    color: var(--text-primary);
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group select {
    width: 100%;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    border-radius: 6px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 1px var(--text-primary);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 32px;
}

/* Offer Type Buttons */
.offer-type-selector {
    display: flex;
    gap: 16px;
    margin-top: 8px;
}

.type-btn {
    flex: 1;
    background: #ffffff;
    border: 1px solid #e5e3db;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.4s ease;
    color: var(--text-secondary);
}

.type-btn i {
    font-size: 28px;
    margin-bottom: 8px;
    color: var(--text-secondary);
    transition: color 0.4s ease;
}

.type-btn span {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
}

.type-btn:hover {
    border-color: #5E3A21;
    background: #5E3A21;
    color: #ffffff;
}

.type-btn:hover i {
    color: #ffffff;
}

.type-btn.active {
    border-color: #5E3A21;
    background: #5E3A21; /* Chocolate brown active background */
    color: #ffffff;
}

.type-btn.active i {
    color: #ffffff;
}

.type-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.type-badge i {
    font-size: 14px;
}

/* Global JS Tooltip */
#global-tooltip {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    transform: translateX(-50%);
    background-color: #ffffff;
    color: var(--text-primary);
    text-align: center;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    font-weight: 500;
    font-size: 13px;
    white-space: nowrap;
    z-index: 9999; /* Stay above everything */
    transition: opacity 0.15s, visibility 0.15s;
    pointer-events: none;
    font-family: inherit;
}

#global-tooltip code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    color: #334155;
    font-weight: 600;
    font-size: 12px;
    margin-left: 4px;
}

/* Tooltip Arrow */
#global-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -6px;
    border-width: 6px;
    border-style: solid;
    border-color: #ffffff transparent transparent transparent;
}

/* Tooltip Arrow Border */
#global-tooltip::before {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -7px;
    border-width: 7px;
    border-style: solid;
    border-color: var(--border-color) transparent transparent transparent;
}

/* Giant Type Buttons for Onboarding */
.giant-type-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.giant-type-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

.giant-type-btn i {
    font-size: 4rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
}

.giant-type-btn h3 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.giant-type-btn p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.5;
    margin: 0;
}

