/* ============================================================
   AL ABRAR GROUPE SCOLAIRE — Modern Education Theme
   Palette:
     - Primary (Petrol Blue): #075A6E
     - Secondary (Brand Orange): #F15A24
     - Background: #F8FAFC
     - Main Text: #12303A
     - Muted Text: #64748B
     - Cards: #FFFFFF
     - Radius: 12px (10-14px)
   ============================================================ */

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

:root {
    --primary:        #075A6E;
    --primary-dark:   #054555;
    --primary-light:  #0e7c97;
    --secondary:      #F15A24;
    --secondary-dark: #d44816;
    --secondary-light:#ff723f;
    --bg-main:        #F8FAFC;
    --bg-card:        #FFFFFF;
    --bg-sidebar:     #075A6E;
    --text-main:      #12303A;
    --text-muted:     #64748B;
    --border:         #E2E8F0;
    --radius:         12px;
    --shadow-sm:      0 1px 3px rgba(18, 48, 58, 0.05);
    --shadow-md:      0 4px 16px rgba(7, 90, 110, 0.08);
    --shadow-lg:      0 12px 30px rgba(7, 90, 110, 0.12);
}

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

html[lang="ar"] { font-family: 'Cairo', 'Inter', sans-serif; }
html[lang="fr"] { font-family: 'Inter', 'Cairo', sans-serif; }

