/* ============================================================
   Attendance System — Ethad Emaar Albina Almutahida
   Refined corporate design language
   ============================================================ */

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

:root {
    /* Brand colors — from company logo */
    --brand-deep:       #15316b;
    --brand:            #1e3a8a;
    --brand-light:      #2563eb;
    --brand-soft:       #dbeafe;
    --brand-mist:       #eff6ff;

    /* Neutrals */
    --bg:               #f5f6fa;
    --bg-soft:          #fafbfc;
    --surface:          #ffffff;
    --border:           #e3e7ee;
    --border-strong:    #cbd5e1;
    --text:             #1a2332;
    --text-2:           #495267;
    --muted:            #6b7689;
    --muted-soft:       #94a3b8;

    /* Status palette */
    --success:          #15803d;
    --success-soft:     #dcfce7;
    --success-strong:   #14532d;
    --warning:          #b45309;
    --warning-soft:     #fef3c7;
    --danger:           #b91c1c;
    --danger-soft:      #fee2e2;
    --info:             #0369a1;
    --info-soft:        #e0f2fe;

    /* Geometry */
    --radius-sm:        6px;
    --radius:           10px;
    --radius-lg:        14px;
    --radius-xl:        20px;

    /* Elevation */
    --shadow-xs:        0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm:        0 2px 4px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow:           0 4px 12px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.04);
    --shadow-lg:        0 10px 25px -5px rgba(15, 23, 42, 0.10), 0 8px 10px -6px rgba(15, 23, 42, 0.05);
    --shadow-brand:     0 10px 28px -8px rgba(30, 58, 138, 0.45);

    --transition:       all 0.18s cubic-bezier(.4,0,.2,1);

    /* Font families */
    --font-ar:          'Cairo', 'Segoe UI', 'Tahoma', sans-serif;
    --font-en:          'Inter', -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ar);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html[lang="en"] body { font-family: var(--font-en); }

a {
    color: var(--brand);
    text-decoration: none;
    transition: var(--transition);
}
a:hover { color: var(--brand-light); }

/* ============================================================
   Top bar
   ============================================================ */
.topbar {
    background: linear-gradient(135deg, var(--brand-deep) 0%, var(--brand) 100%);
    color: #fff;
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    box-shadow: var(--shadow-brand);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar .brand {
    display: flex; align-items: center; gap: 12px;
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.01em;
}

.topbar .brand-logo {
    width: 38px; height: 38px;
    background: #fff;
    border-radius: 10px;
    padding: 4px;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.topbar .brand-logo img {
    width: 100%; height: 100%;
    object-fit: contain;
}

.topbar nav {
    display: flex; align-items: center; gap: 4px;
    flex-wrap: wrap;
}

.topbar nav a {
    color: rgba(255, 255, 255, 0.78);
    font-weight: 500;
    font-size: 14px;
    padding: 7px 14px;
    border-radius: 8px;
    transition: var(--transition);
}
.topbar nav a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.10);
}
.topbar nav a.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.16);
    font-weight: 600;
}

.lang-switch {
    color: rgba(255, 255, 255, 0.85) !important;
    font-size: 13px;
    padding: 7px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.10);
}
.lang-switch:hover { background: rgba(255, 255, 255, 0.18); }

/* ============================================================
   Container / Layout
   ============================================================ */
.container {
    max-width: 1240px;
    margin: 28px auto;
    padding: 0 24px;
}

h1 {
    font-size: 26px;
    font-weight: 700;
    margin: 0 0 22px;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.25;
}
h2 {
    font-size: 17px;
    font-weight: 600;
    margin: 0 0 16px;
    color: var(--text);
    letter-spacing: -0.01em;
}
h3 {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 10px;
    color: var(--text-2);
}

/* ============================================================
   Cards
   ============================================================ */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 22px;
    transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow); }

/* ============================================================
   Forms
   ============================================================ */
.field {
    margin-bottom: 16px;
}
.field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 7px;
    color: var(--text-2);
    letter-spacing: 0.005em;
}
.field input, .field select, .field textarea {
    width: 100%;
    padding: 10px 13px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    transition: var(--transition);
}
.field input:hover,
.field select:hover,
.field textarea:hover {
    border-color: var(--border-strong);
}
.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3.5px rgba(30, 58, 138, 0.12);
}
.field input::placeholder, .field textarea::placeholder { color: var(--muted-soft); }

