/* ── 禾鏵實業有限公司 Brand Variables ────────────────────── */
:root {
  --hh-primary: #1A4731;
  --hh-dark:    #0F2D1E;
  --hh-mid:     #2E7D32;
  --hh-gold:    #C8930A;
  --hh-light:   #E8F5E9;
  --hh-lighter: #F1F8F2;
}

/* ── Bootstrap Primary Override ─────────────────────────── */
.btn-primary {
  background-color: var(--hh-primary);
  border-color: var(--hh-primary);
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
  background-color: var(--hh-dark) !important;
  border-color: var(--hh-dark) !important;
}
.btn-outline-primary {
  color: var(--hh-primary);
  border-color: var(--hh-primary);
}
.btn-outline-primary:hover {
  background-color: var(--hh-primary);
  border-color: var(--hh-primary);
}
.text-primary { color: var(--hh-primary) !important; }
.bg-primary   { background-color: var(--hh-primary) !important; }

/* ── Global ─────────────────────────────────────────────── */
body { font-family: 'Segoe UI', 'Microsoft JhengHei', sans-serif; }

/* ── Frontend form ──────────────────────────────────────── */
.form-card { border-radius: 12px; overflow: hidden; }

.section-header {
  font-size: 1rem;
  font-weight: 700;
  color: var(--hh-primary);
  background: var(--hh-light);
  border-left: 4px solid var(--hh-gold);
  padding: 8px 14px;
  border-radius: 6px;
  margin-bottom: 16px;
}

.section-divider {
  border-color: #e9ecef;
  margin: 28px 0 20px;
}

.form-label.req::after,
.form-label.required-label::after,
label.req::after {
  content: ' *';
  color: #dc3545;
  font-weight: bold;
}

/* File upload zone */
.upload-zone {
  border: 2px dashed #adb5bd;
  border-radius: 10px;
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: #fafbff;
}
.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--hh-primary);
  background: var(--hh-light);
}
.upload-icon {
  font-size: 2.5rem;
  color: #adb5bd;
  display: block;
  margin-bottom: 8px;
  transition: color .2s;
}
.upload-zone:hover .upload-icon { color: var(--hh-primary); }

