/* VK Ads Dashboard — Minimal Clean CSS */

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

body {
    font-family: Inter, -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background: #f5f5f5;
    overflow-x: hidden;
}

/* Header */
.header {
    background: #2c3e50;
    color: #fff;
    padding: 0 20px;
    display: flex;
    align-items: center;
    height: 56px;
    gap: 24px;
}

.header-title {
    font-size: 18px;
    font-weight: 600;
    white-space: nowrap;
}

.nav {
    display: flex;
    gap: 4px;
}

.nav-link {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}

.nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
}

.sync-status {
    margin-left: auto;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

/* Main Content */
.main {
    max-width: 100%;
    margin: 0 auto;
    padding: 24px;
    overflow-x: hidden;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: #999;
    font-size: 12px;
}

/* Date Range Picker */
.date-picker-wrapper {
    position: relative;
    margin-bottom: 24px;
}

.date-picker-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.date-picker-trigger:hover {
    border-color: #3498db;
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.15);
}

.date-picker-trigger.active {
    border-color: #3498db;
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.2);
}

.date-picker-icon {
    color: #666;
}

.date-picker-text {
    font-weight: 500;
}

.date-picker-arrow {
    color: #999;
    transition: transform 0.2s;
}

.date-picker-trigger.active .date-picker-arrow {
    transform: rotate(180deg);
}

.date-picker-popup {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 1000;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: none;
    overflow: hidden;
}

.date-picker-popup.show {
    display: block;
    animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.date-picker-presets {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    background: #f8f9fa;
    border-right: 1px solid #eee;
    min-width: 160px;
    position: absolute;
    left: 0;
    top: 0;
    bottom: 60px;
}

.preset-btn {
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #333;
    text-align: left;
    transition: background 0.15s;
}

.preset-btn:hover {
    background: #e9ecef;
}

.preset-btn.active {
    background: #3498db;
    color: #fff;
}

.date-picker-calendars {
    display: flex;
    gap: 24px;
    padding: 16px 16px 16px 180px;
}

.calendar {
    width: 280px;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 0 4px;
}

.calendar-title {
    font-weight: 600;
    font-size: 15px;
    color: #2c3e50;
}

.calendar-nav {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    transition: background 0.15s;
}

.calendar-nav:hover {
    background: #f0f0f0;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 8px;
}

.calendar-weekdays span {
    text-align: center;
    font-size: 12px;
    font-weight: 500;
    color: #999;
    padding: 4px 0;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: #333;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    position: relative;
}

.calendar-day:hover:not(.empty):not(.disabled) {
    background: #e9ecef;
}

.calendar-day.empty {
    cursor: default;
}

.calendar-day.disabled {
    color: #ccc;
    cursor: not-allowed;
}

.calendar-day.other-month {
    color: #bbb;
}

.calendar-day.today {
    font-weight: 600;
    color: #3498db;
}

.calendar-day.selected {
    background: #3498db;
    color: #fff;
}

.calendar-day.in-range {
    background: rgba(52, 152, 219, 0.15);
    border-radius: 0;
}

.calendar-day.range-start {
    background: #3498db;
    color: #fff;
    border-radius: 50% 0 0 50%;
}

.calendar-day.range-end {
    background: #3498db;
    color: #fff;
    border-radius: 0 50% 50% 0;
}

.calendar-day.range-start.range-end {
    border-radius: 50%;
}

.date-picker-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
    margin-left: 160px;
}

.date-picker-range-display {
    font-size: 14px;
    color: #666;
}

.date-picker-actions {
    display: flex;
    gap: 8px;
}

.btn-cancel {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    transition: background 0.15s;
}

.btn-cancel:hover {
    background: #f0f0f0;
}

.btn-apply {
    padding: 8px 20px;
    background: #3498db;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #fff;
    font-weight: 500;
    transition: background 0.15s;
}

.btn-apply:hover {
    background: #2980b9;
}

