:root {
    --bg-color: #030712;
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-hover-border: rgba(255, 255, 255, 0.2);
    --primary-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    --accent-color: #3b82f6;
    --glow-color: rgba(59, 130, 246, 0.5);
    --font-main: 'Outfit', sans-serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* Dynamic Background */
.background-globes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.globe {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
}

.globe-1 {
    width: 500px;
    height: 500px;
    background: #4c1d95;
    top: -100px;
    left: -100px;
    animation: float 20s infinite alternate ease-in-out;
}

.globe-2 {
    width: 600px;
    height: 600px;
    background: #1e40af;
    bottom: -150px;
    right: -150px;
    animation: float 25s infinite alternate-reverse ease-in-out;
}

.globe-3 {
    width: 300px;
    height: 300px;
    background: #be185d;
    top: 40%;
    left: 40%;
    opacity: 0.2;
    animation: pulse 10s infinite ease-in-out;
}

@keyframes float {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(50px, 50px);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.2;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.3;
    }
}

/* Dashboard Container */
.dashboard-container {
    width: 100%;
    max-width: 1200px;
    padding: 2rem;
    z-index: 1;
}

.dashboard-header {
    text-align: center;
    margin-bottom: 4rem;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.logo-icon {
    font-size: 2.5rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 10px var(--glow-color));
}

h1 {
    font-size: 3.5rem;
    font-weight: 700;
}

.highlight {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

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

/* Cards */
.tool-card {
    position: relative;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 2.5rem;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.4s ease;
    backdrop-filter: blur(10px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.tool-card.active:hover {
    transform: translateY(-10px);
    border-color: var(--card-hover-border);
    background: rgba(255, 255, 255, 0.05);
}

.tool-card.disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.card-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.icon-wrapper {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
}

.tool-card.active .icon-wrapper {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(139, 92, 246, 0.2) 100%);
    color: #60a5fa;
    border: 1px solid rgba(96, 165, 250, 0.2);
}

.status-badge {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border: 1px solid var(--card-border);
    margin-top: auto;
    align-self: flex-start;
}

.status-badge.enabled {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.2);
}

.status-badge.paused {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.2);
}

.action-text {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: #60a5fa;
    margin-top: auto;
}

/* Results Section for API */
#api-results {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    border: 1px solid var(--card-border);
    display: none;
    max-height: 400px;
    overflow-y: auto;
}

#api-results.visible {
    display: block;
    animation: fadeIn 0.5s ease;
}

.account-item {
    padding: 12px;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: background 0.2s;
    border-radius: 8px;
}

.account-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.account-item:last-child {
    border-bottom: none;
}

.acc-id {
    color: var(--text-secondary);
    font-size: 0.9em;
    font-family: monospace;
}

.acc-name {
    flex: 1;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.arrow {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.loading {
    text-align: center;
    color: var(--text-secondary);
    padding: 1rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stats Table */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 0.5rem;
}

.back-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.2s;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

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

.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.stats-table th,
.stats-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid var(--card-border);
}

.stats-table th {
    color: var(--text-secondary);
    font-weight: 600;
}

.stats-table td {
    color: var(--text-primary);
}

/* --- New Google Ads Page Styles --- */

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--card-border);
}

.back-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.3s;
}

.back-link:hover {
    color: var(--accent-color);
}

.logo-mini {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.logo-icon-sm {
    font-size: 1.5rem;
    color: var(--accent-color);
}

.logo-mini h2 {
    font-size: 1.5rem;
}

.ads-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 2rem;
    height: 70vh;
}