body {
    background: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #F1F5F9; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* ── Cards & Surfaces ──────────────────────────────────── */
.glass {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.glass-hover {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.glass-hover:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ── Gradient Presets ──────────────────────────────────── */
.gradient-primary {
    background: linear-gradient(135deg, #075A6E, #0a738c);
}
.gradient-secondary {
    background: linear-gradient(135deg, #F15A24, #ff723f);
}
.gradient-success {
    background: linear-gradient(135deg, #059669, #10b981);
}
.gradient-warning {
    background: linear-gradient(135deg, #F15A24, #f59e0b);
}
.gradient-danger {
    background: linear-gradient(135deg, #dc2626, #ef4444);
}
.gradient-mesh {
    background:
        radial-gradient(ellipse at 10% 20%, rgba(7,90,110,0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 90% 80%, rgba(241,90,36,0.03) 0%, transparent 50%),
        #F8FAFC;
}

/* ── Sidebar ───────────────────────────────────────────── */
.sidebar {
    width: 260px;
    min-height: 100vh;
    background: #075A6E;
    border-inline-end: 1px solid rgba(255,255,255,0.1);
    position: fixed;
    top: 0;
    inset-inline-start: 0;
    z-index: 100;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    color: white;
    box-shadow: 4px 0 25px rgba(7, 90, 110, 0.15);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.15rem;
    margin: 0.25rem 0.75rem;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.sidebar-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.12);
    transform: translateX(3px);
}

html[dir="rtl"] .sidebar-link:hover {
    transform: translateX(-3px);
}

.sidebar-link.active {
    color: white;
    background: #F15A24;
    box-shadow: 0 4px 15px rgba(241, 90, 36, 0.4);
}

.sidebar-link .icon {
    font-size: 1.2rem;
    width: 1.5rem;
    text-align: center;
    flex-shrink: 0;
}

/* ── Main Content Area ─────────────────────────────────── */
.main-content {
    margin-inline-start: 260px;
    min-height: 100vh;
    padding: 1.5rem 2rem;
}

/* ── Stat Cards ────────────────────────────────────────── */
.stat-card {
    position: relative;
    overflow: hidden;
    padding: 1.35rem 1.5rem;
    border-radius: var(--radius);
    background: white;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

/* ── Buttons ───────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.875rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

/* Orange Action Button (Primary) */
.btn-primary, .btn-action {
    background: #F15A24;
    color: white;
    box-shadow: 0 4px 14px rgba(241, 90, 36, 0.3);
}
.btn-primary:hover, .btn-action:hover {
    background: #d44816;
    box-shadow: 0 6px 20px rgba(241, 90, 36, 0.4);
}

/* Petrol Blue Button */
.btn-petrol {
    background: #075A6E;
    color: white;
    box-shadow: 0 4px 14px rgba(7, 90, 110, 0.25);
}
.btn-petrol:hover {
    background: #054555;
    box-shadow: 0 6px 18px rgba(7, 90, 110, 0.35);
}

.btn-success {
    background: #059669;
    color: white;
}
.btn-success:hover { background: #047857; }

.btn-danger {
    background: #dc2626;
    color: white;
}
.btn-danger:hover { background: #b91c1c; }

.btn-ghost {
    background: #F1F5F9;
    color: #334155;
    border: 1px solid #E2E8F0;
}
.btn-ghost:hover {
    background: #E2E8F0;
    color: #0f172a;
}

/* ── Forms ─────────────────────────────────────────────── */
.form-input {
    width: 100%;
    background: #FFFFFF;
    border: 1px solid #CBD5E1;
    border-radius: 10px;
    padding: 0.65rem 1rem;
    color: #12303A;
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.2s ease;
    outline: none;
}

.form-input:focus {
    border-color: #075A6E;
    box-shadow: 0 0 0 3px rgba(7, 90, 110, 0.15);
    background: #FFFFFF;
}

.form-input::placeholder { color: #94A3B8; }

.form-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    color: #475569;
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Table ─────────────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: #F8FAFC;
    color: #075A6E;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.85rem 1.1rem;
    text-align: start;
    border-bottom: 2px solid #E2E8F0;
    white-space: nowrap;
}

.data-table td {
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid #F1F5F9;
    font-size: 0.9rem;
    color: #12303A;
    vertical-align: middle;
}

.data-table tr:hover td {
    background: #F8FAFC;
}

.data-table tr:last-child td { border-bottom: none; }

/* ── Badges ────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-active   { background: #D1FAE5; color: #047857; border: 1px solid #A7F3D0; }
.badge-inactive { background: #F1F5F9; color: #64748B; border: 1px solid #E2E8F0; }
.badge-in       { background: #E0F2FE; color: #0369A1; border: 1px solid #BAE6FD; }
.badge-out      { background: #FFEDD5; color: #C2410C; border: 1px solid #FED7AA; }
.badge-valid    { background: #D1FAE5; color: #047857; }
.badge-duplicate{ background: #FEF3C7; color: #B45309; }
.badge-error    { background: #FEE2E2; color: #B91C1C; }

/* ── Modal ─────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(18, 48, 58, 0.6);
    backdrop-filter: blur(5px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.2s ease;
}

.modal-box {
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 16px;
    padding: 2rem;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
    box-shadow: 0 20px 50px rgba(18, 48, 58, 0.2);
    color: #12303A;
}

/* ── Scanner Frame ─────────────────────────────────────── */
.scanner-frame {
    position: relative;
    width: 300px;
    height: 300px;
    margin: 0 auto;
    border-radius: 1.25rem;
    overflow: hidden;
    background: #12303A;
}

.scanner-frame::before,
.scanner-frame::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border: 3px solid transparent;
    border-radius: 1.25rem;
    z-index: 10;
}

.scanner-frame::before {
    border-color: #F15A24;
    animation: scanPulse 2s ease-in-out infinite;
}

.scanner-line {
    position: absolute;
    width: 90%;
    left: 5%;
    height: 3px;
    background: linear-gradient(90deg, transparent, #F15A24, #ff723f, transparent);
    border-radius: 2px;
    animation: scanLine 2s linear infinite;
    z-index: 11;
    box-shadow: 0 0 10px rgba(241,90,36,0.8);
}

/* ── Login Background ──────────────────────────────────── */
.login-bg {
    background:
        radial-gradient(circle at 10% 20%, rgba(7, 90, 110, 0.06) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(241, 90, 36, 0.05) 0%, transparent 40%),
        #F8FAFC;
}

/* ── Animations ────────────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes scanLine {
    0%   { top: 10%; }
    50%  { top: 85%; }
    100% { top: 10%; }
}

@keyframes scanPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(241,90,36,0.4); }
    50%      { box-shadow: 0 0 0 8px rgba(241,90,36,0); }
}

@keyframes scaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50%       { transform: translateY(-6px); }
}

.animate-float    { animation: float 3s ease-in-out infinite; }
.animate-scale-in { animation: scaleIn 0.25s ease; }

/* ── Loading Skeleton ──────────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg, #F1F5F9 25%, #E2E8F0 50%, #F1F5F9 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ── Responsive Mobile Menu ────────────────────────────── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    html[dir="rtl"] .sidebar {
        transform: translateX(100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-inline-start: 0;
        padding: 1rem;
    }
}

/* ── Utilities ─────────────────────────────────────────── */
.divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.12);
    margin: 0.5rem 0.75rem;
}

.page-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: #075A6E;
}

.section-title {
    font-size: 0.72rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.5rem 1.15rem 0.2rem;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.search-box {
    position: relative;
}

.search-box input {
    padding-inline-start: 2.5rem;
}

.search-box .search-icon {
    position: absolute;
    inset-inline-start: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94A3B8;
    pointer-events: none;
}
