/* SnapTop Admin Panel - Styles */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800&display=swap');

:root {
    --bg: #0f1117;
    --bg-card: #1a1d27;
    --bg-card-hover: #22263a;
    --bg-input: #14161e;
    --border: #2a2d3a;
    --border-focus: #ffd600;
    --text: #e8e8ec;
    --text-secondary: #8b8fa3;
    --text-muted: #555770;
    --accent: #ffd600;
    --accent-hover: #ffe033;
    --accent-dim: rgba(255, 214, 0, 0.12);
    --success: #22c55e;
    --success-dim: rgba(34, 197, 94, 0.12);
    --danger: #ef4444;
    --danger-dim: rgba(239, 68, 68, 0.12);
    --info: #3b82f6;
    --info-dim: rgba(59, 130, 246, 0.12);
    --warning: #f59e0b;
    --warning-dim: rgba(245, 158, 11, 0.12);
    --radius: 14px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0,0,0,0.3);
}

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

body {
    font-family: 'Cairo', sans-serif;
    background: var(--bg);
    color: var(--text);
    direction: rtl;
    min-height: 100vh;
    line-height: 1.7;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ── Login Page ── */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f1117 0%, #1a1d27 50%, #0f1117 100%);
}

.login-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow);
}

.login-box .logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-box .logo h1 {
    font-size: 28px;
    font-weight: 800;
    color: var(--accent);
}

.login-box .logo p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

/* ── Layout ── */
.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    padding: 24px 0;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar .brand {
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.sidebar .brand h2 {
    font-size: 22px;
    font-weight: 800;
    color: var(--accent);
}

.sidebar .brand small {
    color: var(--text-muted);
    font-size: 12px;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    border-right: 3px solid transparent;
}

.sidebar nav a:hover {
    background: var(--bg-card-hover);
    color: var(--text);
}

.sidebar nav a.active {
    background: var(--accent-dim);
    color: var(--accent);
    border-right-color: var(--accent);
    font-weight: 600;
}

.sidebar nav a .icon {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.sidebar .logout-btn {
    margin: 16px 20px 0;
    padding: 10px;
    text-align: center;
    border: 1px solid var(--danger);
    border-radius: var(--radius-sm);
    color: var(--danger);
    font-weight: 600;
    display: block;
    transition: all 0.2s;
}

.sidebar .logout-btn:hover {
    background: var(--danger);
    color: white;
}

.main-content {
    margin-right: 260px;
    padding: 28px;
    flex: 1;
    min-height: 100vh;
}

/* ── Page Header ── */
.page-header {
    margin-bottom: 28px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

/* ── Stats Grid ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: all 0.25s;
}

.stat-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(255, 214, 0, 0.08);
}

.stat-card .stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 14px;
}

.stat-card .stat-icon.yellow { background: var(--accent-dim); color: var(--accent); }
.stat-card .stat-icon.green { background: var(--success-dim); color: var(--success); }
.stat-card .stat-icon.blue { background: var(--info-dim); color: var(--info); }
.stat-card .stat-icon.red { background: var(--danger-dim); color: var(--danger); }

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 800;
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ── Cards ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 20px;
    overflow: hidden;
}

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

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.card-body { padding: 20px; }

/* ── Forms ── */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: 'Cairo', sans-serif;
    font-size: 14px;
    transition: border-color 0.2s;
    direction: rtl;
}

.form-control:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

select.form-control {
    cursor: pointer;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Cairo', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: #111;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(255, 214, 0, 0.3);
    color: #111;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #16a34a;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
}

/* ── Tables ── */
.table-wrap {
    overflow-x: auto;
}

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

table th, table td {
    padding: 12px 16px;
    text-align: right;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

table th {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

table tr:hover td {
    background: var(--bg-card-hover);
}

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

.badge-success { background: var(--success-dim); color: var(--success); }
.badge-danger { background: var(--danger-dim); color: var(--danger); }
.badge-warning { background: var(--warning-dim); color: var(--warning); }
.badge-info { background: var(--info-dim); color: var(--info); }

/* ── Alerts ── */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success { background: var(--success-dim); color: var(--success); border: 1px solid rgba(34,197,94,0.2); }
.alert-danger { background: var(--danger-dim); color: var(--danger); border: 1px solid rgba(239,68,68,0.2); }
.alert-warning { background: var(--warning-dim); color: var(--warning); border: 1px solid rgba(245,158,11,0.2); }
.alert-info { background: var(--info-dim); color: var(--info); border: 1px solid rgba(59,130,246,0.2); }

/* ── Date Filter ── */
.date-filter {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.date-filter input[type="date"] {
    padding: 8px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: 'Cairo', sans-serif;
    font-size: 13px;
}

.date-filter input[type="date"]:focus {
    border-color: var(--border-focus);
    outline: none;
}

/* ── Quick Buttons ── */
.quick-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.quick-buttons .btn {
    font-size: 12px;
    padding: 6px 14px;
}

/* ── Chart Container ── */
.chart-container {
    position: relative;
    height: 300px;
    padding: 10px;
}

/* ── Upload Area ── */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-area:hover, .upload-area.dragover {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.upload-area .upload-icon {
    font-size: 48px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.upload-area p {
    color: var(--text-secondary);
    font-size: 14px;
}

.upload-area .file-info {
    margin-top: 12px;
    color: var(--accent);
    font-weight: 600;
}

/* ── Modal ── */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-overlay.show { display: flex; }

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 { font-size: 16px; }

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
}

.modal-body { padding: 20px; }

.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ── Version Card ── */
.version-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 14px;
    transition: all 0.2s;
}

.version-card:hover { border-color: var(--border-focus); }

.version-card .version-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 8px;
}

.version-card .version-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
}

.version-card .version-meta {
    display: flex;
    gap: 16px;
    color: var(--text-secondary);
    font-size: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.version-card .version-changelog {
    background: var(--bg-input);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    line-height: 1.8;
    color: var(--text-secondary);
    white-space: pre-wrap;
    margin-bottom: 14px;
}

.version-card .version-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Notification Card ── */
.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    transition: all 0.2s;
}

.notification-item:hover { border-color: var(--accent); }

.notification-item .notif-content { flex: 1; }
.notification-item .notif-title { font-weight: 600; font-size: 14px; }
.notification-item .notif-msg { color: var(--text-secondary); font-size: 13px; margin-top: 4px; }
.notification-item .notif-date { color: var(--text-muted); font-size: 11px; margin-top: 6px; }

/* ── Empty state ── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state p { font-size: 14px; }

/* ── Progress Bar ── */
.progress {
    height: 10px;
    background: var(--bg-input);
    border-radius: 6px;
    overflow: hidden;
    margin: 12px 0 6px;
    border: 1px solid var(--border);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #F7BB23, #E8471B);
    border-radius: 6px;
    transition: width 0.15s ease-out;
    width: 0%;
}

.upload-progress-container {
    display: none;
    margin-top: 14px;
    background: var(--bg-input);
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.upload-progress-container.show {
    display: block;
}

.upload-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 700;
}

.upload-progress-details {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ── Rich Text Editor Toolbar ── */
.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    background: var(--bg-input);
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.editor-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.editor-btn:hover {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

.editor-textarea {
    border-radius: 0 0 var(--radius-sm) var(--radius-sm) !important;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-right: 0; padding: 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}
