/* ══════════════════════════════════════════
   GROUPMOTORS B2B Portal — Design System
   ══════════════════════════════════════════ */

:root {
  --red:      #C82832;
  --red-dk:   #9B1F28;
  --red-lt:   #FDECEA;
  --dark:     #2C3E50;
  --dark2:    #1A252F;
  --blue:     #2980B9;
  --green:    #27AE60;
  --green-lt: #E8F8EF;
  --orange:   #F39C12;
  --orange-lt:#FEF9E7;
  --gray1:    #F7F7F7;
  --gray2:    #E8E8E8;
  --gray3:    #CCCCCC;
  --gray4:    #999999;
  --white:    #FFFFFF;
  --shadow:   0 2px 12px rgba(0,0,0,0.10);
  --shadow-lg:0 4px 24px rgba(0,0,0,0.14);
  --radius:   8px;
  --radius-sm:4px;
}

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

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 14px;
  color: var(--dark);
  background: var(--gray1);
  min-height: 100vh;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── NAVBAR ── */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: var(--red);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; height: 52px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.navbar-brand {
  font-size: 17px; font-weight: 700;
  color: #fff; letter-spacing: 1px;
  display: flex; align-items: center; gap: 8px;
}
.navbar-brand span { color: #FFBBBB; font-weight: 400; font-size: 13px; }
.navbar-right {
  display: flex; align-items: center; gap: 16px;
  color: #FFBBBB; font-size: 13px;
}
.navbar-right .user-name { color: #fff; font-weight: 600; }
.btn-logout {
  background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.3);
  color: #fff; padding: 5px 12px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 13px; transition: background .2s;
}
.btn-logout:hover { background: rgba(255,255,255,0.25); }

/* ── TABS ── */
.tabs {
  display: flex; background: var(--white);
  border-bottom: 2px solid var(--gray2);
}
.tab {
  padding: 10px 20px; cursor: pointer; font-size: 13px;
  color: var(--gray4); border-bottom: 3px solid transparent;
  margin-bottom: -2px; transition: all .2s; white-space: nowrap;
  display: flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--dark); background: var(--gray1); }
.tab.active { color: var(--red); border-bottom-color: var(--red); font-weight: 600; }
.tab .badge {
  background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px;
  display: none; align-items: center; justify-content: center;
  padding: 0 4px;
}

/* ── MAIN LAYOUT ── */
.page-wrap { max-width: 1200px; margin: 0 auto; padding: 20px 16px; }
.page-title {
  font-size: 20px; font-weight: 700; color: var(--dark);
  margin-bottom: 16px;
}

