/* 🎨 Admin Panel Styles */

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

:root {
    --primary: #667eea;
    --primary-dark: #764ba2;
    --success: #4caf50;
    --warning: #ff9800;
    --danger: #f44336;
    --info: #2196f3;
    --dark: #2c3e50;
    --light: #ecf0f1;
    --sidebar-width: 260px;
    --topbar-height: 70px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f7fa;
    color: #333;
}

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    box-shadow: 4px 0 10px rgba(0,0,0,0.1);
    z-index: 1000;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
}

.logo-icon {
    font-size: 32px;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-item.active {
    background: rgba(255,255,255,0.15);
    color: white;
    border-left-color: white;
}

.nav-icon {
    font-size: 20px;
    width: 24px;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.user-details {
    flex: 1;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
}

.user-id {
    font-size: 12px;
    color: #999;
    font-family: monospace;
    margin-top: 4px;
}

.user-role {
    font-size: 12px;
    opacity: 0.7;
}

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    color: white;
    text-decoration: none;
    transition: all 0.3s;
    font-size: 14px;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.2);
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.top-bar {
    height: var(--topbar-height);
    background: white;
    border-bottom: 1px solid #e0e0e0;
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--dark);
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.top-bar-item {
    display: flex;
    align-items: center;
}

.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.badge-success {
    background: #e8f5e9;
    color: #4caf50;
}

.time {
    font-size: 16px;
    font-weight: 500;
    color: #666;
    display: flex;
    align-items: center;
    gap: 4px;
}

.time .date {
    font-size: 14px;
    color: #999;
}

.time .time-separator {
    color: #ccc;
    font-weight: 300;
}

.time .time-value {
    font-weight: 600;
    color: #666;
    font-family: 'Courier New', monospace;
    font-size: 15px;
}

body.dark-theme .time {
    color: #e0e0e0;
}

body.dark-theme .time .date {
    color: #999;
}

body.dark-theme .time .time-value {
    color: #e0e0e0;
}

.content {
    padding: 30px;
    flex: 1;
}

/* Dashboard */
.dashboard {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.metric-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    gap: 16px;
    transition: all 0.3s;
}

.metric-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.metric-card.primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.metric-card.success {
    background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
}

.metric-card.info {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

.metric-card.warning {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.metric-icon {
    font-size: 40px;
    opacity: 0.9;
}

.metric-content {
    flex: 1;
}

.metric-value {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 4px;
}

.metric-label {
    font-size: 14px;
    opacity: 0.8;
    margin-bottom: 8px;
}

.metric-change {
    font-size: 13px;
    opacity: 0.7;
}

.metric-change.positive {
    color: #4caf50;
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

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

.panel-header {
    padding: 20px 24px;
    border-bottom: 1px solid #f0f0f0;
}

.panel-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--dark);
}

.panel-body {
    padding: 24px;
}

.list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
}

.list-number {
    width: 28px;
    height: 28px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
}

.list-label {
    flex: 1;
    font-weight: 500;
}

.list-value {
    font-weight: 600;
    color: var(--primary);
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s;
}

.action-btn:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
}

.action-icon {
    font-size: 32px;
}

.action-label {
    font-size: 14px;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
    }
    
    .main-content {
        margin-left: 80px;
    }
    
    .logo-text,
    .nav-label,
    .user-details,
    .btn-logout span:last-child {
        display: none;
    }
    
    .nav-item {
        justify-content: center;
    }
    
    .user-info {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .content-grid {
        grid-template-columns: 1fr;
    }
    
    .quick-actions {
        grid-template-columns: 1fr;
    }
}

/* 🌙 Dark Theme */
body.dark-theme {
    background: #1a1a2e;
    color: #eee;
}