.file-preview-item {
  display: flex;
  align-items: center;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 8px 12px;
  gap: 8px;
}
.file-preview-item img { width: 48px; height: 48px; object-fit: cover; border-radius: 4px; }
.file-preview-item .file-info { flex: 1; min-width: 0; }
.file-preview-item .file-name { font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-preview-item .file-size { font-size: .75rem; color: #6c757d; }
.file-preview-remove { cursor: pointer; color: #adb5bd; flex-shrink: 0; }
.file-preview-remove:hover { color: #dc3545; }

/* Submit button */
.btn-submit { font-size: 1rem; font-weight: 600; }

/* Success circle */
.success-circle {
  width: 80px; height: 80px;
  background: #d1fae5;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem;
  color: #059669;
}

/* ── Admin layout ────────────────────────────────────────── */
.admin-body { display: flex; min-height: 100vh; background: var(--hh-lighter); }

.sidebar {
  width: 240px;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--hh-dark) 0%, var(--hh-primary) 100%);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: width .25s;
  overflow: hidden;
}
.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .sidebar-brand span,
.sidebar.collapsed .sidebar-link span,
.sidebar.collapsed .sidebar-footer .fw-semibold,
.sidebar.collapsed .sidebar-role-badge,
.sidebar.collapsed .sidebar-footer .btn span { display: none; }

.sidebar-brand {
  padding: 16px 16px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  border-bottom: 1px solid rgba(255,255,255,.15);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-brand img {
  height: 32px;
  width: auto;
  flex-shrink: 0;
  mix-blend-mode: screen;
}
.sidebar.collapsed .sidebar-brand img { height: 28px; }

/* Logo on dark background */
.logo-dark {
  mix-blend-mode: screen;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.sidebar-nav { padding: 12px 0; }

.sidebar-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px;
  color: rgba(255,255,255,.8);
  text-decoration: none;
  font-size: .9rem;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.sidebar-link i { font-size: 1.1rem; flex-shrink: 0; }
.sidebar-link:hover { background: rgba(255,255,255,.12); color: #fff; }
.sidebar-link.active { background: rgba(255,255,255,.2); color: #fff; font-weight: 600; }

.sidebar-divider { border-color: rgba(255,255,255,.15); margin: 6px 16px; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,.15);
}
.sidebar-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,.25);
  color: #fff;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-role-badge { font-size: .7rem; color: rgba(255,255,255,.65); }

.main-content {
  margin-left: 240px;
  flex: 1;
  display: flex;
  flex-direction: column;
  transition: margin-left .25s;
}
.main-content.expanded { margin-left: 64px; }

.topbar {
  height: 56px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  position: sticky; top: 0; z-index: 50;
}

.content-area { flex: 1; }

/* Stats cards */
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  display: flex; flex-direction: column; gap: 8px;
}
.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
}
.bg-primary-soft { background: #DCEDC8; }
.bg-warning-soft { background: #fef3c7; }
.bg-info-soft    { background: #cffafe; }
.bg-success-soft { background: #dcfce7; }
.stat-num  { font-size: 1.8rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: .8rem; color: #6b7280; }

.stat-card-link { display: block; }
.stat-card-hover {
  cursor: pointer;
  transition: box-shadow .18s, transform .18s, border-color .18s;
  border: 2px solid transparent;
}
.stat-card-hover:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
  transform: translateY(-3px);
  border-color: var(--hh-primary);
}
.stat-card-active {
  border-color: var(--hh-gold) !important;
  box-shadow: 0 4px 14px rgba(200,147,10,.2);
}

/* Request detail */
.detail-section-title {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #6b7280;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 6px;
  margin-bottom: 12px;
  margin-top: 8px;
}
.detail-label { font-size: .75rem; color: #9ca3af; margin-bottom: 2px; }
.detail-value { font-size: .95rem; color: #111827; }

/* Admin file thumbs */
.file-thumb { position: relative; }
.file-doc-link { transition: background .15s; }
.file-doc-link:hover { background: #f8f9fa !important; }

/* Login */
.login-bg { background: linear-gradient(135deg, var(--hh-dark), var(--hh-primary)); }
.login-card { border-radius: 14px; overflow: hidden; }

/* ── User pages (my-orders) ──────────────────────────────── */
.user-nav {
  background: linear-gradient(135deg, var(--hh-dark), var(--hh-primary));
  padding: 12px 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

/* Status stepper */
.status-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 24px 0 8px;
}
.step-item { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.step-circle {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 3px solid #dee2e6;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  color: #adb5bd;
  transition: all .3s;
}
.step-label { font-size: .78rem; color: #9ca3af; font-weight: 500; text-align: center; }
.step-ts    { font-size: .68rem; color: #b0b8c1; font-weight: 400; margin-top: 2px; }
.step-connector { flex: 1; height: 3px; background: #dee2e6; min-width: 40px; max-width: 80px; transition: background .3s; }

.step-item.done .step-circle  { border-color: var(--hh-primary); background: var(--hh-primary); color: #fff; }
.step-item.done .step-label   { color: var(--hh-primary); font-weight: 600; }
.step-item.active .step-circle { border-color: var(--hh-gold); background: var(--hh-gold); color: #fff; box-shadow: 0 0 0 4px rgba(200,147,10,.2); }
.step-item.active .step-label  { color: var(--hh-gold); font-weight: 700; }
.step-connector.done           { background: var(--hh-primary); }

/* Mini stepper (order list card) */
.mini-stepper { display: flex; align-items: center; gap: 0; margin: 8px 0; }
.mini-step { font-size: .7rem; color: #adb5bd; padding: 2px 8px; border-radius: 20px; border: 1.5px solid #e5e7eb; white-space: nowrap; }
.mini-step.done   { border-color: var(--hh-primary); color: var(--hh-primary); background: var(--hh-light); }
.mini-step.active { border-color: var(--hh-gold); color: var(--hh-gold); background: #fef9ec; font-weight: 700; }
.mini-connector   { flex: 1; height: 1.5px; background: #e5e7eb; min-width: 12px; max-width: 28px; }
.mini-connector.done { background: var(--hh-primary); }

/* Status badges */
.badge-pending    { background: #FEF3C7; color: #92400E; border: 1px solid #F59E0B; }
.badge-processing { background: #DCEDC8; color: #1B5E20; border: 1px solid var(--hh-primary); }
.badge-completed  { background: #D1FAE5; color: #065F46; border: 1px solid #059669; }
.badge-cancelled  { background: #FEE2E2; color: #991B1B; border: 1px solid #EF4444; }
.status-pill {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .02em;
}

/* Order card */
.order-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
  padding: 20px 24px;
  border: 1.5px solid #e5e7eb;
  transition: box-shadow .2s, border-color .2s;
}
.order-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,.1); border-color: var(--hh-primary); }
.order-id-badge { font-size: 1.1rem; font-weight: 700; color: var(--hh-primary); }

/* ── Responsive ──────────────────────────────────────────── */

/* md 以下：sidebar 縮為 icon-only */
@media (max-width: 767.98px) {
  .sidebar { width: 64px; }
  .sidebar .sidebar-brand span,
  .sidebar .sidebar-link span,
  .sidebar .sidebar-footer .fw-semibold,
  .sidebar .sidebar-role-badge,
  .sidebar .sidebar-footer .btn span { display: none; }
  .main-content { margin-left: 64px; }
  .stat-num { font-size: 1.4rem; }
}

/* xs：sidebar 滑出 overlay 模式 */
@media (max-width: 575.98px) {
  .sidebar {
    width: 240px;
    transform: translateX(-100%);
    transition: transform .25s, width .25s;
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 99;
  }
  .sidebar-overlay.active { display: block; }
  /* Restore text in open sidebar on mobile */
  .sidebar.mobile-open .sidebar-brand span,
  .sidebar.mobile-open .sidebar-link span,
  .sidebar.mobile-open .sidebar-footer .fw-semibold,
  .sidebar.mobile-open .sidebar-role-badge,
  .sidebar.mobile-open .sidebar-footer .btn span { display: inline; }
  .main-content { margin-left: 0; }
  .main-content.expanded { margin-left: 0; }

  /* Form submit buttons: stack on mobile */
  .btn-stack-mobile { flex-direction: column !important; align-items: stretch !important; }
  .btn-stack-mobile .btn { width: 100%; }

  /* Status stepper: compact */
  .step-circle { width: 36px; height: 36px; font-size: 1rem; border-width: 2px; }
  .step-connector { min-width: 20px; max-width: 36px; }
  .step-label { font-size: .68rem; }
  .status-stepper { padding: 16px 8px 8px; }

  /* Mini stepper: hide connectors on xs */
  .mini-connector { display: none; }
  .mini-stepper { flex-wrap: wrap; gap: 4px; }

  /* Order card: tighter padding */
  .order-card { padding: 14px 16px; }
  .order-id-badge { font-size: .95rem; }

  /* Status pill: smaller on mobile */
  .status-pill.fs-6 { font-size: .85rem !important; padding: 6px 14px !important; }

  /* Navbar: tighter gap */
  .user-nav .d-flex { gap: 6px !important; }

  /* Admin content area: reduce padding on xs */
  .content-area { padding: 12px !important; }

  /* step-ts: smaller on xs to fit stepper */
  .step-ts { font-size: .6rem; }

  /* Login card full width on xs */
  .login-card { border-radius: 0; min-height: 100vh; max-width: 100% !important; }
  .login-bg { align-items: flex-start !important; }
}