/* Responsive: stack on mobile */
@media (max-width: 900px) {
    .date-picker-popup {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        max-width: calc(100vw - 32px);
        max-height: calc(100vh - 32px);
        overflow-y: auto;
    }

    .date-picker-popup.show {
        animation: none;
    }

    .date-picker-presets {
        position: relative;
        flex-direction: row;
        flex-wrap: wrap;
        border-right: none;
        border-bottom: 1px solid #eee;
        bottom: auto;
    }

    .date-picker-calendars {
        flex-direction: column;
        padding: 16px;
        gap: 16px;
    }

    .date-picker-footer {
        margin-left: 0;
    }

    .calendar {
        width: 100%;
    }
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

@media (max-width: 1200px) {
    .metrics-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.metric-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.metric-value {
    font-size: 24px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
    white-space: nowrap;
}

.metric-label {
    font-size: 12px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Data Tables */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.data-table {
    width: 100%;
    
    background: #fff;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
}

/* Text columns: allow truncation */
.data-table td.col-text {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.data-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #666;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
}

.data-table tbody tr:hover {
    background: #f8f9fa;
}

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

/* Left-align all columns */
.data-table td:nth-child(n+2),
.data-table th:nth-child(n+2) {
    text-align: left;
}

/* First column stays left-aligned */
.data-table td:first-child,
.data-table th:first-child {
    text-align: left;
}

/* Creatives table — expandable rows */
.creatives-table .campaign-row {
    font-weight: 600;
    cursor: pointer;
    background: #fff;
}

.creatives-table .campaign-row:hover {
    background: #f0f4f8;
}

.creatives-table .banner-row {
    background: #fafafa;
}

.creatives-table .banner-row td:first-child {
    padding-left: 32px;
}

.expand-icon {
    display: inline-block;
    width: 16px;
    transition: transform 0.2s;
    color: #999;
}

.badge {
    display: inline-block;
    background: #e0e0e0;
    color: #666;
    font-size: 11px;
    font-weight: normal;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 8px 16px;
    background: #e0e0e0;
    color: #333;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
}

.btn:hover {
    background: #d0d0d0;
}

.btn-primary {
    background: #3498db;
    color: #fff;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-danger {
    background: #e74c3c;
    color: #fff;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-small {
    padding: 4px 10px;
    font-size: 12px;
}

/* Forms */
.form-inline {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    background: #fff;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.form-inline label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
}

.form-inline input[type="text"],
.form-inline input[type="number"],
.form-inline input[type="date"] {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    width: 120px;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
}

.alert.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Utility Classes */
.text-muted {
    color: #999;
}

.text-success {
    color: #27ae60;
}

.text-danger {
    color: #e74c3c;
}

.indent {
    color: #666;
}

/* Sync status */
#sync-status {
    margin-top: 8px;
    font-size: 13px;
    color: #666;
}

/* Headings */
h2 {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    margin: 24px 0 16px;
}

h2:first-of-type {
    margin-top: 0;
}

/* === Report Highlighting === */

/* Good DRR row (< 30%) */
.row-good-drr {
    background: #d9ead3 !important;
}

/* Inefficient ad (active + spent>4500 + 0 orders) */
.row-inefficient {
    background: #f4cccc !important;
}

/* Total / summary row */
.row-total {
    font-weight: 700;
    background: #e8eaf6 !important;
    border-top: 2px solid #999;
}

.row-total td {
    border-bottom: 2px solid #999;
}

/* Unattributed leads row */
.row-unattributed {
    background: #fce4d6 !important;
    font-style: italic;
}

/* Old campaign status row colors — replaced by badges */
/* .status-active { background: #b6d7a8 !important; } */
/* .status-blocked { background: #fff2cc !important; } */

/* Campaign/banner status badges */
.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.status-badge-active {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-badge-blocked {
    background: #ffebee;
    color: #d32f2f;
}

.status-badge-deleted {
    background: #f5f5f5;
    color: #757575;
}

.status-badge-other {
    background: #f5f5f5;
    color: #666;
}

/* Budget: CBO indicator */
.badge-cbo {
    display: inline-block;
    background: #3498db;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 6px;
}

.badge-abo {
    display: inline-block;
    background: #27ae60;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 6px;
}

/* Group-level row in creatives */
.group-row {
    background: #f0f4f8 !important;
    font-weight: 500;
}

.group-row td:first-child {
    padding-left: 24px;
}

.banner-row td:first-child {
    padding-left: 48px;
}

/* Adaptive table font sizing */
@media (max-width: 1400px) {
    .data-table {
        font-size: 13px;
    }
    .data-table th,
    .data-table td {
        padding: 10px 12px;
    }
}

@media (max-width: 1200px) {
    .data-table {
        font-size: 12px;
    }
    .data-table th,
    .data-table td {
        padding: 8px 10px;
    }
}

@media (max-width: 1024px) {
    .data-table {
        font-size: 11px;
    }
    .data-table th,
    .data-table td {
        padding: 6px 8px;
    }
}

@media (max-width: 768px) {
    .data-table {
        font-size: 10px;
    }
    .data-table th,
    .data-table td {
        padding: 4px 6px;
    }
}

/* User info in header */
.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    font-size: 14px;
}
.user-name {
    color: #64748b;
}
.logout-link {
    color: #ef4444;
    text-decoration: none;
    font-size: 13px;
}
.logout-link:hover {
    text-decoration: underline;
}

/* Account switcher */
.account-switcher {
    margin-left: 16px;
}
.account-select {
    padding: 6px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    cursor: pointer;
}

/* Left-align text columns (campaign names, group names) */
.data-table th.col-left,
.data-table td.col-text {
    text-align: left !important;
}

/* DRR-based campaign row highlighting */
.row-drr-good {
    background: #e8f5e9 !important;
}
.row-drr-good:hover {
    background: #c8e6c9 !important;
}
.row-drr-bad {
    background: #ffebee !important;
}
.row-drr-bad:hover {
    background: #ffcdd2 !important;
}

/* Copyable group name */
.copyable-group {
    cursor: pointer;
    position: relative;
    border-bottom: 1px dashed #999;
    transition: color 0.2s;
}
.copyable-group:hover {
    color: #3498db;
}
.copy-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #27ae60;
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    z-index: 9999;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
}
.copy-toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* Table sort indicators */
.data-table th.sort-asc::after,
.data-table th.sort-desc::after {
    margin-left: 4px;
    font-size: 10px;
}
.data-table th.sort-asc::after {
    content: '▲';
}
.data-table th.sort-desc::after {
    content: '▼';
}
.data-table thead th {
    cursor: pointer;
    user-select: none;
}
.data-table thead th:hover {
    background: rgba(0,0,0,0.05);
}