/* Sidebar */
.accounts-panel {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.refresh-btn {
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.3s;
}

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

.accounts-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.acc-list {
    list-style: none;
}

.acc-item {
    padding: 1rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    transition: background 0.2s;
}

.acc-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.acc-item.active {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.acc-info {
    overflow: hidden;
}

.acc-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

/* Reusing .acc-id from before, but scoped might be safer if needed */

/* Main Stats Area */
.stats-panel {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.campaigns-view {
    padding: 1.5rem;
    height: 100%;
    overflow-y: auto;
}

.campaigns-view.empty {
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.camp-header {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.badg-id {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-family: monospace;
}

/* Data Table */
.data-table-wrapper {
    overflow-x: auto;
}

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

.data-table th {
    text-align: left;
    padding: 10px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--card-border);
    font-weight: 600;
}

.data-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--card-border);
    color: var(--text-primary);
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.td-name {
    font-weight: 500;
    color: #fff;
}

.status-box {
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 12px;
    text-transform: uppercase;
}

.status-box.enabled {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.status-box.paused {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.status-box.removed {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* Mobile responsive */
@media (max-width: 900px) {
    .ads-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .accounts-panel {
        height: 300px;
    }
}

/* Search Box */
.search-box {
    padding: 10px;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.02);
}

.search-box input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    padding: 8px 12px;
    color: var(--text-primary);
    font-family: var(--font-main);
    outline: none;
    transition: border 0.3s;
}

.search-box input:focus {
    border-color: var(--accent-color);
}

.search-box button {
    background: var(--accent-color);
    border: none;
    border-radius: 6px;
    width: 36px;
    color: white;
    cursor: pointer;
    transition: opacity 0.3s;
}

/* Updated Chart Controls */
.chart-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    background: #f9fafb;
    border-bottom: 1px solid var(--card-border);
}

.controls-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
}

.metrics-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    width: 100%;
}

.metric-card {
    display: flex;
    flex-direction: column;
    background: white;
    border: 1px solid var(--card-border);
    border-radius: 6px;
    padding: 0.5rem;
    gap: 0.5rem;
    min-width: 150px;
    flex: 1;
}

.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.metric-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.metric-types {
    display: flex;
    gap: 0.25rem;
}

.type-btn {
    border: 1px solid var(--card-border);
    background: #f3f4f6;
    padding: 2px 5px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.type-btn.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}


/* Granularity Controls */
.control-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-label {
    font-weight: 600;
    color: var(--text-secondary);
    margin-right: 0.25rem;
    font-size: 0.9rem;
}

.btn-group {
    display: flex;
    border: 1px solid var(--card-border);
    border-radius: 4px;
    overflow: hidden;
}

.btn-group button {
    background: white;
    border: none;
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    cursor: pointer;
    border-right: 1px solid var(--card-border);
    color: var(--text-secondary);
}

.btn-group button:last-child {
    border-right: none;
}

.btn-group button.active {
    background: var(--accent-color);
    color: white;
}

/* Date Selector Toolbar */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid var(--card-border);
}

.filters-group {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.date-selector,
.status-filter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.date-selector select,
.date-selector input[type="date"],
.status-filter select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    padding: 0.5rem;
    border-radius: 6px;
    font-family: var(--font-main);
    color-scheme: dark;
}

.date-custom {
    display: none;
}

.date-custom.visible {
    display: flex;
}

/* Light Mode & Full Width for Ads Page */
.light-mode-ads {
    --bg-color: #f3f4f6;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --card-bg: #ffffff;
    --card-border: #e5e7eb;
    --card-hover-border: #d1d5db;
    --accent-color: #2563eb;
}

.light-mode-ads .background-globes {
    display: none;
    /* Cleaner look for data app */
}

.light-mode-ads .dashboard-container {
    max-width: 100%;
    width: 100%;
    padding: 0 2rem;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.light-mode-ads .ads-layout {
    flex: 1;
    height: auto;
    margin-bottom: 2rem;
}

.light-mode-ads .accounts-panel,
.light-mode-ads .stats-panel {
    background: var(--card-bg);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    backdrop-filter: none;
    border: 1px solid var(--card-border);
}

.light-mode-ads .search-box,
.light-mode-ads .toolbar {
    background: transparent;
    border-bottom: 1px solid var(--card-border);
}

.light-mode-ads .search-box input,
.light-mode-ads .date-selector select,
.light-mode-ads .date-selector input,
.light-mode-ads .status-filter select {
    background: #f9fafb;
    border: 1px solid #d1d5db;
    color: var(--text-primary);
    color-scheme: light;
}

/* Compare Toggle */
.compare-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    background: #f9fafb;
    border: 1px solid var(--card-border);
    border-radius: 6px;
    margin-left: auto;
}

.compare-toggle:hover {
    background: #f3f4f6;
}

.compare-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Delta Indicators */
.delta {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 4px;
    border-radius: 3px;
    margin-left: 4px;
    white-space: nowrap;
}

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