body.dark-theme .sidebar {
    background: linear-gradient(180deg, #16213e 0%, #0f3460 100%);
}

body.dark-theme .top-bar {
    background: #16213e;
    border-bottom-color: #2a2a3e;
}

body.dark-theme .page-title {
    color: #eee;
}

body.dark-theme .time {
    color: #aaa;
}

body.dark-theme .content {
    background: #1a1a2e;
}

body.dark-theme .metric-card {
    background: #16213e;
    color: #eee;
}

/* Colored cards keep their gradients in dark theme */

body.dark-theme .panel {
    background: #16213e;
}

body.dark-theme .panel-header {
    border-bottom-color: #2a2a3e;
}

body.dark-theme .panel-header h3 {
    color: #eee;
}

body.dark-theme .list-item {
    background: #1a1a2e;
}

body.dark-theme .action-btn {
    background: #1a1a2e;
    color: #eee;
}

body.dark-theme .action-btn:hover {
    background: var(--primary);
    color: white;
}

/* Theme Toggle Button */
.theme-toggle {
    cursor: pointer;
    font-size: 24px;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.theme-toggle:hover {
    background: rgba(102, 126, 234, 0.1);
}

/* Chart Canvas */
#activityChart {
    min-height: 200px;
    max-height: 400px;
}

/* Dark Theme - Tables */
body.dark-theme table {
    background: #16213e;
    color: #eee;
}

body.dark-theme thead {
    background: #0f3460 !important;
}

body.dark-theme thead th {
    background: #0f3460 !important;
    color: #eee !important;
    border-bottom: 2px solid #2a2a3e;
}

body.dark-theme tbody tr {
    border-bottom: 1px solid #2a2a3e;
}

body.dark-theme tbody tr:hover {
    background: #1a1a2e;
}

body.dark-theme tbody td {
    color: #e0e0e0;
}

body.dark-theme tbody td code {
    background: rgba(102, 126, 234, 0.2);
    color: #90caf9;
    padding: 2px 6px;
    border-radius: 4px;
}

body.dark-theme tbody td strong {
    color: #eee;
}

body.dark-theme tbody td small {
    color: #aaa;
}

/* Dark Theme - Stat Cards (Statistics page) */
body.dark-theme .stat-card {
    background: #16213e !important;
    color: #eee !important;
}

body.dark-theme .stat-card .stat-label {
    color: #ccc !important;
}

body.dark-theme .stat-card .stat-value {
    color: #eee !important;
}

body.dark-theme .stat-card small {
    color: #aaa !important;
}

/* Dark Theme - Chart Containers */
body.dark-theme .chart-container {
    background: #16213e;
    color: #eee;
}

body.dark-theme .chart-container h3 {
    color: #90caf9;
}

/* Dark Theme - Section Headers */
body.dark-theme .section h2 {
    color: #90caf9;
    border-bottom-color: #667eea;
}

body.dark-theme .section h3 {
    color: #90caf9;
}

/* Dark Theme - Empty State */
body.dark-theme .empty-state {
    color: #aaa;
}

/* Dark Theme - Inline table styles override */
body.dark-theme table[style*="width"] {
    background: #16213e !important;
}

body.dark-theme thead tr[style*="background"] {
    background: #0f3460 !important;
}

body.dark-theme thead tr[style*="background"] th {
    background: #0f3460 !important;
    color: #eee !important;
}

body.dark-theme tbody tr[style*="border-bottom"] {
    border-bottom-color: #2a2a3e !important;
}

body.dark-theme tbody tr[style*="border-bottom"] td {
    color: #e0e0e0 !important;
}

body.dark-theme tbody tr[style*="border-bottom"] td strong {
    color: #eee !important;
}

body.dark-theme tbody tr[style*="border-bottom"] td code {
    background: rgba(102, 126, 234, 0.2) !important;
    color: #90caf9 !important;
}

body.dark-theme tbody tr[style*="border-bottom"] td small {
    color: #aaa !important;
}

/* Payment Type Badges */
.badge-stars {
    background: #ffd700 !important;
    color: #333 !important;
}

.badge-ton {
    background: #0088cc !important;
    color: white !important;
}

body.dark-theme .badge-stars {
    background: #ffd700 !important;
    color: #1a1a2e !important;
}

body.dark-theme .badge-ton {
    background: #0088cc !important;
    color: white !important;
}

body.dark-theme .user-name {
    color: #eee;
}

body.dark-theme .user-id {
    color: #999;
}
