/* ================================
   Dashboard Layout
   ================================ */

/* View Header */
.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.view-header h2 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-8);
}

.page-title {
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text);
    margin: 0;
}

/* Campaigns Grid */
.campaigns-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--spacing-6);
}

/* ================================
   Responsive Grid System
   ================================ */

/* Tablet: 768px - 1023px */
@media (max-width: 1023px) {
    .campaigns-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .page-title {
        font-size: var(--font-size-2xl);
    }
}

/* Mobile: < 768px */
@media (max-width: 767px) {
    .campaigns-grid {
        grid-template-columns: repeat(1, minmax(0, 1fr));
        gap: var(--spacing-4);
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-4);
        margin-bottom: var(--spacing-6);
    }

    .page-title {
        font-size: var(--font-size-xl);
    }
}

/* ================================
   Campaigns View Filters
   ================================ */

.campaigns-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 32px;
}

.filter-btn {
    padding: 8px 20px;
    border: 1px solid var(--border-warm);
    background: var(--bg-card);
    color: var(--text-muted);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    background: var(--bg-page);
    border-color: var(--border-warm);
}

.filter-btn.active {
    background: var(--accent-text);
    color: var(--bg-card);
    border-color: var(--accent-text);
}

/* ================================
   Empty State
   ================================ */

.campaign-required-message {
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 24px;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-main);
    margin: 0 0 12px 0;
}

.empty-state-description {
    font-size: 16px;
    color: var(--text-muted);
    margin: 0 auto 32px auto;
    max-width: 400px;
}

/* ================================
   No Results Message
   ================================ */

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 16px;
}

/* ================================
   Error Message
   ================================ */

.error-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #dc2626;
    background: #fef2f2;
    border-radius: 8px;
    border: 1px solid #fecaca;
}

/* ================================
   Campaign Card Styles
   ================================ */

/* Campaign card meta section (ICP/Scorecard info) */
.campaign-meta {
    padding: 16px 0;
    border-top: 1px solid var(--border-warm);
    border-bottom: 1px solid var(--border-warm);
    margin: 16px 0;
}

.campaign-meta-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-warm);
    min-height: 72px;
}

.campaign-meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.meta-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.meta-value {
    font-size: 14px;
    color: var(--text-main);
    font-weight: 600;
    line-height: 1.4;
    max-height: 40px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Campaign Chart - Fixed height for alignment */
.campaign-chart-container {
    height: 140px;
    margin-bottom: 20px;
    position: relative;
}

.campaign-chart-canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Campaign Actions - Fixed height for alignment */
.campaign-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--border-warm);
    margin-top: auto;
    min-height: 48px;
}

.action-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-page);
    border: 1px solid var(--border-warm);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-muted);
}

.action-btn:hover {
    transform: translateY(-1px);
}

.action-btn:active {
    transform: scale(0.95);
}

/* Play button - Green */
.action-btn:nth-child(1) {
    background: #dcfce7;
    border-color: #bbf7d0;
    color: #166534;
}

.action-btn:nth-child(1):hover {
    background: #bbf7d0;
    border-color: #86efac;
    color: #14532d;
}

/* Pause button - Yellow */
.action-btn:nth-child(2) {
    background: #fef3c7;
    border-color: #fde68a;
    color: #92400e;
}

.action-btn:nth-child(2):hover {
    background: #fde68a;
    border-color: #fcd34d;
    color: #78350f;
}

/* Delete button - Red */
.action-btn:nth-child(3) {
    background: #fee2e2;
    border-color: #fecaca;
    color: #991b1b;
}

.action-btn:nth-child(3):hover {
    background: #fecaca;
    border-color: #fca5a5;
    color: #7f1d1d;
}

/* Replay button - Blue */
.action-btn:nth-child(4) {
    background: var(--accent-soft);
    border-color: var(--accent-soft);
    color: var(--accent-text);
}

.action-btn:nth-child(4):hover {
    background: var(--accent-soft);
    border-color: var(--accent-soft);
    color: var(--accent-text);
}

/* Infinite button - Purple */
.action-btn:nth-child(5) {
    background: var(--accent-soft);
    border-color: var(--accent-soft);
    color: var(--accent-text);
}

.action-btn:nth-child(5):hover {
    background: var(--accent-soft);
    border-color: var(--accent-soft);
    color: var(--accent-text);
}

/* Lookalike button - Teal */
.action-btn:nth-child(6) {
    background: #ccfbf1;
    border-color: #99f6e4;
    color: #115e59;
}

.action-btn:nth-child(6):hover {
    background: #99f6e4;
    border-color: #5eead4;
    color: #134e4a;
}

/* Make cards clickable */
.campaign-card {
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

.campaign-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 42, 58, 0.15);
}

/* Campaign Header - Fixed height for alignment */
.campaign-header {
    min-height: 64px;
    margin-bottom: 16px;
}

.campaign-header h3 {
    line-height: 1.3;
    max-height: 52px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Status badges */
.status-draft {
    background: var(--bg-page);
    color: var(--text-muted);
}

.status-active {
    background: #dcfce7;
    color: #166534;
}

.status-paused {
    background: #fef3c7;
    color: #92400e;
}

/* Empty filter state */
.empty-filter-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-filter-state p {
    font-size: 16px;
    margin: 0;
}

/* ================================
   Analytics View
   ================================ */

/* Analytics Filters */
.analytics-filters {
    display: flex;
    gap: 16px;
}

/* KPI Cards Grid */
.kpi-cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

.kpi-card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(59, 42, 58, 0.1);
    transition: box-shadow 0.2s ease;
}

.kpi-card:hover {
    box-shadow: 0 4px 6px rgba(59, 42, 58, 0.1);
}

.kpi-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
}

.kpi-label {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

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

.kpi-trend.positive {
    color: #10b981;
}

.kpi-trend.negative {
    color: #ef4444;
}

.trend-arrow {
    font-size: 16px;
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.chart-container {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(59, 42, 58, 0.1);
}

.chart-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
    margin: 0 0 20px 0;
}

.chart-container canvas {
    width: 100% !important;
    height: 300px !important;
}

/* Analytics Responsive */
@media (max-width: 1279px) {
    .kpi-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

@media (max-width: 767px) {
    .view-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .analytics-filters {
        width: 100%;
        flex-direction: column;
    }

    .analytics-filters .filter-select {
        width: 100%;
    }

    .kpi-cards-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}