.delta-negative {
    color: #dc2626;
    background: rgba(239, 68, 68, 0.1);
}

/* Performance Summary Block */

/* Summary Row - 2 columns layout */
.summary-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

@media (max-width: 900px) {
    .summary-row {
        grid-template-columns: 1fr;
    }
}

/* Performance Summary Block */
.performance-summary {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    border-radius: 10px;
    padding: 1.25rem;
}

.performance-summary h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.performance-summary h3 i {
    color: var(--accent-color);
}

.performance-summary .summary-intro {
    margin: 0 0 1rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
}

.summary-item {
    background: white;
    border: 1px solid #e0e7ff;
    border-radius: 8px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.summary-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.summary-value .delta {
    font-size: 0.75rem;
    font-weight: 600;
}

.prev-value {
    font-size: 0.75rem;
    font-weight: 500;
    color: #6b7280;
    background: rgba(107, 114, 128, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Text Summary Block */
.performance-text-summary {
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    border: 1px solid #c4b5fd;
    border-radius: 10px;
    padding: 1.25rem;
}

.performance-text-summary h3 {
    margin: 0 0 0.75rem 0;
    font-size: 1.1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.performance-text-summary h3 i {
    color: #7c3aed;
}

.copy-btn {
    background: none;
    border: 1px solid #c4b5fd;
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #7c3aed;
    margin-left: auto;
    transition: all 0.2s;
}

.copy-btn:hover {
    background: #7c3aed;
    color: white;
}

.text-summary-content {
    background: white;
    border: 1px solid #e0e7ff;
    border-radius: 8px;
    padding: 1rem;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-primary);
}

.text-summary-content p {
    margin: 0 0 0.5rem 0;
}

.text-summary-content p:last-child {
    margin-bottom: 0;
}

/* Conversions Breakdown */
.conversions-breakdown {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #fcd34d;
    border-radius: 10px;
    padding: 1.25rem;
}

.conversions-breakdown h3 {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.conversions-breakdown h3 i {
    color: #d97706;
}

.conversions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

.conversion-item {
    background: white;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.conv-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-category {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.conv-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #d97706;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.light-mode-ads .search-box input:focus,
.light-mode-ads .date-selector select:focus {
    border-color: var(--accent-color);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.light-mode-ads .data-table th {
    background: #f9fafb;
    color: var(--text-secondary);
    font-weight: 600;
    border-bottom: 1px solid var(--card-border);
}

.light-mode-ads .data-table td {
    border-bottom: 1px solid var(--card-border);
    color: var(--text-primary);
}

.light-mode-ads .data-table tr:hover td {
    background: #f3f4f6;
}

.light-mode-ads .td-name {
    color: #1e40af;
    /* Bleu fonce pour les liens/noms */
    font-weight: 600;
}

.light-mode-ads .header-row {
    margin-bottom: 0;
    padding: 0.75rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
    border-bottom: 1px solid var(--card-border);
    position: relative;
    background: #fff;
    z-index: 50;
}

.light-mode-ads .header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 250px;
}

/* Top Search Area */
.light-mode-ads .top-search-wrapper {
    flex: 1;
    max-width: 600px;
    position: relative;
    margin: 0 auto;
}

.light-mode-ads .search-box {
    display: flex;
    align-items: center;
    width: 100%;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0 12px;
    transition: all 0.2s;
}

.light-mode-ads .search-box:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background: #fff;
}

.light-mode-ads .search-icon-left {
    color: var(--text-secondary);
    margin-right: 10px;
}

.light-mode-ads .search-box input {
    border: none;
    background: transparent;
    padding: 10px 0;
    font-size: 0.95rem;
    width: 100%;
    box-shadow: none;
    outline: none;
}

.light-mode-ads .search-box input:focus {
    box-shadow: none;
    background: transparent;
    border: none;
}

/* Search Dropdown */
.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-top: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    z-index: 100;
    max-height: 400px;
    overflow-y: auto;
}

.light-mode-ads .acc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.light-mode-ads .acc-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    transition: background 0.2s;
}

.light-mode-ads .acc-item:last-child {
    border-bottom: none;
}

.light-mode-ads .acc-item:hover {
    background: #f9fafb;
}

.light-mode-ads .acc-name {
    font-weight: 500;
    color: var(--text-primary);
}

.light-mode-ads .acc-id {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Adjust full screen layout */
.light-mode-ads .ads-layout {
    display: block;
    /* No more grid */
    height: calc(100vh - 70px);
    overflow: hidden;
}

.light-mode-ads .stats-panel {
    height: 100%;
    display: flex;
    flex-direction: column;
    border-radius: 0;
    /* Remove radius for full fit if desired */
    border: none;
    border-top: 1px solid #e5e7eb;
}

/* Hide old header elements if present */
.light-mode-ads .header-row .logo-mini h2 {
    font-size: 1.25rem;
}

.light-mode-ads .back-link {
    border: none;
    background: transparent;
    padding: 8px;
    font-size: 1.2rem;
    color: #4b5563;
}

.light-mode-ads .back-link:hover {
    color: #111827;
    background: #f3f4f6;
}

/* Tabs Navigation */
.tabs-nav {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    border-bottom: 1px solid var(--card-border);
    background: var(--card-bg);
}

.tab-btn {
    padding: 0.6rem 1.25rem;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-btn:hover {
    background: var(--card-bg);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

/* Tab Panels */
.tab-panel {
    min-height: 200px;
    display: none;
}

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

/* Campaign Detail Block */
.campaign-detail-block {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.campaign-header {
    background: var(--bg-secondary);
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--card-border);
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.campaign-header .camp-name {
    font-size: 1.05rem;
}

.adgroups-table-wrapper {
    overflow-x: auto;
}

.adgroups-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    align-items: start;
}

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

.camp-type-icon {
    margin-right: 0.5rem;
    color: var(--text-secondary);
    display: inline-block;
    width: 20px;
    text-align: center;
}

.campaign-detail-block .camp-name i {
    margin-right: 0.5rem;
    color: var(--accent-color);
}

/* Fix scrolling for Ads Page */
body.light-mode-ads {
    display: block !important;
    height: auto !important;
    min-height: 100vh;
    overflow-y: auto !important;
}

.light-mode-ads .dashboard-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
    height: auto !important;
}

.tab-panel.active {
    display: block;
    height: auto;
    overflow: visible;
}

/* Campaign Selection Zone */
.campaign-selection-zone {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.campaign-selection-zone h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.campaign-selection-zone h3 i {
    margin-right: 0.5rem;
    color: var(--accent-color);
}

.selection-controls {
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--card-border);
}

.select-all-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-primary);
}

.select-all-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-color);
}

.campaigns-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}

