/* ========================================
   Q-Tech Solutions — store system
   Auth, account and shared components.
   Extends styles.css; reuses its variables so the whole site stays one design.
   ======================================== */

:root {
  --ok: #1e9e5a;
  --ok-bg: #e8f7ef;
  --warn: #d98e04;
  --warn-bg: #fdf3e0;
  --danger: #d64545;
  --danger-bg: #fdecec;
  --info: #2f6fed;
  --info-bg: #eaf1fe;
  --purple: #7b4fd4;
  --purple-bg: #f1ebfd;
}

/* === NAVBAR: user area === */
.nav-login-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-lg);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
  border: 2px solid var(--border);
}

.nav-login-link:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
}

.user-menu {
  position: relative;
}

.user-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  border-radius: var(--radius-lg);
  background: var(--bg-cream);
  border: 2px solid transparent;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-primary);
  transition: var(--transition);
}

.user-trigger:hover {
  border-color: var(--primary);
}

.user-trigger i {
  font-size: 0.7rem;
  color: var(--text-muted);
  transition: var(--transition);
}

.user-menu .user-dropdown.open ~ .user-trigger i,
.user-trigger[aria-expanded="true"] i {
  transform: rotate(180deg);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.95rem;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  min-width: 230px;
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: var(--transition);
  z-index: 1100;
}

.user-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-dropdown-head {
  padding: 10px 12px 12px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 6px;
  display: flex;
  flex-direction: column;
}

.user-dropdown-head strong {
  font-size: 0.95rem;
}

.user-dropdown-head span {
  font-size: 0.8rem;
  color: var(--text-muted);
  direction: ltr;
  text-align: right;
}

.user-dropdown a,
.user-dropdown .logout-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  background: none;
  text-align: right;
  transition: var(--transition);
}

.user-dropdown a i,
.user-dropdown .logout-btn i {
  width: 18px;
  color: var(--text-muted);
}

.user-dropdown a:hover,
.user-dropdown .logout-btn:hover {
  background: var(--bg-cream);
  color: var(--primary-dark);
}

.user-dropdown a:hover i,
.user-dropdown .logout-btn:hover i {
  color: var(--primary-dark);
}

.user-dropdown a.is-staff {
  color: var(--info);
}

.user-dropdown a.is-staff i {
  color: var(--info);
}

.user-dropdown .logout-btn {
  color: var(--danger);
  border-top: 1px solid var(--border-light);
  margin-top: 6px;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.user-dropdown .logout-btn i {
  color: var(--danger);
}

.user-dropdown .logout-btn:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

@media (max-width: 768px) {
  .user-trigger .user-name {
    display: none;
  }
  .nav-login-link span {
    display: none;
  }
}

/* === FORM EXTRAS === */
.field-error {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--danger);
}

.field-help {
  display: block;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.form-group.has-error input,
.form-group.has-error select,
.form-group.has-error textarea {
  border-color: var(--danger);
  background: var(--danger-bg);
}

.form-group label .optional {
  font-weight: 500;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.form-section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 24px 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px dashed var(--border);
  font-weight: 800;
  font-size: 0.88rem;
  color: var(--primary-dark);
}

.form-section-label:first-of-type {
  margin-top: 0;
}

.form-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 20px 0;
}

.form-check input[type="checkbox"] {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 2px;
  accent-color: var(--primary);
  cursor: pointer;
}

.form-check label {
  font-size: 0.88rem;
  color: var(--text-secondary);
  cursor: pointer;
  margin: 0;
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-size: 0.9rem;
  font-weight: 600;
}

.alert-error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(214, 69, 69, 0.25);
}

.alert i {
  margin-top: 2px;
}

/* === AUTH PAGES === */
.auth-shell {
  padding: calc(var(--navbar-height) + 50px) 0 80px;
  background: var(--bg-hero);
  min-height: 100vh;
}

.auth-layout {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 40px;
  align-items: stretch;
}

.auth-aside {
  background: linear-gradient(150deg, var(--bg-dark) 0%, var(--bg-darker) 100%);
  border-radius: var(--radius-xl);
  color: #fff;
  padding: 48px 40px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
}

.auth-aside::before {
  content: "";
  position: absolute;
  top: -120px;
  left: -80px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--primary-glow), transparent 70%);
}

.auth-aside-inner {
  position: relative;
  z-index: 1;
}

.auth-logo {
  height: 46px;
  width: auto;
  margin-bottom: 32px;
}

.auth-aside h2 {
  font-size: 1.75rem;
  font-weight: 900;
  margin-bottom: 12px;
}

.auth-aside > .auth-aside-inner > p {
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 30px;
  line-height: 1.8;
}

.auth-perks {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-perks li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.9);
}

