/* ═══════════════════════════════════════
   CLEAVO ADMIN — style.css
═══════════════════════════════════════ */

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

:root {
  --primary:       #1A3A8F;
  --primary-light: #2D5BE3;
  --primary-dark:  #102070;
  --accent:        #4C8EF7;
  --sidebar:       #0F2460;
  --sidebar-text:  #B0C4F8;
  --sidebar-sel:   #2D5BE3;
  --surface:       #F5F7FF;
  --card:          #ffffff;
  --divider:       #E8EEFF;
  --text:          #1a1a2e;
  --text-muted:    #6b7280;
  --green:         #22c55e;
  --orange:        #f97316;
  --red:           #ef4444;
  --blue:          #3b82f6;
  --purple:        #a855f7;
  --radius:        12px;
  --shadow:        0 1px 4px rgba(0,0,0,.08);
  --shadow-md:     0 4px 16px rgba(0,0,0,.12);
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--surface); color: var(--text); font-size: 14px; line-height: 1.5; }
a { cursor: pointer; text-decoration: none; }
input, textarea, select { font-family: inherit; font-size: 14px; }
button { font-family: inherit; cursor: pointer; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--divider); border-radius: 3px; }

/* ═══════════════ LOGIN ═══════════════ */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-light) 100%);
}
.login-card {
  background: var(--card);
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-md);
  text-align: center;
}
.login-logo {
  width: 60px; height: 60px;
  background: var(--primary);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.login-card h1 { font-size: 24px; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.login-sub { color: var(--text-muted); margin-bottom: 28px; }
.error-banner { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; border-radius: 8px; padding: 12px; margin-bottom: 16px; font-size: 13px; text-align: left; }
.form-group { text-align: left; margin-bottom: 16px; }
.form-group label { display: block; font-weight: 500; margin-bottom: 6px; color: var(--text); font-size: 13px; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--divider);
  border-radius: 8px; background: var(--surface); color: var(--text); outline: none;
  transition: border-color .2s;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: var(--primary-light); }
.form-group textarea { resize: vertical; }
.input-icon-wrap { position: relative; }
.input-icon-wrap input { padding-right: 40px; }
.toggle-pw { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); cursor: pointer; font-size: 16px; opacity: .5; }
.btn-full { width: 100%; }
.btn-primary {
  background: var(--primary); color: #fff; border: none;
  padding: 10px 20px; border-radius: 8px; font-weight: 600; font-size: 14px;
  transition: background .2s, transform .1s;
}
.btn-primary:hover { background: var(--primary-light); }
.btn-primary:active { transform: scale(.98); }
.btn-ghost { background: transparent; border: 1.5px solid var(--divider); color: var(--text); padding: 10px 20px; border-radius: 8px; font-weight: 500; transition: background .2s; }
.btn-ghost:hover { background: var(--surface); }
.btn-danger { background: var(--red); color: #fff; border: none; padding: 8px 16px; border-radius: 8px; font-weight: 500; font-size: 13px; }
.btn-success { background: var(--green); color: #fff; border: none; padding: 8px 16px; border-radius: 8px; font-weight: 500; font-size: 13px; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 6px; }
.btn-icon { background: transparent; border: none; padding: 4px 8px; border-radius: 6px; font-size: 16px; transition: background .2s; }
.btn-icon:hover { background: var(--surface); }

/* ═══════════════ APP SHELL ═══════════════ */
#app-shell { display: flex; height: 100vh; overflow: hidden; }

/* ── SIDEBAR ── */
#sidebar {
  width: 240px; min-width: 240px;
  background: var(--sidebar);
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 24px 20px 20px; }
.brand-icon { width: 36px; height: 36px; background: var(--primary-light); border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.brand-name { color: #fff; font-weight: 700; font-size: 15px; letter-spacing: 1px; }
.brand-sub { color: var(--sidebar-text); font-size: 10px; }
.sidebar-nav { flex: 1; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px; color: var(--sidebar-text);
  font-size: 13px; font-weight: 500; transition: background .15s, color .15s;
  position: relative;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: var(--sidebar-sel); color: #fff; }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }
.nav-badge {
  margin-left: auto; background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 10px;
}
.sidebar-footer { padding: 16px; border-top: 1px solid rgba(255,255,255,.1); }
.admin-info { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.admin-avatar { width: 32px; height: 32px; background: var(--primary-light); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.admin-email { color: var(--sidebar-text); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-signout { width: 100%; background: rgba(255,255,255,.08); border: none; color: var(--sidebar-text); padding: 8px; border-radius: 8px; font-size: 12px; transition: background .2s; }
.btn-signout:hover { background: rgba(255,255,255,.15); color: #fff; }

/* ── MAIN CONTENT ── */
#main-content { flex: 1; overflow-y: auto; background: var(--surface); }
.section { padding: 28px 28px 40px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.section-header h2 { font-size: 22px; font-weight: 700; color: var(--primary); }
.section-sub { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.section-title { font-size: 16px; font-weight: 600; color: var(--primary); margin: 24px 0 12px; }

/* ── CARDS ── */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.card.no-pad { padding: 0; overflow: hidden; }
.card-title { font-size: 15px; font-weight: 600; color: var(--primary); margin-bottom: 16px; }

/* ── STATS GRID ── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); border-left: 4px solid transparent; }
.stat-card.blue { border-left-color: var(--blue); }
.stat-card.green { border-left-color: var(--green); }
.stat-card.orange { border-left-color: var(--orange); }
.stat-card.red { border-left-color: var(--red); }
.stat-card.purple { border-left-color: var(--purple); }
.stat-val { font-size: 28px; font-weight: 700; margin-bottom: 4px; }
.stat-card.blue .stat-val { color: var(--blue); }
.stat-card.green .stat-val { color: var(--green); }
.stat-card.orange .stat-val { color: var(--orange); }
.stat-card.red .stat-val { color: var(--red); }
.stat-card.purple .stat-val { color: var(--purple); }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }

/* ── TABLES ── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; padding: 12px 16px; border-bottom: 1px solid var(--divider); text-align: left; background: var(--surface); }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--divider); font-size: 13px; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface); cursor: pointer; }
.data-table .mono { font-family: monospace; font-size: 12px; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }

/* ── BADGES ── */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-requested   { background:#f3f4f6; color:#6b7280; }
.badge-assigned    { background:#dbeafe; color:#1d4ed8; }
.badge-onway       { background:#e0f2fe; color:#0369a1; }
.badge-pickedup    { background:#cffafe; color:#0e7490; }
.badge-athub       { background:#ccfbf1; color:#0f766e; }
.badge-washing     { background:#dcfce7; color:#15803d; }
.badge-drying      { background:#f0fdf4; color:#16a34a; }
.badge-ironing     { background:#fefce8; color:#a16207; }
.badge-readyfordel { background:#fff7ed; color:#c2410c; }
.badge-outfordel   { background:#fef3c7; color:#b45309; }
.badge-delivered   { background:#dcfce7; color:#15803d; }
.badge-cancelled   { background:#fee2e2; color:#b91c1c; }
.badge-open        { background:#fee2e2; color:#b91c1c; }
.badge-inprogress  { background:#fef3c7; color:#b45309; }
.badge-closed      { background:#dcfce7; color:#15803d; }
.badge-success     { background:#dcfce7; color:#15803d; }
.badge-failed      { background:#fee2e2; color:#b91c1c; }
.badge-pending     { background:#fef3c7; color:#b45309; }
.badge-refunded    { background:#dbeafe; color:#1d4ed8; }

/* ── FILTERS ── */
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip { padding: 6px 14px; border-radius: 20px; border: 1.5px solid var(--divider); background: var(--card); color: var(--text-muted); font-size: 12px; font-weight: 500; transition: all .15s; }
.chip:hover { border-color: var(--primary-light); color: var(--primary-light); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.search-input { padding: 9px 14px; border: 1.5px solid var(--divider); border-radius: 8px; background: var(--card); font-size: 13px; color: var(--text); outline: none; min-width: 240px; transition: border-color .2s; }
.search-input:focus { border-color: var(--primary-light); }

/* ── SPLIT PANE ── */
.split-pane { display: flex; gap: 16px; }
.split-list { flex: 1; min-width: 0; }
.split-detail { width: 400px; flex-shrink: 0; }
.detail-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; max-height: calc(100vh - 200px); overflow-y: auto; }
.detail-card h3 { font-size: 16px; font-weight: 700; color: var(--primary); margin-bottom: 16px; }
.detail-row { display: flex; gap: 8px; margin-bottom: 10px; font-size: 13px; }
.detail-row .dr-label { color: var(--text-muted); width: 120px; flex-shrink: 0; }
.detail-row .dr-val { font-weight: 500; }
.detail-divider { border: none; border-top: 1px solid var(--divider); margin: 16px 0; }

/* ── STATUS CHIPS ── */
.status-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.status-chip { padding: 5px 12px; border-radius: 6px; border: 1.5px solid var(--divider); background: var(--card); font-size: 11px; font-weight: 500; color: var(--text-muted); transition: all .15s; }
.status-chip:hover { border-color: var(--primary-light); color: var(--primary-light); background: #EFF6FF; }
.status-chip.current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── PLANS GRID ── */
.plans-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.plan-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.plan-name { font-size: 17px; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.plan-price { font-size: 26px; font-weight: 700; color: var(--primary-light); }
.plan-washes { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.plan-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }
.plan-features { list-style: none; margin-bottom: 14px; }
.plan-features li { font-size: 12px; padding: 2px 0; }
.plan-features li::before { content: '✓ '; color: var(--green); font-weight: 700; }
.plan-actions { display: flex; gap: 8px; align-items: center; }
.plan-toggle-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }

/* ── TOGGLE SWITCH ── */
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: #cbd5e1; border-radius: 24px; transition: .3s; }
.slider::before { position: absolute; content: ''; height: 18px; width: 18px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: .3s; }
input:checked + .slider { background: var(--primary-light); }
input:checked + .slider::before { transform: translateX(20px); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--divider); }
.toggle-row:last-of-type { border-bottom: none; }
.toggle-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── TWO-COL ── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ── RADIO GROUP ── */
.radio-group { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.radio-group label { display: flex; align-items: center; gap: 8px; font-weight: normal; cursor: pointer; }

/* ── TABS ── */
.tab-bar { display: flex; gap: 4px; margin-bottom: 16px; background: var(--card); padding: 4px; border-radius: 10px; display: inline-flex; box-shadow: var(--shadow); }
.tab-btn { padding: 8px 20px; border: none; border-radius: 8px; font-size: 13px; font-weight: 500; background: transparent; color: var(--text-muted); transition: all .15s; }
.tab-btn.active { background: var(--primary); color: #fff; }

/* ── SUPPORT / TICKETS ── */
.ticket-list { display: flex; flex-direction: column; gap: 8px; }
.ticket-item { background: var(--card); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); cursor: pointer; border-left: 4px solid transparent; transition: border-color .15s, box-shadow .15s; }
.ticket-item:hover { box-shadow: var(--shadow-md); }
.ticket-item.selected { border-left-color: var(--primary-light); }
.ticket-item.open-ticket { border-left-color: var(--red); }
.ticket-item.inprogress-ticket { border-left-color: var(--orange); }
.ticket-item.closed-ticket { border-left-color: var(--green); }
.ticket-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.ticket-user { font-weight: 600; font-size: 13px; }
.ticket-phone { color: var(--text-muted); font-size: 12px; }
.ticket-subject { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.ticket-preview { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticket-meta { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ── CHAT PANEL ── */
.chat-panel { display: flex; flex-direction: column; }
.chat-panel .detail-card { display: flex; flex-direction: column; height: calc(100vh - 200px); }
#chat-content { display: flex; flex-direction: column; height: 100%; }
.chat-header { padding-bottom: 12px; border-bottom: 1px solid var(--divider); margin-bottom: 12px; }
.chat-header h4 { font-size: 15px; font-weight: 700; color: var(--primary); }
.chat-header .chat-meta { font-size: 12px; color: var(--text-muted); }
.chat-messages { flex: 1; overflow-y: auto; padding: 4px 0; display: flex; flex-direction: column; gap: 10px; }
.msg-bubble { max-width: 85%; }
.msg-bubble.admin { align-self: flex-end; }
.msg-bubble.user { align-self: flex-start; }
.msg-sender { font-size: 10px; color: var(--text-muted); font-weight: 500; margin-bottom: 2px; }
.msg-bubble.admin .msg-sender { text-align: right; }
.msg-text { padding: 10px 14px; border-radius: 12px; font-size: 13px; line-height: 1.5; }
.msg-bubble.admin .msg-text { background: var(--primary); color: #fff; border-radius: 12px 12px 2px 12px; }
.msg-bubble.user .msg-text { background: var(--surface); color: var(--text); border-radius: 12px 12px 12px 2px; border: 1px solid var(--divider); }
.msg-time { font-size: 10px; color: var(--text-muted); margin-top: 3px; }
.msg-bubble.admin .msg-time { text-align: right; }
.chat-input-area { display: flex; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--divider); }
.chat-input-area textarea { flex: 1; resize: none; border: 1.5px solid var(--divider); border-radius: 8px; padding: 8px 12px; font-size: 13px; outline: none; }
.chat-input-area textarea:focus { border-color: var(--primary-light); }
.chat-actions { display: flex; gap: 8px; margin-top: 8px; }

/* ── BUSINESS HOURS ── */
.hours-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--divider); }
.hours-row:last-child { border-bottom: none; }
.hours-day { width: 100px; font-weight: 500; }
.hours-time { display: flex; align-items: center; gap: 8px; }
.time-input { padding: 5px 10px; border: 1.5px solid var(--divider); border-radius: 6px; font-size: 13px; outline: none; width: 80px; }
.time-input:focus { border-color: var(--primary-light); }
.hours-closed { font-size: 12px; color: var(--text-muted); }

/* ── MODAL ── */
#modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 1000; animation: fadeIn .15s; }
.modal-box { background: var(--card); border-radius: 16px; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); animation: slideUp .2s; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 0; }
.modal-header h3 { font-size: 17px; font-weight: 700; color: var(--primary); }
.modal-close { background: none; border: none; font-size: 18px; color: var(--text-muted); padding: 4px; border-radius: 4px; line-height: 1; }
.modal-close:hover { color: var(--text); }
#modal-body { padding: 16px 24px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 0 24px 20px; }
.features-list { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.feature-item { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.feature-item span { font-size: 13px; flex: 1; }
.feature-remove { background: none; border: none; color: var(--red); font-size: 16px; cursor: pointer; }
.feature-add-row { display: flex; gap: 8px; }
.feature-add-row input { flex: 1; }

/* ── NOTIFICATION LOG ── */
.notif-log-item { padding: 12px 0; border-bottom: 1px solid var(--divider); }
.notif-log-item:last-child { border-bottom: none; }
.notif-log-title { font-weight: 600; font-size: 13px; }
.notif-log-body { color: var(--text-muted); font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-log-meta { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ── RIDER ROWS ── */
.rider-avatar { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: #fff; }
.rider-avatar.active { background: var(--green); }
.rider-avatar.inactive { background: #cbd5e1; }

/* ── TOAST ── */
#toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 9999; }
.toast { background: #1e293b; color: #fff; padding: 12px 18px; border-radius: 10px; font-size: 13px; box-shadow: var(--shadow-md); animation: slideUp .2s; display: flex; align-items: center; gap: 8px; min-width: 200px; max-width: 320px; }
.toast.success { border-left: 4px solid var(--green); }
.toast.error   { border-left: 4px solid var(--red); }
.toast.info    { border-left: 4px solid var(--blue); }

/* ── ANIMATIONS ── */
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ── RESPONSIVE ── */
@media (max-width: 1100px) {
  .split-detail { width: 340px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  #sidebar { display: none; }
  .split-pane { flex-direction: column; }
  .split-detail { width: 100%; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .section { padding: 16px 14px; }
}