/* ── CARDS ── */
.card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
  margin-bottom: 16px;
}
.card-header {
  font-size: 15px; font-weight: 700; color: var(--dark);
  margin-bottom: 14px; padding-bottom: 10px;
  border-bottom: 1px solid var(--gray2);
  display: flex; align-items: center; gap: 8px;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: none; transition: all .2s; white-space: nowrap;
}
.btn-primary   { background: var(--red);   color: #fff; }
.btn-primary:hover { background: var(--red-dk); }
.btn-success   { background: var(--green); color: #fff; }
.btn-success:hover { background: #1E8449; }
.btn-danger    { background: #E74C3C;      color: #fff; }
.btn-danger:hover  { background: #C0392B; }
.btn-secondary { background: var(--gray2); color: var(--dark); }
.btn-secondary:hover { background: var(--gray3); }
.btn-outline   { background: transparent; border: 1px solid var(--gray3); color: var(--dark); }
.btn-outline:hover { background: var(--gray1); }
.btn-lg { padding: 12px 24px; font-size: 14px; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── FORMS ── */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--dark); margin-bottom: 5px; }
.form-control {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--gray3); border-radius: var(--radius-sm);
  font-size: 13px; color: var(--dark);
  background: var(--white); transition: border-color .2s;
  outline: none;
}
.form-control:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(200,40,50,.1); }
.form-row { display: grid; gap: 12px; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ── TABLES ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--dark); }
thead th {
  color: #fff; padding: 10px 12px;
  font-size: 12px; font-weight: 600; text-align: left;
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--gray2); transition: background .15s; }
tbody tr:hover { background: var(--gray1); }
tbody td { padding: 10px 12px; font-size: 13px; vertical-align: middle; }
.price-cell { color: var(--red); font-weight: 700; }
.code-cell { font-family: monospace; font-size: 12px; color: var(--blue); }

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 12px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.badge-pending  { background: var(--orange-lt); color: var(--orange); }
.badge-approved { background: var(--green-lt);  color: var(--green);  }
.badge-rejected { background: var(--red-lt);    color: var(--red);    }
.badge-info     { background: #EBF5FB; color: var(--blue); }

/* ── ALERTS ── */
.alert {
  padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 13px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px;
}
.alert-error   { background: var(--red-lt);    color: var(--red);    border-left: 3px solid var(--red);    }
.alert-success { background: var(--green-lt);  color: var(--green);  border-left: 3px solid var(--green);  }
.alert-warning { background: var(--orange-lt); color: var(--orange); border-left: 3px solid var(--orange); }
.alert-info    { background: #EBF5FB;           color: var(--blue);   border-left: 3px solid var(--blue);   }

/* ── SPINNER ── */
.spinner {
  display: none; align-items: center; justify-content: center;
  gap: 10px; padding: 20px; color: var(--gray4); font-size: 13px;
}
.spinner.active { display: flex; }
.spin {
  width: 22px; height: 22px; border: 3px solid var(--gray2);
  border-top-color: var(--red); border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── RESULT CARD (search) ── */
.result-card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.result-header {
  background: var(--green); color: #fff;
  padding: 12px 18px; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; gap: 8px;
}
.result-header.not-found { background: #E74C3C; }
.result-body { padding: 18px; }
.result-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.result-item {
  background: var(--gray1); border-radius: var(--radius-sm);
  padding: 10px 14px;
}
.result-item-label {
  font-size: 10px; text-transform: uppercase;
  letter-spacing: .8px; color: var(--gray4); margin-bottom: 4px;
}
.result-item-value {
  font-size: 18px; font-weight: 700; color: var(--dark);
}
.result-item-value.big   { font-size: 24px; color: var(--red); }
.result-item-value.green { color: var(--green); }

/* ── STAT CARDS (dashboard) ── */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px; margin-bottom: 20px;
}
.stat-card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 14px; text-align: center;
}
.stat-card .stat-num {
  font-size: 40px; font-weight: 700; line-height: 1;
  margin-bottom: 6px;
}
.stat-card .stat-label { font-size: 12px; color: var(--gray4); }

/* ── ADMIN LAYOUT ── */
.admin-wrap { display: flex; min-height: calc(100vh - 52px); }
.sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--dark2); padding: 16px 0;
}
.sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 20px; color: #BDC3C7; font-size: 13px;
  cursor: pointer; transition: all .2s; text-decoration: none;
}
.sidebar-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-item.active { background: var(--red); color: #fff; font-weight: 600; }
.sidebar-divider { border-top: 1px solid rgba(255,255,255,.1); margin: 8px 0; }
.admin-content { flex: 1; padding: 20px 24px; overflow-x: auto; }

/* ── ORDER DETAIL ── */
.order-meta {
  display: flex; gap: 24px; flex-wrap: wrap;
  padding: 14px 0; margin-bottom: 14px;
  border-bottom: 1px solid var(--gray2);
}
.order-meta-item { font-size: 13px; }
.order-meta-item .label { color: var(--gray4); font-size: 11px; margin-bottom: 2px; }
.order-total-row {
  display: flex; justify-content: space-between; align-items: center;
  background: #FFF9C4; padding: 12px 16px;
  border-radius: var(--radius-sm); margin-top: 8px;
}
.order-total-label { font-weight: 700; font-size: 14px; }
.order-total-value { font-size: 22px; font-weight: 700; color: var(--red); }

/* ── COMMENT BOX ── */
.comment-box {
  background: var(--green-lt); border: 1px solid var(--green);
  border-radius: var(--radius-sm); padding: 14px; margin-top: 14px;
}
.comment-label { font-size: 12px; font-weight: 700; color: var(--green); margin-bottom: 6px; }

/* ── LOGIN PAGE ── */
.login-page {
  min-height: 100vh; background: var(--red);
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.login-bg-circle {
  position: absolute; border-radius: 50%;
  background: rgba(0,0,0,.12);
}
.login-box {
  background: var(--white); border-radius: 12px;
  padding: 40px 36px; width: 380px; max-width: 95vw;
  box-shadow: var(--shadow-lg); position: relative; z-index: 1;
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo-title {
  font-size: 26px; font-weight: 800; color: var(--red); letter-spacing: 2px;
}
.login-logo-sub { font-size: 12px; color: var(--gray4); margin-top: 2px; }
.login-title { font-size: 18px; font-weight: 700; color: var(--dark); margin-bottom: 20px; }

/* ── MISC ── */
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--blue); font-size: 13px; margin-bottom: 14px; cursor: pointer;
}
.back-link:hover { text-decoration: underline; }
.empty-state {
  text-align: center; padding: 48px 20px; color: var(--gray4);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }
.qty-input {
  width: 60px; text-align: center; padding: 5px 6px;
  border: 1px solid var(--gray3); border-radius: var(--radius-sm);
  font-size: 13px;
}
.action-icon {
  width: 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; border: none; font-size: 13px; transition: .2s;
}
.action-icon.delete { background: #E74C3C; color: #fff; }
.action-icon.view   { background: var(--blue); color: #fff; }
.action-icon:hover { opacity: .8; }

/* ── RESPONSIVE ── */
@media (max-width: 700px) {
  .form-row.cols-2, .form-row.cols-3 { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .admin-content { padding: 14px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .result-grid { grid-template-columns: repeat(2, 1fr); }
  thead th:nth-child(n+4) { display: none; }
  tbody td:nth-child(n+4) { display: none; }
}

/* ── NAV ICONS (new) ── */
.navbar { height: auto; min-height: 52px; padding: 6px 20px; }
.navbar-right { gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.nav-icon {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 12px; border-radius: 17px;
  color: #fff; cursor: pointer; font-size: 13px;
  transition: background .2s; text-decoration: none;
  flex-shrink: 0;
}
.nav-icon:hover { background: rgba(255,255,255,0.18); text-decoration: none; }
.nav-icon-emoji { font-size: 16px; line-height: 1; }
.nav-icon-label { font-size: 12px; font-weight: 600; white-space: nowrap; }
.nav-badge-wrap { overflow: visible; }
.nav-cnt {
  position: absolute; top: -3px; right: -3px;
  background: #FFC107; color: #000;
  font-size: 9px; font-weight: 800;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: none; align-items: center; justify-content: center;
  padding: 0 3px; border: 1.5px solid var(--red);
}

/* Hide labels on narrow screens — icons only */
@media (max-width: 950px) {
  .nav-icon-label { display: none; }
  .nav-icon { padding: 0; width: 34px; border-radius: 50%; }
}

/* Nav dropdown */
.nav-dropdown {
  display: none; position: absolute; top: calc(100% + 8px); right: 0;
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow-lg); min-width: 160px;
  z-index: 999; overflow: hidden;
}
.nav-dropdown.open { display: block; }
.nav-dd-item {
  padding: 10px 16px; font-size: 13px; color: var(--dark);
  cursor: pointer; transition: background .15s;
}
.nav-dd-item:hover, .nav-dd-item.active { background: var(--gray1); color: var(--red); font-weight: 600; }

/* Nav tooltip */
.nav-tooltip {
  display: none; position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--dark2); color: #fff;
  padding: 7px 12px; border-radius: var(--radius-sm);
  font-size: 13px; white-space: nowrap; z-index: 999;
}
#navPhone:hover .nav-tooltip { display: block; }

/* ── PASSWORD EYE ── */
.pw-wrap { position: relative; }
.pw-eye {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  cursor: pointer; color: var(--gray4); font-size: 16px; user-select: none;
}
.pw-eye:hover { color: var(--dark); }

/* ── PAYMENT METHOD ── */
.payment-opts { display: flex; gap: 10px; margin-top: 6px; }
.payment-opt {
  flex: 1; padding: 10px 14px; border: 2px solid var(--gray2);
  border-radius: var(--radius-sm); cursor: pointer;
  font-size: 13px; font-weight: 600; text-align: center;
  background: var(--white); transition: all .2s;
}
.payment-opt.selected { border-color: var(--red); background: var(--red-lt); color: var(--red); }

/* ── CONFIRM MODAL ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; display: none;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: #fff; border-radius: var(--radius);
  padding: 28px 32px; max-width: 360px; width: 90%;
  box-shadow: var(--shadow-lg); text-align: center;
}
.modal-box p { font-size: 15px; color: var(--dark); margin-bottom: 20px; }
.modal-btns { display: flex; gap: 10px; justify-content: center; }

/* ── CLOSE RESULT BUTTON ── */
.result-close-btn {
  position: absolute; top: 10px; right: 12px;
  background: rgba(255,255,255,.3); border: none;
  color: #fff; width: 24px; height: 24px; border-radius: 50%;
  cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center;
}
.result-close-btn:hover { background: rgba(255,255,255,.5); }
.result-header { position: relative; }

/* ── FAVORITES HEART ── */
.fav-btn {
  background: none; border: 1.5px solid var(--gray3); border-radius: 50%;
  width: 32px; height: 32px; cursor: pointer; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all .2s; color: var(--gray4);
}
.fav-btn.active { color: #e74c3c; border-color: #e74c3c; background: #FDECEA; }
.fav-btn:hover { transform: scale(1.1); }

/* ── NOTIFICATIONS ── */
.notif-item {
  padding: 14px 16px; border-bottom: 1px solid var(--gray2);
  display: flex; gap: 12px; align-items: flex-start;
}
.notif-item.unread { background: #EBF5FB; }
.notif-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--blue); flex-shrink: 0; margin-top: 5px;
}
.notif-item.unread .notif-dot { display: block; }
.notif-item:not(.unread) .notif-dot { background: var(--gray3); }
.notif-msg { font-size: 13px; color: var(--dark); font-weight: 600; white-space: pre-line; }
.notif-sub { font-size: 11px; color: var(--gray4); margin-top: 3px; }
.notif-time { font-size: 11px; color: var(--gray4); margin-top: 4px; }

/* ── INLINE EDIT TABLE ── */
.edit-qty-input {
  width: 55px; padding: 4px 6px; border: 1px solid var(--gray3);
  border-radius: var(--radius-sm); font-size: 13px; text-align: center;
}
.edit-del-btn {
  background: #E74C3C; color: #fff; border: none; border-radius: 50%;
  width: 24px; height: 24px; cursor: pointer; font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ── FEEDBACK ── */
.feedback-item {
  padding: 14px 16px; border-bottom: 1px solid var(--gray2);
}
.feedback-item.unread { background: var(--orange-lt); }
.feedback-subject { font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.feedback-body { font-size: 13px; color: var(--dark); }
.feedback-meta { font-size: 11px; color: var(--gray4); margin-top: 6px; }
