/* assets/css/main.css */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800&display=swap');

/* ===== CSS Variables ===== */
:root {
    --primary:       #1a2e4a;
    --primary-light: #243d5e;
    --accent:        #3b82f6;
    --accent-hover:  #2563eb;
    --success:       #10b981;
    --danger:        #ef4444;
    --warning:       #f59e0b;
    --info:          #06b6d4;
    --bg:            #f1f5f9;
    --surface:       #ffffff;
    --border:        #e2e8f0;
    --text:          #1e293b;
    --text-muted:    #64748b;
    --shadow-sm:     0 1px 3px rgba(0,0,0,.08);
    --shadow:        0 4px 16px rgba(0,0,0,.10);
    --shadow-lg:     0 10px 30px rgba(0,0,0,.15);
    --radius:        10px;
    --radius-sm:     6px;
    --radius-lg:     16px;
    --sidebar-w:     260px;
    --topbar-h:      64px;
    --transition:    0.2s ease;
}

/* ===== Reset ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: 'Cairo', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    direction: rtl;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: var(--accent); transition: color var(--transition); }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; display: block; }
ul, ol { list-style: none; }

/* ===== Utilities ===== */
.container { width: 92%; max-width: 1200px; margin: 0 auto; }
.text-center { text-align: center; }
.text-left  { text-align: left; }
.text-muted { color: var(--text-muted); font-size: .875rem; }
.fw-bold { font-weight: 700; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.flex-wrap { flex-wrap: wrap; }

.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.p-0 { padding: 0 !important; }

.w-100 { width: 100%; }

/* ===== Alerts ===== */
.alert {
    padding: .85rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    border-right: 4px solid transparent;
    font-size: .95rem;
}
.alert-success { background: #ecfdf5; color: #065f46; border-color: var(--success); }
.alert-danger  { background: #fef2f2; color: #991b1b; border-color: var(--danger); }
.alert-warning { background: #fffbeb; color: #92400e; border-color: var(--warning); }
.alert-info    { background: #ecfeff; color: #155e75; border-color: var(--info); }

/* ===== Badges ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: .2rem .65rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info    { background: #cffafe; color: #155e75; }
.badge-gray    { background: #f1f5f9; color: #475569; }
.badge-primary { background: #dbeafe; color: #1e40af; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .6rem 1.4rem;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    font-size: .9375rem;
    transition: all var(--transition);
    white-space: nowrap;
    text-decoration: none;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }

.btn-primary   { background: var(--accent);   color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(59,130,246,.35); }

.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg); color: var(--text); }

.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; color: #fff; }

.btn-danger    { background: var(--danger);  color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }

.btn-warning   { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; color: #fff; }

.btn-dark      { background: var(--primary); color: #fff; }
.btn-dark:hover { background: var(--primary-light); color: #fff; }

.btn-sm { padding: .35rem .8rem; font-size: .8125rem; }
.btn-lg { padding: .85rem 2rem; font-size: 1.05rem; }
.btn-block { width: 100%; }

/* ===== Forms ===== */
.form-group { margin-bottom: 1.1rem; }
.form-label {
    display: block;
    margin-bottom: .4rem;
    font-weight: 600;
    font-size: .9rem;
    color: var(--text);
}
.form-control {
    width: 100%;
    padding: .65rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: .9375rem;
    color: var(--text);
    background: var(--surface);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.form-control::placeholder { color: #94a3b8; }
.form-control[readonly] { background: var(--bg); }

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

/* ===== Card ===== */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
    overflow: hidden;
}
.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: #fafbfc;
    font-weight: 700;
    font-size: 1rem;
}
.card-body { padding: 1.5rem; }
.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: #fafbfc;
}

/* ===== Table ===== */
.table-responsive { overflow-x: auto; border-radius: var(--radius); }
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}
.table th, .table td {
    padding: .85rem 1rem;
    text-align: right;
    border-bottom: 1px solid var(--border);
}
.table thead th {
    background: #f8fafc;
    font-weight: 700;
    color: var(--text-muted);
    font-size: .8125rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    white-space: nowrap;
}
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: #f8fafc; }
.table tbody tr:last-child td { border-bottom: none; }

/* ===== Grid ===== */
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
