/* Analytics Dashboard Styles */

/* Global Font Settings */
.analytics-filter-bar,
.analytics-stats-grid,
.analytics-charts-row,
.analytics-chart-card,
.analytics-table-card,
.analytics-table,
.filter-btn,
.btn-refresh,
.analytics-stat-card,
.pie-chart-list,
.bar-chart,
.list-chart,
.analytics-loading,
.analytics-error-card,
.access-denied-card {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Access Denied Card */
.access-denied-card {
    background: white;
    border-radius: 16px;
    padding: 60px 40px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    max-width: 500px;
    margin: 100px auto;
}

.access-denied-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 30px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: white;
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.3);
}

.access-denied-card h2 {
    margin: 0 0 15px 0;
    font-size: 28px;
    color: #1f2937;
}

.access-denied-card p {
    margin: 10px 0;
    color: #6b7280;
    font-size: 16px;
}

.access-denied-hint {
    font-size: 14px !important;
    opacity: 0.8;
}

/* Filter Bar */
.analytics-filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.filter-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 10px 20px;
    border: 2px solid #e5e7eb;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    transition: all 0.3s;
}

.filter-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.filter-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-color: #667eea;
    color: white;
}

.btn-refresh {
    padding: 10px 20px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.btn-refresh:hover {
    border-color: #10b981;
    color: #10b981;
}

.btn-refresh i {
    transition: transform 0.3s;
}

.btn-refresh:hover i {
    transform: rotate(180deg);
}

/* Stats Grid */
.analytics-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.analytics-stat-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s;
}

.analytics-stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.analytics-stat-card .stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
}

.analytics-stat-card .stat-icon.blue {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.analytics-stat-card .stat-icon.green {
    background: linear-gradient(135deg, #10b981, #059669);
}

.analytics-stat-card .stat-icon.purple {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.analytics-stat-card .stat-icon.orange {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.analytics-stat-card .stat-content {
    flex: 1;
}

.analytics-stat-card .stat-label {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 8px;
}

.analytics-stat-card .stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #1f2937;
}

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

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

.analytics-chart-card.full-width {
    grid-column: 1 / -1;
}

.analytics-chart-card h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 10px;
}

.analytics-chart-card h3 i {
    color: #667eea;
}

.chart-content {
    min-height: 200px;
}

/* Pie Chart */
.pie-chart-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.pie-chart-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pie-chart-label {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pie-chart-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

.pie-chart-name {
    font-weight: 600;
    color: #1f2937;
    flex: 1;
}

.pie-chart-value {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.pie-chart-count {
    font-weight: 700;
    color: #1f2937;
}

.pie-chart-percent {
    color: #6b7280;
}

.pie-chart-bar {
    height: 8px;
    background: #f3f4f6;
    border-radius: 4px;
    overflow: hidden;
}

.pie-chart-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease-out;
}

/* Bar Chart */
.bar-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 4px;
    height: 250px;
    padding: 20px 0;
}

.bar-chart-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.bar-chart-bar-wrapper {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: flex-end;
}

.bar-chart-bar {
    width: 100%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 4px 4px 0 0;
    min-height: 4px;
    position: relative;
    transition: all 0.3s;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 5px;
}

.bar-chart-bar:hover {
    opacity: 0.8;
    transform: scaleY(1.05);
}

.bar-chart-value {
    font-size: 11px;
    font-weight: 600;
    color: white;
}

.bar-chart-label {
    font-size: 11px;
    color: #6b7280;
    transform: rotate(-45deg);
    white-space: nowrap;
}

/* List Chart */
.list-chart {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.list-chart-item {
    display: grid;
    grid-template-columns: 150px 1fr 100px;
    align-items: center;
    gap: 15px;
}

.list-chart-label {
    font-weight: 600;
    color: #1f2937;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.list-chart-bar {
    height: 24px;
    background: #f3f4f6;
    border-radius: 12px;
    overflow: hidden;
}

.list-chart-bar-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 12px;
    transition: width 0.5s ease-out;
}

.list-chart-value {
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    text-align: right;
}

/* Table Card */
.analytics-table-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
}

.analytics-table-card h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 10px;
}

.analytics-table-wrapper {
    overflow-x: auto;
}

.analytics-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

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

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

.analytics-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f3f4f6;
    color: #1f2937;
}

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

.analytics-table code {
    background: #f3f4f6;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

.analytics-table .badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.analytics-table .badge-desktop {
    background: #dbeafe;
    color: #1e40af;
}

.analytics-table .badge-mobile {
    background: #dcfce7;
    color: #166534;
}

.analytics-table .badge-tablet {
    background: #fef3c7;
    color: #92400e;
}

.analytics-table .badge-direct {
    background: #f3e8ff;
    color: #6b21a8;
}

.analytics-table .text-truncate {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Loading State */
.analytics-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 100px 20px;
}

.analytics-loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #f3f4f6;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.analytics-loading-text {
    margin-top: 20px;
    font-size: 16px;
    color: #6b7280;
}

/* Error State */
.analytics-error-card {
    background: white;
    border-radius: 16px;
    padding: 60px 40px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    max-width: 500px;
    margin: 100px auto;
}

.analytics-error-card i {
    font-size: 64px;
    color: #ef4444;
    margin-bottom: 20px;
}

.analytics-error-card h3 {
    margin: 0 0 15px 0;
    font-size: 24px;
    color: #1f2937;
}

.analytics-error-card p {
    margin: 10px 0 30px 0;
    color: #6b7280;
    font-size: 16px;
}

/* No Data State */
.no-data {
    padding: 40px 20px;
    text-align: center;
    color: #9ca3af;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .analytics-filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-buttons {
        justify-content: center;
    }

    .analytics-stats-grid {
        grid-template-columns: 1fr;
    }

    .analytics-charts-row {
        grid-template-columns: 1fr;
    }

    .list-chart-item {
        grid-template-columns: 100px 1fr 80px;
        gap: 10px;
    }

    .analytics-table {
        font-size: 12px;
    }

    .analytics-table th,
    .analytics-table td {
        padding: 8px 12px;
    }

    .bar-chart {
        height: 200px;
    }

    .bar-chart-label {
        font-size: 9px;
    }
}

/* Animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

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

.analytics-stat-card,
.analytics-chart-card,
.analytics-table-card {
    animation: fadeIn 0.5s ease-out;
}
