/* Admin Dashboard Styles */

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

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    color: #fff;
    min-height: 100vh;
}

.admin-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
    width: 260px;
    background: rgba(26, 26, 46, 0.95);
    border-right: 1px solid rgba(139, 92, 246, 0.2);
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.admin-logo h2 {
    font-size: 1.5em;
    margin-bottom: 5px;
    color: #8b5cf6;
}

.admin-email {
    font-size: 0.85em;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 30px;
}

.admin-nav {
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 8px;
    border-radius: 8px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.7);
    transition: all 0.3s ease;
}

.nav-item:hover {
    background: rgba(139, 92, 246, 0.1);
    color: #fff;
}

.nav-item.active {
    background: rgba(139, 92, 246, 0.2);
    color: #fff;
    border-left: 3px solid #8b5cf6;
}

.nav-icon {
    font-size: 1.3em;
    margin-right: 12px;
}

.back-link {
    display: block;
    text-align: center;
    padding: 12px;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 8px;
    color: #8b5cf6;
    text-decoration: none;
    transition: all 0.3s ease;
}

.back-link:hover {
    background: rgba(139, 92, 246, 0.2);
}

/* Main Content */
.admin-main {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.admin-header h1 {
    font-size: 2em;
    color: #fff;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.time-selector, .filter-select {
    padding: 10px 16px;
    background: rgba(26, 26, 46, 0.8);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 8px;
    color: #fff;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
}

.btn-refresh, .btn-export {
    padding: 10px 20px;
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
}

.btn-refresh:hover, .btn-export:hover {
    background: rgba(139, 92, 246, 0.3);
    transform: translateY(-2px);
}

/* Sections */
.admin-section {
    display: none;
}

.admin-section.active {
    display: block;
}

/* Real-time Banner */
.realtime-banner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(236, 72, 153, 0.2));
    border-radius: 12px;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.realtime-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.realtime-label {
    font-size: 0.85em;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 5px;
}

.realtime-value {
    font-size: 1.8em;
    font-weight: 600;
    color: #fff;
}

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

.kpi-card {
    background: rgba(26, 26, 46, 0.8);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-5px);
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.2);
}

.kpi-icon {
    font-size: 2.5em;
}

.kpi-content {
    flex: 1;
}

.kpi-value {
    font-size: 1.8em;
    font-weight: 600;
    color: #8b5cf6;
    margin-bottom: 5px;
}

.kpi-label {
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.7);
}

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

.chart-card {
    background: rgba(26, 26, 46, 0.8);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 12px;
    padding: 20px;
}

.chart-card h3 {
    margin-bottom: 20px;
    color: #8b5cf6;
}

/* Data Cards */
.data-card {
    background: rgba(26, 26, 46, 0.8);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
}

.data-card h3 {
    margin-bottom: 20px;
    color: #8b5cf6;
    font-size: 1.3em;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

table th {
    background: rgba(139, 92, 246, 0.2);
    padding: 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid rgba(139, 92, 246, 0.4);
}

table td {
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

table tr:hover {
    background: rgba(139, 92, 246, 0.05);
}

/* API Credits Grid */
#api-credits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.api-credit-card {
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 10px;
    padding: 20px;
}

.api-credit-card h4 {
    color: #8b5cf6;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.credit-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.95em;
}

.credit-label {
    color: rgba(255, 255, 255, 0.7);
}

.credit-value {
    color: #fff;
    font-weight: 500;
}

.credit-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 10px;
}

.credit-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #8b5cf6, #ec4899);
    transition: width 0.3s ease;
}

/* Subscription Breakdown */
.subscription-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.sub-stat {
    background: rgba(139, 92, 246, 0.1);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.sub-stat-value {
    font-size: 2em;
    font-weight: 600;
    color: #8b5cf6;
}

.sub-stat-label {
    font-size: 0.85em;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 5px;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 500;
}

.status-success {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

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

.status-warning {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 40px;
    color: rgba(255, 255, 255, 0.6);
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Responsive */
@media (max-width: 1024px) {
    .admin-container {
        flex-direction: column;
    }
    
    .admin-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid rgba(139, 92, 246, 0.2);
    }
    
    .charts-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .admin-main {
        padding: 15px;
    }
    
    .admin-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .header-actions {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .kpi-grid {
        grid-template-columns: 1fr;
    }
}