.field small {
    color: var(--muted);
    font-size: 12px;
    margin-top: 5px;
    display: block;
}

.row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}
.row .field { flex: 1; min-width: 200px; }

fieldset {
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 18px;
}
legend {
    padding: 0 8px;
    font-weight: 600;
    color: var(--text-2);
    font-size: 13px;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    letter-spacing: 0.005em;
    box-shadow: var(--shadow-xs);
}
.btn:hover {
    background: var(--brand-deep);
    color: #fff;
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}
.btn:active { transform: translateY(0); }

.btn-success { background: var(--success); }
.btn-success:hover { background: var(--success-strong); }

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #991b1b; }

.btn-ghost {
    background: var(--surface);
    color: var(--text);
    border: 1.5px solid var(--border);
    box-shadow: none;
}
.btn-ghost:hover {
    background: var(--bg-soft);
    color: var(--text);
    border-color: var(--border-strong);
    transform: none;
}

.btn-lg { padding: 13px 26px; font-size: 15px; }
.btn-block { display: flex; width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none !important; }

/* ============================================================
   Tables
   ============================================================ */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
}
.table th, .table td {
    text-align: start;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
}
.table th {
    background: var(--bg-soft);
    font-weight: 600;
    color: var(--text-2);
    text-transform: uppercase;
    font-size: 11.5px;
    letter-spacing: 0.06em;
    border-bottom: 2px solid var(--border);
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--bg-soft); }
.table td small { color: var(--muted); }

