@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg-primary: #0F172A;
    --bg-card: #1E293B;
    --bg-input: #0F172A;
    --border: #334155;
    --border-hover: #475569;
    --text-primary: #F8FAFC;
    --text-secondary: #CBD5E1;
    --text-muted: #94A3B8;
    --accent-green: #10B981;
    --accent-blue: #3B82F6;
    --accent-purple: #6366F1;
    --accent-red: #EF4444;
    --accent-yellow: #F59E0B;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.25);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
}

.admin-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

/* ============================================
   HEADER
============================================ */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 16px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-back {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.2s;
    border: 1px solid var(--border);
    cursor: pointer;
    font-family: inherit;
}

.btn-back:hover {
    background: var(--border-hover);
    color: var(--text-primary);
    transform: translateX(-2px);
}

.admin-header h1 {
    font-size: clamp(20px, 4vw, 26px);
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-header h1 i {
    color: var(--accent-yellow);
}

.filters-right {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-select {
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 150px;
}

.filter-select:hover {
    border-color: var(--accent-green);
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent-green);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* ============================================
   STATS GRID
============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s;
}

.stat-card:hover {
    border-color: var(--accent-purple);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.stat-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

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

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    transition: all 0.3s;
}

.chart-card:hover {
    border-color: var(--accent-purple);
    box-shadow: var(--shadow-lg);
}

.chart-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.chart-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-header h3 i {
    color: var(--accent-blue);
}

.chart-wrapper {
    position: relative;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-chart {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    gap: 12px;
}

.empty-chart i {
    font-size: 48px;
    opacity: 0.3;
}

.empty-chart p {
    font-size: 14px;
}

/* ============================================
   TABLE CARD
============================================ */
.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.table-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.table-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-header h3 i {
    color: var(--accent-yellow);
}

.table-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

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

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

.data-table th {
    background: var(--bg-input);
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 16px;
    border-top: 1px solid var(--border);
    font-size: 14px;
    color: var(--text-secondary);
}

.data-table tr {
    transition: background 0.2s;
}

.data-table tbody tr:hover {
    background: rgba(51, 65, 85, 0.5);
}

.data-table td:first-child {
    font-weight: 700;
    color: var(--accent-yellow);
}

.loading-cell {
    text-align: center;
    padding: 40px 20px !important;
    color: var(--text-muted);
}

.loading-cell i {
    color: var(--accent-green);
    margin-right: 8px;
}

/* ============================================
   BADGES
============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge.success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.badge.warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-yellow);
}

.badge.danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

/* ============================================
   TOAST NOTIFICATION
============================================ */
.toast-notif {
    position: fixed;
    top: 24px;
    right: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 9999;
    max-width: 400px;
}

.toast-notif.show {
    transform: translateX(0);
}

.toast-success {
    border-color: var(--accent-green);
}

.toast-success i {
    color: var(--accent-green);
}

.toast-error {
    border-color: var(--accent-red);
}

.toast-error i {
    color: var(--accent-red);
}

.toast-info {
    border-color: var(--accent-blue);
}

.toast-info i {
    color: var(--accent-blue);
}

.toast-notif i {
    font-size: 20px;
    flex-shrink: 0;
}

.toast-notif span {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
}

/* ============================================
   RESPONSIVO
============================================ */
@media (max-width: 768px) {
    .admin-container {
        padding: 16px;
    }
    
    .admin-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .header-left {
        justify-content: space-between;
    }
    
    .filters-right {
        width: 100%;
    }
    
    .filter-select {
        flex: 1;
        min-width: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-card {
        padding: 18px;
    }
    
    .stat-card {
        padding: 18px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .data-table {
        font-size: 13px;
    }
    
    .data-table th,
    .data-table td {
        padding: 12px 8px;
    }
    
    .toast-notif {
        left: 16px;
        right: 16px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .chart-wrapper {
        min-height: 250px;
    }
    
    .table-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ============================================
   SCROLLBAR
============================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}