/* ============================================================
   صيانة بلس — Design System
   ============================================================ */

:root {
  --primary:       #f59e0b;
  --primary-dark:  #d97706;
  --primary-light: #fef3c7;
  --dark:          #0f172a;
  --dark2:         #1e293b;
  --success:       #10b981;
  --danger:        #ef4444;
  --warning:       #f59e0b;
  --info:          #3b82f6;

  --bg:            #f8fafc;
  --card:          #ffffff;
  --border:        #e2e8f0;
  --text:          #1e293b;
  --muted:         #64748b;
  --light:         #94a3b8;

  --radius:        12px;
  --radius-sm:     8px;
  --radius-lg:     20px;
  --shadow:        0 1px 3px rgba(0,0,0,.08);
  --shadow-md:     0 4px 12px rgba(0,0,0,.1);
  --shadow-lg:     0 10px 30px rgba(0,0,0,.12);
  --font:          'Tajawal', sans-serif;
  --nav-h:         60px;
  --bot-nav-h:     64px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }
body { font-family: var(--font); background: var(--bg); color: var(--text); direction: rtl; min-height: 100vh; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: var(--font); border: none; background: none; }
input, textarea, select { font-family: var(--font); direction: rtl; }
input:focus, textarea:focus, select:focus { outline: none; }