/* ============================================================
   Badges
   ============================================================ */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.4;
}
.badge-in       { background: var(--success-soft); color: var(--success-strong); }
.badge-out      { background: var(--danger-soft); color: #991b1b; }
.badge-ok       { background: var(--brand-soft); color: var(--brand-deep); }
.badge-warn     { background: var(--warning-soft); color: var(--warning); }
.badge-muted    { background: #f1f3f7; color: var(--muted); }

/* ============================================================
   Alerts
   ============================================================ */
.alert {
    padding: 13px 16px;
    border-radius: var(--radius);
    margin-bottom: 18px;
    font-size: 13.5px;
    line-height: 1.55;
    border-inline-start: 4px solid;
}
.alert-success { background: var(--success-soft); color: var(--success-strong); border-color: var(--success); }
.alert-error   { background: var(--danger-soft);  color: #7f1d1d; border-color: var(--danger); }
.alert-warn    { background: var(--warning-soft); color: #78350f; border-color: var(--warning); }
.alert-info    { background: var(--info-soft);    color: #0c4a6e; border-color: var(--info); }

/* ============================================================
   Stats grid (dashboard)
   ============================================================ */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}
.stat:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}
.stat::before {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    top: 0; bottom: 0;
    width: 3px;
    background: var(--brand);
}
.stat .label {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 6px;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.stat .value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
    letter-spacing: -0.02em;
}

/* ============================================================
   Login page (special treatment)
   ============================================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--brand-deep) 0%, var(--brand) 55%, var(--brand-light) 100%);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

/* Decorative geometric background */
.login-page::before, .login-page::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}
.login-page::before {
    width: 580px; height: 580px;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
    top: -200px; right: -180px;
}
.login-page::after {
    width: 460px; height: 460px;
    background: radial-gradient(circle, rgba(255,255,255,0.06) 0%, transparent 70%);
    bottom: -150px; left: -150px;
}

.login-wrap {
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
}

.login-card {
    background: #fff;
    border-radius: var(--radius-xl);
    padding: 38px 38px 30px;
    box-shadow: 0 20px 60px -12px rgba(0, 0, 0, 0.35);
    animation: cardIn 0.5s cubic-bezier(.16,1,.3,1) both;
}

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

.login-logo {
    text-align: center;
    margin-bottom: 24px;
}
.login-logo img {
    width: 110px; height: 110px;
    border-radius: 22px;
    object-fit: contain;
    box-shadow: 0 8px 24px -6px rgba(30, 58, 138, 0.3);
}

.login-title {
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 6px;
    letter-spacing: -0.02em;
}
.login-subtitle {
    text-align: center;
    color: var(--muted);
    font-size: 14px;
    margin: 0 0 26px;
}

.login-card .field input {
    padding: 12px 14px;
    font-size: 15px;
}

.login-card .btn-lg {
    padding: 14px;
    font-size: 15px;
    margin-top: 4px;
    background: linear-gradient(135deg, var(--brand-deep), var(--brand-light));
}
.login-card .btn-lg:hover {
    background: linear-gradient(135deg, var(--brand), var(--brand-deep));
}

.login-footer {
    text-align: center;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.6;
}

/* App-wide developer credit footer */
.app-footer {
    text-align: center;
    padding: 24px 16px 28px;
    margin-top: 40px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.6;
    background: var(--bg);
}
.app-footer strong { color: var(--text-2); font-weight: 600; }

/* ============================================================
   Employee scan page
   ============================================================ */
.scan-page {
    min-height: 100vh;
    background: linear-gradient(160deg, var(--brand-deep) 0%, var(--brand) 70%);
    padding: 24px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.scan-page::before {
    content: '';
    position: absolute;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(255,255,255,0.07) 0%, transparent 70%);
    top: -180px; right: -160px;
    border-radius: 50%;
    pointer-events: none;
}

.scan-wrap {
    width: 100%;
    max-width: 430px;
    position: relative;
    z-index: 1;
}

.scan-card {
    background: #fff;
    border-radius: var(--radius-xl);
    padding: 30px 26px 24px;
    box-shadow: 0 18px 50px -10px rgba(0, 0, 0, 0.3);
}

.scan-logo {
    text-align: center;
    margin-bottom: 18px;
}
.scan-logo img {
    width: 76px; height: 76px;
    border-radius: 16px;
    object-fit: contain;
}

.scan-site {
    text-align: center;
    padding: 12px 0 18px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}
.scan-site .label {
    font-size: 11.5px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 500;
}
.scan-site .name {
    font-size: 19px;
    font-weight: 700;
    color: var(--text);
    margin-top: 4px;
}

.actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 16px;
}
.actions .btn {
    padding: 16px 0;
    font-size: 15px;
    font-weight: 600;
    justify-content: center;
}

.scan-footer-credit {
    text-align: center;
    margin-top: 18px;
    color: rgba(255,255,255,0.78);
    font-size: 11.5px;
    line-height: 1.6;
    text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.scan-footer-credit strong { color: #fff; }

/* ============================================================
   Lang toggle in scan / login pages (floating)
   ============================================================ */
.lang-toggle {
    position: absolute;
    top: 18px;
    inset-inline-end: 18px;
    background: rgba(255, 255, 255, 0.16);
    color: #fff !important;
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    backdrop-filter: blur(8px);
    transition: var(--transition);
    z-index: 10;
}
.lang-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
    text-decoration: none;
}

/* ============================================================
   Print mode
   ============================================================ */
@media print {
    .topbar, .no-print, .btn, .app-footer { display: none !important; }
    .card { box-shadow: none; border: 1px solid #ccc; }
    body { background: #fff; }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 720px) {
    .topbar { padding: 12px 16px; }
    .topbar .brand { font-size: 15px; }
    .topbar .brand-logo { width: 34px; height: 34px; }
    .topbar nav a { padding: 6px 10px; font-size: 13px; }
    .container { margin: 16px auto; padding: 0 14px; }
    h1 { font-size: 22px; }
    .card { padding: 18px; border-radius: 12px; }
    .row .field { min-width: 100%; }
    .table { font-size: 12.5px; }
    .table th, .table td { padding: 9px 10px; }
    .login-card { padding: 28px 24px 22px; }
    .login-logo img { width: 90px; height: 90px; }
}

/* RTL/LTR direction adjustments */
html[dir="rtl"] body { direction: rtl; }
html[dir="ltr"] body { direction: ltr; }

.num, .lat, .lng, .time-cell {
    direction: ltr;
    unicode-bidi: embed;
}
