/* Analytics & Reports Styles */

.date-range-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-tertiary);
    padding: 0.5rem;
    border-radius: 4px;
}

.date-range-selector input {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.date-range-selector span {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Dropdown */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 160px;
    display: none;
    z-index: 100;
    margin-top: 0.5rem;
}

.dropdown-menu.active {
    display: block;
}

.dropdown-menu a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s;
}

.dropdown-menu a:hover {
    background: rgba(164, 124, 91, 0.1);
    color: var(--accent-tan);
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

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

.metric-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-icon {
    color: var(--accent-tan);
    opacity: 0.6;
    font-size: 1.25rem;
}

.metric-value {
    font-size: 2.5rem;
    font-weight: 300;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.metric-detail {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.metric-change {
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.metric-change.positive {
    color: #10b981;
}

.metric-change.negative {
    color: #ef4444;
}

.metric-sparkline {
    height: 40px;
    width: 100%;
    position: relative;
    overflow: hidden;
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    max-height: 400px;
    overflow: hidden;
}

.chart-card.chart-wide {
    grid-column: span 2;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.chart-header h3 {
    font-size: 1.125rem;
    font-weight: 400;
    color: var(--text-primary);
}

.chart-options {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.chart-options:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.chart-container {
    position: relative;
    height: 300px;
    max-height: 300px;
    overflow: hidden;
}

.chart-container canvas {
    max-height: 300px !important;
}

/* Table Section */
.table-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.table-header h3 {
    font-size: 1.25rem;
    font-weight: 400;
}

.table-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

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

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

.data-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    font-size: 0.875rem;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(75, 85, 99, 0.3);
}

.data-table tr:hover {
    background: rgba(164, 124, 91, 0.05);
}

.campaign-name {
    font-weight: 500;
    color: var(--text-primary);
}

.campaign-type {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 500;
}

.type-campaign { background: rgba(59, 130, 246, 0.2); color: #3b82f6; }
.type-special { background: rgba(16, 185, 129, 0.2); color: #10b981; }
.type-holiday { background: rgba(245, 158, 11, 0.2); color: #f59e0b; }
.type-promotion { background: rgba(139, 92, 246, 0.2); color: #8b5cf6; }

.status-active {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.status-scheduled {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.status-completed {
    background: rgba(107, 114, 128, 0.2);
    color: #6b7280;
}

.performance-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.875rem;
}

.performance-high {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.performance-medium {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.performance-low {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.action-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.action-btn:hover {
    background: rgba(164, 124, 91, 0.1);
    border-color: var(--accent-tan);
    color: var(--accent-tan);
}

/* Sparkline */
.sparkline-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.sparkline-path {
    stroke: var(--accent-tan);
    stroke-width: 2;
    fill: none;
}

.sparkline-area {
    fill: rgba(164, 124, 91, 0.1);
}

/* Loading State */
.chart-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 300px;
}

/* Responsive */
@media (max-width: 1200px) {
    .chart-card.chart-wide {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .date-range-selector {
        flex-direction: column;
        width: 100%;
    }
    
    .date-range-selector input {
        width: 100%;
    }
    
    .table-container {
        overflow-x: scroll;
    }
    
    .data-table {
        min-width: 800px;
    }
}

/* Dynamic chart cards (created by JavaScript) */
.charts-grid .chart-card canvas {
    max-height: 300px !important;
    width: 100% !important;
    height: auto !important;
}

/* Filters Section */
.filters-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.filter-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.filter-controls .form-control {
    flex: 1;
    min-width: 200px;
}

/* Section titles */
.section-title {
    font-size: 1.5rem;
    margin: 2rem 0 1rem;
    color: var(--text-primary);
    font-weight: 400;
}

/* Chart options button */
.chart-options-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.chart-options-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}