/* ---- Utility ---- */
.container  { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.container-sm { max-width: 560px; margin: 0 auto; padding: 0 16px; }
.flex       { display: flex; align-items: center; }
.flex-col   { display: flex; flex-direction: column; }
.flex-1     { flex: 1; }
.gap-2      { gap: 8px; }
.gap-3      { gap: 12px; }
.gap-4      { gap: 16px; }
.grid-2     { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3     { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.text-center { text-align: center; }
.text-muted  { color: var(--muted); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.fw-7 { font-weight: 700; }
.fw-8 { font-weight: 800; }
.fw-9 { font-weight: 900; }
.fs-13 { font-size: 13px; }
.fs-14 { font-size: 14px; }
.fs-15 { font-size: 15px; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ---- Card ---- */
.card {
  background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow); padding: 16px;
}
.card-hover { transition: transform .2s, box-shadow .2s; cursor: pointer; }
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 700; transition: all .2s; white-space: nowrap;
}
.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover  { background: var(--primary-dark); }
.btn-dark     { background: var(--dark); color: #fff; }
.btn-dark:hover { background: var(--dark2); }
.btn-outline  { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-ghost    { color: var(--muted); padding: 8px 14px; border-radius: var(--radius-sm); }
.btn-ghost:hover { background: var(--border); color: var(--text); }
.btn-success  { background: var(--success); color: #fff; }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-sm   { padding: 7px 14px; font-size: 13px; }
.btn-lg   { padding: 14px 28px; font-size: 17px; border-radius: var(--radius); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-loading { color: transparent !important; position: relative; pointer-events: none; }
.btn-loading::after {
  content: ''; position: absolute; width: 18px; height: 18px;
  border: 2.5px solid currentColor; border-top-color: transparent;
  border-radius: 50%; animation: spin .6s linear infinite; color: #fff;
}

/* ---- Forms ---- */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; color: var(--text); }
.form-label.req::after { content: ' *'; color: var(--danger); }
.form-control {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 15px; color: var(--text);
  background: #fff; transition: border-color .2s, box-shadow .2s;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(245,158,11,.15); }
.form-control.err { border-color: var(--danger); }
.form-error { color: var(--danger); font-size: 12px; margin-top: 4px; }
.form-hint  { color: var(--muted); font-size: 12px; margin-top: 4px; }
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='1.5' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 14px center; padding-left: 36px; }

/* ---- Avatar ---- */
.avatar {
  width: 40px; height: 40px; border-radius: 50%; object-fit: cover;
  background: var(--primary-light); color: var(--primary-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px; flex-shrink: 0; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg  { width: 56px; height: 56px; font-size: 20px; }
.avatar-xl  { width: 80px; height: 80px; font-size: 30px; }

/* ---- Badge ---- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 700;
}
.badge-primary { background: var(--primary-light); color: #92400e; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-gray    { background: #f1f5f9; color: #475569; }

/* ---- Stars ---- */
.stars { color: #f59e0b; }

/* ---- Navbar ---- */
.navbar {
  position: sticky; top: 0; z-index: 100; height: var(--nav-h);
  background: var(--dark); box-shadow: 0 2px 12px rgba(0,0,0,.3);
}
.navbar-inner {
  height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.nav-brand { display: flex; align-items: center; gap: 8px; color: var(--primary); font-size: 20px; font-weight: 900; }
.nav-brand .icon { font-size: 26px; }
.nav-links { display: flex; gap: 2px; }
.nav-link { padding: 8px 12px; border-radius: var(--radius-sm); color: #cbd5e1; font-size: 14px; font-weight: 600; transition: all .2s; }
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,.1); color: #fff; }
.nav-actions { display: flex; align-items: center; gap: 8px; }
.nav-icon-btn { width: 36px; height: 36px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; color: #94a3b8; font-size: 18px; transition: all .2s; position: relative; }
.nav-icon-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-badge { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; background: var(--danger); border-radius: 50%; }
.nav-user-btn { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: var(--radius-sm); background: rgba(255,255,255,.08); color: #fff; font-size: 14px; font-weight: 600; transition: background .2s; }
.nav-user-btn:hover { background: rgba(255,255,255,.15); }
.nav-user-btn .chevron { font-size: 10px; color: #94a3b8; }

/* Dropdown */
.dropdown { position: relative; }
.dropdown-menu {
  display: none; position: absolute; top: calc(100% + 8px); left: 0;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  border: 1px solid var(--border); min-width: 180px; z-index: 200; overflow: hidden;
}
.dropdown-menu.open { display: block; animation: fadeDown .15s ease; }
.dropdown-item {
  display: flex; align-items: center; gap: 8px; padding: 11px 16px;
  font-size: 14px; color: var(--text); transition: background .15s;
  width: 100%; text-align: right; border: none; background: none; cursor: pointer;
  font-family: var(--font);
}
.dropdown-item:hover { background: var(--bg); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ---- Bottom Nav ---- */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; height: var(--bot-nav-h);
  background: var(--card); border-top: 1px solid var(--border);
  display: flex; z-index: 90;
  padding-bottom: env(safe-area-inset-bottom);
}
.bot-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--light); font-size: 11px; font-weight: 600;
  transition: color .2s; position: relative;
}
.bot-item.active { color: var(--primary); }
.bot-item .bi { font-size: 22px; line-height: 1; }
.bot-item.cta .bi {
  background: var(--primary); color: #fff; border-radius: 50%;
  width: 46px; height: 46px; display: flex; align-items: center; justify-content: center;
  font-size: 22px; margin-top: -20px; box-shadow: 0 4px 12px rgba(245,158,11,.4);
}

/* ---- Page Layout ---- */
.page { padding-bottom: calc(var(--bot-nav-h) + 16px); min-height: calc(100vh - var(--nav-h)); }
.page-top { padding: 20px 0 8px; }
.page-title { font-size: 22px; font-weight: 900; }
.section-title { font-size: 16px; font-weight: 800; margin-bottom: 14px; }

/* Hero Banner */
.hero-banner {
  background: linear-gradient(135deg, var(--dark) 0%, #1e3a5f 100%);
  padding: 32px 0 28px; color: #fff;
}
.hero-title  { font-size: 26px; font-weight: 900; line-height: 1.3; }
.hero-title span { color: var(--primary); }
.hero-sub    { color: #94a3b8; font-size: 15px; margin-top: 6px; }

/* Search */
.search-box { display: flex; gap: 8px; margin-top: 20px; }
.search-input {
  flex: 1; padding: 12px 16px; border-radius: var(--radius);
  border: 2px solid rgba(255,255,255,.15); background: rgba(255,255,255,.08);
  color: #fff; font-size: 15px; font-family: var(--font); transition: border-color .2s;
}
.search-input::placeholder { color: #64748b; }
.search-input:focus { border-color: var(--primary); background: rgba(255,255,255,.12); }

/* Stats Bar */
.stats-bar { background: var(--primary); padding: 16px 0; }
.stats-row { display: flex; justify-content: space-around; text-align: center; gap: 8px; }
.stat-val  { display: block; font-size: 24px; font-weight: 900; color: var(--dark); }
.stat-lbl  { font-size: 12px; color: rgba(15,23,42,.65); }

/* Categories Grid */
.cats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.cat-card {
  background: var(--card); border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 16px 8px; text-align: center; transition: all .2s; cursor: pointer;
}
.cat-card:hover, .cat-card.sel { border-color: var(--primary); background: var(--primary-light); }
.cat-icon { font-size: 32px; line-height: 1; margin-bottom: 8px; }
.cat-name  { font-size: 13px; font-weight: 700; color: var(--text); }

/* Provider Card */
.provider-card { display: flex; gap: 12px; align-items: flex-start; }
.provider-info { flex: 1; min-width: 0; }
.provider-name { font-size: 15px; font-weight: 800; margin-bottom: 4px; }
.provider-meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--muted); }
.avail-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.avail-dot.on  { background: var(--success); }
.avail-dot.off { background: var(--light); }

/* Booking Card */
.booking-card { display: flex; align-items: center; gap: 12px; padding: 14px; }
.booking-card:not(:last-child) { border-bottom: 1px solid var(--border); }
.booking-cat-icon { font-size: 32px; flex-shrink: 0; }
.booking-info  { flex: 1; min-width: 0; }
.booking-title { font-size: 15px; font-weight: 700; margin-bottom: 3px; }
.booking-meta  { font-size: 12px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.booking-right { text-align: left; flex-shrink: 0; }
.booking-price { font-size: 16px; font-weight: 900; color: var(--primary); }

/* Status Tabs */
.status-tabs   { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 16px; }
.status-tabs::-webkit-scrollbar { display: none; }
.status-tab    { white-space: nowrap; padding: 7px 14px; border-radius: 20px; font-size: 13px; font-weight: 700; color: var(--muted); background: var(--card); border: 1.5px solid var(--border); transition: all .2s; cursor: pointer; }
.status-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Detail Page */
.detail-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.info-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.info-item  { font-size: 13px; }
.info-label { color: var(--muted); margin-bottom: 2px; }
.info-val   { font-weight: 700; }

/* Quote Card */
.quote-card { border: 1.5px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; transition: border-color .2s; }
.quote-card.accepted { border-color: var(--success); background: #f0fdf4; }
.quote-price { font-size: 22px; font-weight: 900; color: var(--primary); }

/* Wallet */
.wallet-hero {
  background: linear-gradient(135deg, var(--dark), #1e3a5f);
  border-radius: var(--radius-lg); padding: 28px 20px; color: #fff; text-align: center; margin-bottom: 20px;
}
.wallet-balance { font-size: 48px; font-weight: 900; }
.wallet-currency { font-size: 18px; opacity: .7; }

/* Transaction */
.trans-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.trans-item:not(:last-child) { border-bottom: 1px solid var(--border); }
.trans-icon { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 800; flex-shrink: 0; }
.trans-icon.cr { background: #d1fae5; color: #065f46; }
.trans-icon.db { background: #fee2e2; color: #991b1b; }
.trans-amount { font-size: 16px; font-weight: 800; }
.trans-amount.cr { color: var(--success); }
.trans-amount.db { color: var(--danger); }

/* Chat */
.chat-page { display: flex; flex-direction: column; height: 100vh; }
.chat-header { background: var(--dark); color: #fff; padding: 12px 16px; display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; background: var(--bg); }
.chat-bubble { max-width: 72%; padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.5; }
.chat-bubble.mine   { background: var(--primary); color: #fff; border-radius: 16px 4px 16px 16px; align-self: flex-start; }
.chat-bubble.theirs { background: var(--card); border: 1px solid var(--border); border-radius: 4px 16px 16px 16px; align-self: flex-end; }
.bubble-time { font-size: 10px; opacity: .65; margin-top: 4px; }
.chat-input-bar { display: flex; gap: 8px; padding: 12px 16px; background: var(--card); border-top: 1px solid var(--border); padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.chat-input { flex: 1; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 24px; font-size: 15px; font-family: var(--font); transition: border-color .2s; }
.chat-input:focus { border-color: var(--primary); }
.chat-send { background: var(--primary); color: #fff; border-radius: 50%; width: 42px; height: 42px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; transition: background .2s; }
.chat-send:hover { background: var(--primary-dark); }

/* Toast */
#toast-container { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 9000; display: flex; flex-direction: column; gap: 8px; pointer-events: none; width: 90%; max-width: 360px; }
.toast { padding: 12px 18px; border-radius: var(--radius); font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 10px; pointer-events: auto; box-shadow: var(--shadow-lg); animation: slideDown .3s ease; }
.toast-success { background: var(--success); color: #fff; }
.toast-error   { background: var(--danger);  color: #fff; }
.toast-info    { background: var(--dark);    color: #fff; }
.toast-warning { background: var(--warning); color: var(--dark); }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 500; display: flex; align-items: flex-end; justify-content: center; animation: fadeIn .2s ease; }
.modal-overlay.center { align-items: center; }
.modal { background: var(--card); width: 100%; max-width: 520px; border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding: 20px; max-height: 90vh; overflow-y: auto; animation: slideUp .25s ease; }
.modal.center { border-radius: var(--radius-lg); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-title { font-size: 17px; font-weight: 800; }
.modal-close { width: 32px; height: 32px; border-radius: 50%; background: var(--border); display: flex; align-items: center; justify-content: center; font-size: 16px; }

/* Steps (new booking) */
.steps-nav { display: flex; gap: 4px; margin-bottom: 20px; }
.step-dot { flex: 1; height: 4px; border-radius: 4px; background: var(--border); transition: background .3s; }
.step-dot.done, .step-dot.active { background: var(--primary); }
.step-panel { display: none; }
.step-panel.active { display: block; animation: fadeIn .2s ease; }

/* Urgency Picker */
.urgency-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.urgency-opt { border: 1.5px solid var(--border); border-radius: var(--radius); padding: 12px 8px; text-align: center; cursor: pointer; transition: all .2s; }
.urgency-opt.sel { border-color: var(--primary); background: var(--primary-light); }
.urgency-opt .uo-icon { font-size: 24px; margin-bottom: 4px; }
.urgency-opt .uo-name { font-size: 13px; font-weight: 700; }
.urgency-opt .uo-price { font-size: 11px; color: var(--muted); }

/* Payment Picker */
.pay-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.pay-opt { border: 1.5px solid var(--border); border-radius: var(--radius); padding: 12px 6px; text-align: center; cursor: pointer; transition: all .2s; }
.pay-opt.sel { border-color: var(--primary); background: var(--primary-light); }
.pay-opt .po-icon { font-size: 24px; margin-bottom: 4px; }
.pay-opt .po-name { font-size: 12px; font-weight: 700; }

/* Empty State */
.empty-state { text-align: center; padding: 48px 20px; }
.empty-icon { font-size: 56px; margin-bottom: 14px; }
.empty-title { font-size: 18px; font-weight: 800; margin-bottom: 6px; }
.empty-sub   { color: var(--muted); font-size: 14px; }

/* Skeleton */
.skeleton { background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%); background-size: 200%; animation: shimmer 1.5s infinite; border-radius: var(--radius-sm); }

/* Profile */
.profile-header { display: flex; gap: 16px; align-items: center; padding: 20px; background: linear-gradient(135deg, var(--dark), #1e3a5f); color: #fff; border-radius: var(--radius-lg); margin-bottom: 16px; }
.profile-tabs   { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 16px; }
.profile-tab    { padding: 10px 16px; font-size: 14px; font-weight: 700; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -2px; cursor: pointer; }
.profile-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Admin */
.admin-stat-card { text-align: center; padding: 20px; }
.admin-stat-val  { font-size: 32px; font-weight: 900; }
.admin-stat-lbl  { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* Animations */
@keyframes spin       { to{transform:rotate(360deg)} }
@keyframes fadeIn     { from{opacity:0} to{opacity:1} }
@keyframes fadeDown   { from{opacity:0;transform:translateY(-8px)} to{opacity:1;transform:none} }
@keyframes slideUp    { from{transform:translateY(40px);opacity:0} to{transform:none;opacity:1} }
@keyframes slideDown  { from{transform:translateY(-16px);opacity:0} to{transform:none;opacity:1} }
@keyframes shimmer    { 0%{background-position:200%} 100%{background-position:-200%} }
@keyframes spin       { to{transform:rotate(360deg)} }

/* Responsive */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .grid-3 { grid-template-columns: repeat(2,1fr); }
  .hide-mobile { display: none !important; }
}
@media (max-width: 480px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
  .urgency-grid, .pay-grid { grid-template-columns: repeat(3,1fr); }
}