.auth-perks i {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: rgba(212, 160, 23, 0.18);
  color: var(--primary-light);
  display: grid;
  place-items: center;
  font-size: 0.9rem;
}

.auth-perks code {
  background: var(--primary);
  color: var(--bg-dark);
  padding: 1px 8px;
  border-radius: 6px;
  font-weight: 800;
  font-family: var(--font);
  direction: ltr;
  display: inline-block;
}

.auth-burger {
  position: absolute;
  bottom: -70px;
  left: -60px;
  width: 240px;
  opacity: 0.28;
  pointer-events: none;
  transform: rotate(-12deg);
}

.auth-card {
  background: #fff;
  border-radius: var(--radius-xl);
  padding: 44px 40px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
}

.auth-card-head {
  margin-bottom: 28px;
  text-align: center;
}

.auth-card-head h1 {
  font-size: 1.7rem;
  font-weight: 900;
  margin-bottom: 6px;
}

.auth-card-head p {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.auth-switch {
  margin-top: 24px;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.auth-switch a {
  color: var(--primary-dark);
  font-weight: 800;
}

.auth-switch a:hover {
  text-decoration: underline;
}

@media (max-width: 900px) {
  .auth-layout {
    grid-template-columns: 1fr;
  }
  .auth-aside {
    display: none;
  }
  .auth-card {
    padding: 32px 24px;
  }
  .auth-shell {
    padding-top: calc(var(--navbar-height) + 24px);
  }
}

/* === CHECKOUT EXTRAS === */
.promo-inline {
  display: flex;
  gap: 8px;
}

.promo-inline input {
  flex: 1;
  text-transform: uppercase;
}

.promo-inline .btn {
  flex-shrink: 0;
  padding: 12px 18px;
}

.order-summary-item.discount {
  color: var(--ok);
  font-weight: 700;
}

.checkout-hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-cream);
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.checkout-hint i {
  color: var(--primary-dark);
  margin-top: 3px;
}

/* === ACCOUNT === */
/* The navbar is fixed, and index.html's sections clear it via `.page`. Pages
   that aren't tabs of the storefront need the same gutter or their title ends
   up underneath it. */
.inner-page {
  padding-top: var(--navbar-height);
  min-height: 100vh;
}

.account-container {
  padding-top: 32px;
  padding-bottom: 80px;
}

.account-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 28px;
  background: #fff;
  padding: 8px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  overflow-x: auto;
}

.account-nav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.account-nav a:hover {
  background: var(--bg-cream);
  color: var(--primary-dark);
}

.account-nav a.active {
  background: var(--primary);
  color: var(--text-on-primary);
}

.account-nav .account-nav-cta {
  margin-inline-start: auto;
  color: var(--primary-dark);
}

.account-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.account-stat {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fff;
  padding: 20px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  transition: var(--transition);
}

.account-stat:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary-light);
}

.account-stat .stat-icon {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  background: var(--info-bg);
  color: var(--info);
}

.stat-icon.amber {
  background: var(--warn-bg);
  color: var(--warn);
}
.stat-icon.green {
  background: var(--ok-bg);
  color: var(--ok);
}
.stat-icon.gold {
  background: var(--bg-cream);
  color: var(--primary-dark);
}

.account-stat strong {
  display: block;
  font-size: 1.3rem;
  font-weight: 900;
  line-height: 1.3;
}

.account-stat span {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* === ORDER CARDS === */
.orders-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.order-card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  border-inline-start: 5px solid var(--border);
  transition: var(--transition);
}

.order-card:hover {
  box-shadow: var(--shadow-md);
}

.order-card.status-pending {
  border-inline-start-color: var(--warn);
}
.order-card.status-approved {
  border-inline-start-color: var(--info);
}
.order-card.status-preparing {
  border-inline-start-color: var(--accent);
}
.order-card.status-delivering {
  border-inline-start-color: var(--purple);
}
.order-card.status-completed {
  border-inline-start-color: var(--ok);
}
.order-card.status-rejected,
.order-card.status-cancelled {
  border-inline-start-color: var(--danger);
}

.order-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-light);
}

.order-id {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.order-code {
  font-weight: 900;
  font-size: 1.05rem;
  color: var(--text-primary);
  direction: ltr;
}

.order-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 16px;
  border-radius: var(--radius-lg);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill i {
  font-size: 0.5rem;
}

.status-pill.status-pending {
  background: var(--warn-bg);
  color: var(--warn);
}
.status-pill.status-approved {
  background: var(--info-bg);
  color: var(--info);
}
.status-pill.status-preparing {
  background: #fdeee2;
  color: var(--accent-dark);
}
.status-pill.status-delivering {
  background: var(--purple-bg);
  color: var(--purple);
}
.status-pill.status-completed {
  background: var(--ok-bg);
  color: var(--ok);
}
.status-pill.status-rejected,
.status-pill.status-cancelled {
  background: var(--danger-bg);
  color: var(--danger);
}
.status-pill.status-confirmed {
  background: var(--ok-bg);
  color: var(--ok);
}
.status-pill.status-done {
  background: var(--info-bg);
  color: var(--info);
}

/* Progress track */
.order-track {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 24px 24px 18px;
  position: relative;
}

.track-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
}

