/**
 * QR Analytics Dashboard CSS
 * Responsive styling for tiered analytics display
 */

/* Container */
.qr-analytics-dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Header */
.qr-analytics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.qr-analytics-header h2 {
    margin: 0;
    font-size: 28px;
    color: #2c3e50;
}

.plan-badge {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    color: white;
}

.plan-badge.plan-free {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
}

.plan-badge.plan-business {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.plan-badge.plan-enterprise {
    background: linear-gradient(135deg, #f093fb, #f5576c);
}

/* Upgrade Notice */
.qr-upgrade-notice {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 30px;
    text-align: center;
}

.qr-upgrade-notice h3 {
    margin: 0 0 10px 0;
    font-size: 22px;
}

.qr-upgrade-notice p {
    margin: 0 0 20px 0;
    font-size: 16px;
    opacity: 0.95;
}

.btn-upgrade {
    display: inline-block;
    background: white;
    color: #667eea;
    padding: 12px 30px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-upgrade:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* QR Code Selector */
.qr-code-selector {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.qr-code-selector label {
    font-weight: 600;
    color: #2c3e50;
}

.qr-code-selector select {
    flex: 1;
    min-width: 200px;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.qr-code-selector select:focus {
    outline: none;
    border-color: #667eea;
}

.btn-secondary, .btn-export {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary {
    background: #ecf0f1;
    color: #2c3e50;
}

.btn-secondary:hover {
    background: #d5dbdb;
}

.btn-export {
    background: #27ae60;
    color: white;
}

.btn-export:hover {
    background: #229954;
    transform: translateY(-2px);
}

/* Loading State */
.analytics-loading {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Summary Cards */
.analytics-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.summary-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s ease;
}

.summary-card:hover {
    border-color: #667eea;
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.card-icon {
    font-size: 40px;
}

.card-content h3 {
    margin: 0 0 5px 0;
    font-size: 32px;
    color: #2c3e50;
}

.card-content p {
    margin: 0;
    color: #7f8c8d;
    font-size: 14px;
}

/* Analytics Section */
.analytics-section {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
}

.analytics-section h3 {
    margin: 0 0 20px 0;
    color: #2c3e50;
    font-size: 20px;
}

/* QR Codes Table */
.analytics-table {
    width: 100%;
    border-collapse: collapse;
}

.analytics-table thead {
    background: #f8f9fa;
}

.analytics-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #e0e0e0;
}

.analytics-table td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
}

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

.scan-count {
    background: #667eea;
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-weight: 600;
    font-size: 14px;
}

/* Charts */
.analytics-charts {
    display: grid;
    gap: 30px;
    margin-bottom: 30px;
}

.chart-container {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 25px;
}

.chart-container.half {
    grid-column: span 1;
}

.chart-container h3 {
    margin: 0 0 20px 0;
    color: #2c3e50;
    font-size: 18px;
}

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

/* Advanced Analytics */
.analytics-advanced {
    margin-top: 40px;
}

.analytics-advanced h2 {
    margin: 0 0 30px 0;
    color: #2c3e50;
    font-size: 24px;
    padding-bottom: 15px;
    border-bottom: 3px solid #667eea;
}

.analytics-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* Data Lists */
.data-list {
    max-height: 400px;
    overflow-y: auto;
}

.data-list-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

.data-list-items li {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s ease;
}

.data-list-items li:hover {
    background: #f8f9fa;
}

.list-icon {
    font-size: 24px;
}

.list-label {
    flex: 1;
    color: #2c3e50;
    font-weight: 500;
}

.list-count {
    background: #ecf0f1;
    color: #2c3e50;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
}

/* No Data State */
.no-data {
    text-align: center;
    padding: 40px 20px;
    color: #95a5a6;
    font-style: italic;
}

/* Error Display */
.analytics-error {
    background: #ffe6e6;
    border: 2px solid #ff4d4d;
    border-radius: 12px;
    padding: 20px;
    color: #c0392b;
    margin-top: 20px;
}

.qr-analytics-error {
    background: #ffe6e6;
    border: 2px solid #ff4d4d;
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    color: #c0392b;
}

/* Responsive Design */
@media (max-width: 768px) {
    .qr-analytics-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .qr-code-selector {
        flex-direction: column;
        align-items: stretch;
    }
    
    .qr-code-selector select {
        width: 100%;
    }
    
    .analytics-summary {
        grid-template-columns: 1fr;
    }
    
    .analytics-charts {
        grid-template-columns: 1fr;
    }
    
    .chart-container.half {
        grid-column: span 1;
    }
    
    .analytics-row {
        grid-template-columns: 1fr;
    }
    
    .analytics-table {
        font-size: 14px;
    }
    
    .analytics-table th,
    .analytics-table td {
        padding: 8px;
    }
}

@media (min-width: 769px) {
    .analytics-charts {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .chart-container:first-child {
        grid-column: span 2;
    }
}
