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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f5f6fa;
    color: #2c3e50;
    line-height: 1.6;
}

#dashboard-container {
    min-height: 100vh;
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
.dashboard-header {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

.header-content h1 {
    color: #2c3e50;
    font-size: 28px;
    font-weight: 700;
}

.header-controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

.control-select, .control-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    color: #2c3e50;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-btn:hover {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.control-select:focus, .control-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* Overview Metrics */
.metrics-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.metric-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
}

.metric-icon {
    font-size: 32px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    color: white;
}

.metric-content {
    flex: 1;
}

.metric-value {
    font-size: 28px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 4px;
}

.metric-label {
    font-size: 14px;
    color: #7f8c8d;
    font-weight: 500;
}

/* Charts Section */
.charts-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

.chart-container {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.chart-header {
    margin-bottom: 20px;
}

.chart-header h3 {
    color: #2c3e50;
    font-size: 18px;
    font-weight: 600;
}

#usage-chart, #funnel-chart {
    max-height: 300px;
}

/* Tables Section */
.tables-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

.table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
}

.table-header {
    padding: 20px 24px;
    border-bottom: 1px solid #ecf0f1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-header h3 {
    color: #2c3e50;
    font-size: 18px;
    font-weight: 600;
}

.table-controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

.table-search {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    width: 160px;
}

.table-sort {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

.table-wrapper {
    max-height: 400px;
    overflow-y: auto;
}

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

th, td {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid #ecf0f1;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
    position: sticky;
    top: 0;
    z-index: 10;
}

td {
    font-size: 14px;
    color: #34495e;
}

tbody tr:hover {
    background: #f8f9fa;
}

/* Activity Section */
.activity-section {
    margin-bottom: 32px;
}

.activity-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.activity-header {
    padding: 20px 24px;
    border-bottom: 1px solid #ecf0f1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.activity-header h3 {
    color: #2c3e50;
    font-size: 18px;
    font-weight: 600;
}

.activity-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #27ae60;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #27ae60;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.activity-feed {
    max-height: 300px;
    overflow-y: auto;
    padding: 16px 24px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #ecf0f1;
}

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

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.activity-icon.try-on {
    background: rgba(52, 152, 219, 0.1);
    color: #3498db;
}

.activity-icon.conversion {
    background: rgba(39, 174, 96, 0.1);
    color: #27ae60;
}

.activity-content {
    flex: 1;
}

.activity-message {
    font-size: 14px;
    color: #2c3e50;
    margin-bottom: 2px;
}

.activity-time {
    font-size: 12px;
    color: #7f8c8d;
}

.activity-location {
    font-size: 12px;
    color: #95a5a6;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay.hidden {
    display: none;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #ecf0f1;
    border-left: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1001;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #ecf0f1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: #2c3e50;
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #95a5a6;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #e74c3c;
}

.modal-body {
    padding: 20px 24px;
}

.export-options, .export-data-options {
    margin-bottom: 20px;
}

.export-options label, .export-data-options label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    cursor: pointer;
}

.export-options input, .export-data-options input {
    margin-right: 8px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #ecf0f1;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.modal-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-btn.primary {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

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

.modal-btn.secondary {
    background: white;
    color: #7f8c8d;
}

.modal-btn.secondary:hover {
    background: #f8f9fa;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .charts-section {
        grid-template-columns: 1fr;
    }
    
    .tables-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    #dashboard-container {
        padding: 16px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }
    
    .header-controls {
        width: 100%;
        justify-content: flex-end;
    }
    
    .metrics-overview {
        grid-template-columns: 1fr;
    }
    
    .table-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .table-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .table-search {
        width: 120px;
    }
}