/* ============================================
   توصيل شهري — نظام التصميم
   ============================================ */

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

:root {
    --navy: #122A34;
    --navy-light: #1D3E4C;
    --bg: #EEF2F1;
    --surface: #FFFFFF;
    --amber: #E8A93B;
    --amber-dark: #C98F26;
    --green: #2E7D5B;
    --red: #C1432F;
    --text: #17262C;
    --text-muted: #5C6E74;
    --border: #DCE3E2;
    --radius: 14px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html {
    scroll-padding-top: var(--safe-top);
}

body {
    margin: 0;
    font-family: 'Tajawal', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    direction: rtl;
    text-align: right;
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
    min-height: 100%;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    font-weight: 900;
    margin: 0 0 8px;
    line-height: 1.3;
}

p { line-height: 1.7; color: var(--text-muted); margin: 0 0 12px; }

a { color: inherit; text-decoration: none; }

/* ===== حاوية عامة بعرض هاتف ===== */
.app-shell {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg);
    position: relative;
    padding-bottom: 84px;
}

/* ===== الهيدر العلوي ===== */
.top-bar {
    background: var(--navy);
    color: #fff;
    padding: 18px 20px calc(18px + var(--safe-top));
    padding-top: calc(18px + var(--safe-top));
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.top-bar h1 { font-size: 19px; color: #fff; }
.top-bar .sub { color: #B9C6C9; font-size: 13px; margin-top: 2px; }

/* ===== محتوى الصفحة ===== */
.page-content { padding: 18px; }

/* ===== بطاقة "تذكرة" للاشتراك — بدل الكرت العادي ===== */
.ticket-card {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(18,42,52,0.08);
    border: 1px solid var(--border);
}
.ticket-card .ticket-top {
    padding: 18px 20px;
}
.ticket-card .ticket-route {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 4px;
}
.ticket-card .ticket-meta {
    font-size: 13px;
    color: var(--text-muted);
}
.ticket-divider {
    position: relative;
    border-top: 2px dashed var(--border);
    margin: 0 20px;
}
.ticket-card .ticket-bottom {
    padding: 14px 20px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ===== صف جدول مواعيد (لعرض الخطوط) ===== */
.route-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 4px;
    border-bottom: 1px solid var(--border);
}
.route-row:last-child { border-bottom: none; }
.route-row .time-block {
    background: var(--navy);
    color: #fff;
    border-radius: 10px;
    padding: 8px 10px;
    text-align: center;
    min-width: 62px;
    font-weight: 700;
    font-size: 13px;
}
.route-row .route-info { flex: 1; }
.route-row .route-info .name { font-weight: 700; font-size: 15px; }
.route-row .route-info .detail { font-size: 12.5px; color: var(--text-muted); }

/* ===== شارات الحالة ===== */
.badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
}
.badge-active { background: rgba(46,125,91,0.12); color: var(--green); }
.badge-pending { background: rgba(232,169,59,0.18); color: var(--amber-dark); }
.badge-rejected, .badge-stopped { background: rgba(193,67,47,0.12); color: var(--red); }
.badge-mixed { background: #E7ECEB; color: var(--text-muted); }
.badge-female { background: #FBE7EE; color: #B6366B; }
.badge-male { background: #E4EEFB; color: #2C5FA8; }

/* ===== أزرار ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: transform 0.1s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--amber); color: var(--navy); }
.btn-primary:hover { background: var(--amber-dark); }
.btn-outline { background: transparent; color: var(--navy); border: 1.5px solid var(--border); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-block { margin-top: 10px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== نماذج الإدخال ===== */
.field { margin-bottom: 16px; }
.field label {
    display: block;
    font-size: 13.5px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--navy);
}
.field input,
.field select {
    width: 100%;
    padding: 13px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 14.5px;
    background: var(--surface);
    color: var(--text);
}
.field input:focus,
.field select:focus {
    outline: none;
    border-color: var(--amber);
}
.field .hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.field .file-upload {
    border: 1.5px dashed var(--border);
    border-radius: 10px;
    padding: 14px;
    text-align: center;
    font-size: 13.5px;
    color: var(--text-muted);
    background: var(--surface);
}

/* ===== تبديل نوع الحساب (راكب/سائق) ===== */
.role-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}
.role-toggle label {
    flex: 1;
    text-align: center;
    padding: 14px 8px;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    background: var(--surface);
    color: var(--text-muted);
}
.role-toggle input { display: none; }
.role-toggle input:checked + span { color: var(--navy); }
.role-toggle label.active {
    border-color: var(--amber);
    background: rgba(232,169,59,0.1);
    color: var(--navy);
}

/* ===== رسائل تنبيه ===== */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13.5px;
    margin-bottom: 16px;
    font-weight: 500;
}
.alert-error { background: rgba(193,67,47,0.1); color: var(--red); }
.alert-success { background: rgba(46,125,91,0.1); color: var(--green); }

/* ===== شريط التنقل السفلي (Bottom Nav) ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    right: 50%;
    transform: translateX(50%);
    width: 100%;
    max-width: 480px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    padding-bottom: var(--safe-bottom);
    box-shadow: 0 -2px 10px rgba(18,42,52,0.06);
}
.bottom-nav a {
    flex: 1;
    text-align: center;
    padding: 10px 4px 8px;
    font-size: 11.5px;
    color: var(--text-muted);
    font-weight: 500;
}
.bottom-nav a .icon { font-size: 21px; display: block; margin-bottom: 3px; }
.bottom-nav a.active { color: var(--navy); font-weight: 700; }

/* ===== حالة فارغة ===== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}
.empty-state .icon { font-size: 38px; margin-bottom: 10px; display: block; }

/* ===== شاشات الدخول/التسجيل (بدون bottom nav) ===== */
.auth-shell {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg);
    padding: calc(28px + var(--safe-top)) 22px 40px;
}
.auth-shell .brand {
    text-align: center;
    margin-bottom: 28px;
}
.auth-shell .brand .logo {
    width: 58px;
    height: 58px;
    background: var(--navy);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    margin: 0 auto 12px;
}
.auth-shell .brand h1 { font-size: 20px; }
.auth-card {
    background: var(--surface);
    border-radius: 18px;
    padding: 22px;
    border: 1px solid var(--border);
}
.auth-footer {
    text-align: center;
    margin-top: 18px;
    font-size: 13.5px;
    color: var(--text-muted);
}
.auth-footer a { color: var(--navy); font-weight: 700; }