/* Connector: anchored at this step's dot and stretching to the next one, which
   in RTL sits to the left. */
.track-step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 15px;
  right: 50%;
  width: 100%;
  height: 3px;
  background: var(--border);
  z-index: 0;
}

.track-step.done:not(:last-child)::after {
  background: var(--primary);
}

.track-step .dot {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: grid;
  place-items: center;
  background: #fff;
  border: 3px solid var(--border);
  color: var(--text-muted);
  font-size: 0.72rem;
  position: relative;
  z-index: 1;
}

.track-step.done .dot {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--text-on-primary);
}

.track-step small {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
}

.track-step.done small {
  color: var(--text-primary);
}

.order-items {
  padding: 8px 24px;
}

.order-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--border-light);
}

.order-item:last-child {
  border-bottom: none;
}

.order-item img {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-cream);
  flex-shrink: 0;
}

.order-item-info {
  flex: 1;
  min-width: 0;
}

.order-item-info strong {
  display: block;
  font-size: 0.92rem;
}

.order-item-info span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.order-item-total {
  font-weight: 800;
  color: var(--primary-dark);
  white-space: nowrap;
}

.order-note {
  display: flex;
  gap: 10px;
  margin: 12px 24px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--info-bg);
  color: #24457f;
  font-size: 0.86rem;
  line-height: 1.6;
}

.order-note i {
  margin-top: 3px;
}

.order-card-foot {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  padding: 20px 24px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-light);
}

.order-totals > div {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  padding: 5px 0;
  color: var(--text-secondary);
}

.order-totals .discount {
  color: var(--ok);
  font-weight: 700;
}

.order-totals .grand {
  border-top: 2px dashed var(--border);
  margin-top: 6px;
  padding-top: 10px;
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--text-primary);
}

.order-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.order-meta p {
  display: flex;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.order-meta i {
  color: var(--primary-dark);
  margin-top: 4px;
}

.order-meta form {
  margin-top: auto;
}

.btn-danger-outline {
  border-color: var(--danger) !important;
  color: var(--danger) !important;
}

.btn-danger-outline:hover {
  background: var(--danger) !important;
  color: #fff !important;
}

@media (max-width: 700px) {
  .order-card-foot {
    grid-template-columns: 1fr;
  }
  .order-track {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px 0;
  }
  .track-step:not(:last-child)::after {
    display: none;
  }
}

/* === PROFILE === */
.profile-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  align-items: start;
}

.profile-card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  padding: 32px 24px;
  text-align: center;
  position: sticky;
  top: calc(var(--navbar-height) + 20px);
}

.profile-avatar {
  width: 84px;
  height: 84px;
  margin: 0 auto 16px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 2.1rem;
  font-weight: 900;
  box-shadow: var(--shadow-glow);
}

.profile-card h3 {
  font-size: 1.15rem;
  font-weight: 800;
}

.profile-since {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.profile-meta {
  margin: 22px 0;
  padding: 18px 0;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: right;
}

.profile-meta li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.87rem;
  color: var(--text-secondary);
  word-break: break-all;
}

.profile-meta i {
  width: 18px;
  color: var(--primary-dark);
  flex-shrink: 0;
}

.profile-locked {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.7;
  text-align: right;
}

.profile-locked i {
  color: var(--primary-dark);
}

.profile-forms {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.panel {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  padding: 28px;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
  font-weight: 800;
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-light);
}

.panel-title i {
  color: var(--primary-dark);
}

@media (max-width: 900px) {
  .profile-layout {
    grid-template-columns: 1fr;
  }
  .profile-card {
    position: static;
  }
}

/* === EMPTY STATES === */
.empty-panel {
  background: #fff;
  border: 2px dashed var(--border);
  border-radius: var(--radius-xl);
  padding: 64px 24px;
  text-align: center;
}

.empty-panel i {
  font-size: 3rem;
  color: var(--primary-light);
  margin-bottom: 20px;
}

.empty-panel h3 {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.empty-panel p {
  color: var(--text-muted);
  margin-bottom: 24px;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 1rem;
}

.empty-state i {
  display: block;
  font-size: 2.4rem;
  color: var(--primary-light);
  margin-bottom: 14px;
}

/* === OFFER CARD: contents line (was an inline style) === */
.offer-card-contents {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* === TOAST: warning variant === */
.toast.warning {
  border-inline-start-color: var(--warn);
}

.toast.warning i {
  color: var(--warn);
}