.camp-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    transition: all 0.2s ease;
    font-size: 0.85rem;
}

.camp-checkbox-label:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--card-border);
}

.camp-checkbox-label input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--accent-color);
}

.camp-checkbox-name {
    color: var(--text-secondary);
}

.camp-checkbox-label:has(input:checked) .camp-checkbox-name {
    color: var(--text-primary);
}

/* Light mode overrides */
.light-mode-ads .campaign-selection-zone {
    background: #fff;
    border-color: #e5e7eb;
}

.light-mode-ads .camp-checkbox-label {
    background: #f9fafb;
}

.light-mode-ads .camp-checkbox-label:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: var(--card-bg);
    margin: 5% auto;
    padding: 0;
    border: 1px solid var(--card-border);
    width: 80%;
    max-width: 1000px;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.close-modal {
    color: var(--text-secondary);
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

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

.modal-body {
    padding: 1.5rem;
    max-height: 70vh;
    overflow-y: auto;
}

/* Light mode adjustments for modal */
.light-mode-ads .modal-content {
    background-color: #ffffff;
}

.adgroup-link {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.adgroup-link:hover {
    text-decoration: underline;
    color: #1d4ed8;
}

/* Search Terms Badges */
.search-terms-wrapper {
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    border: 1px solid var(--card-border);
}

.st-title {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}

.st-badges-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.st-badge {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.2);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.st-count {
    background: rgba(0, 0, 0, 0.2);
    padding: 0 4px;
    border-radius: 6px;
    font-size: 0.7rem;
    color: #fff;
}

.light-mode-ads .st-badge {
    background: #e0f2fe;
    color: #0369a1;
    border-color: #bae6fd;
}

.light-mode-ads .st-count {
    background: rgba(255, 255, 255, 0.5);
    color: #0c4a6e;
}