@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

*, *::before, *::after {
  margin: 0; padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --accent: #e76f28;
  --accent-light: #f4a261;
  --accent-bg: #fff1e8;
  --accent-bg-2: #ffe4d0;
  --bg: #f8f4f0;
  --card: #ffffff;
  --card-2: #fdf9f6;
  --border: rgba(0,0,0,0.07);
  --text: #1a1410;
  --text-2: rgba(26,20,16,0.5);
  --text-3: rgba(26,20,16,0.28);
  --sep: rgba(0,0,0,0.06);
  --green: #16a34a;
  --green-bg: #dcfce7;
  --amber: #d97706;
  --amber-bg: #fef3c7;
  --red: #dc2626;
  --red-bg: #fee2e2;
  --blue: #2563eb;
  --blue-bg: #dbeafe;
  --shipped: #7c3aed;
  --shipped-bg: #ede9fe;
  --r: 20px;
  --r-sm: 14px;
  --font: 'Plus Jakarta Sans', -apple-system, sans-serif;
  --shadow: 0 2px 16px rgba(0,0,0,0.07);
  --shadow-sm: 0 1px 6px rgba(0,0,0,0.05);
}

html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
}

.hidden { display: none !important; }

/* ─── LOGIN ──────────────────────────────── */
#login-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 28px;
  background: linear-gradient(160deg, #fff7f0 0%, #f8f4f0 100%);
}

.login-mark {
  width: 64px;
  height: 64px;
  background: var(--accent-bg);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 28px;
  box-shadow: 0 4px 20px rgba(231,111,40,0.15);
}

.login-mark span {
  font-size: 30px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -1px;
  font-family: Georgia, serif;
}

#login-screen h1 {
  font-size: 30px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.login-desc {
  font-size: 15px;
  color: var(--text-2);
  font-weight: 400;
  margin-bottom: 40px;
  line-height: 1.6;
}

.input-group {
  background: var(--card);
  border-radius: var(--r-sm);
  padding: 16px 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

.input-group label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 6px;
}

.input-group input {
  width: 100%;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  font-weight: 500;
}

.input-group input::placeholder {
  color: var(--text-3);
  font-weight: 400;
}

#login-btn {
  width: 100%;
  padding: 17px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  transition: opacity 0.15s;
  box-shadow: 0 4px 20px rgba(231,111,40,0.3);
}

#login-btn:active { opacity: 0.85; }

#login-error {
  margin-top: 14px;
  font-size: 13px;
  color: var(--red);
  font-weight: 500;
  text-align: center;
}

/* ─── HEADER ─────────────────────────────── */
header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(248,244,240,0.94);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--sep);
}

header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-actions select,
#date-filter {
  background: var(--card);
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px 10px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

#refresh-btn, #back-btn {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-2);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

#back-btn {
  width: auto;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
}

.notif-badge {
  font-size: 18px;
  padding: 4px;
  cursor: pointer;
}

/* ─── ORDERS LIST ────────────────────────── */
#orders-list {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.order-card {
  background: var(--card);
  border-radius: var(--r);
  padding: 18px;
  cursor: pointer;
  box-shadow: var(--shadow);
  animation: fadeUp 0.25s ease both;
  transition: transform 0.1s, box-shadow 0.1s;
  border: 1px solid var(--border);
}

.order-card:active {
  transform: scale(0.985);
  box-shadow: var(--shadow-sm);
}

.order-card:nth-child(1) { animation-delay: 0.04s; }
.order-card:nth-child(2) { animation-delay: 0.08s; }
.order-card:nth-child(3) { animation-delay: 0.12s; }
.order-card:nth-child(4) { animation-delay: 0.16s; }
.order-card:nth-child(n+5) { animation-delay: 0.20s; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.card-left { display: flex; align-items: center; gap: 12px; }

.order-avatar {
  width: 44px;
  height: 44px;
  background: var(--accent-bg);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
  letter-spacing: -0.5px;
}

.card-names { display: flex; flex-direction: column; gap: 3px; }

.order-customer-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.1px;
}

.order-number-small {
  font-size: 12px;
  color: var(--text-3);
  font-weight: 500;
}

.order-amount {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.4px;
  text-align: right;
}

.order-currency {
  font-size: 11px;
  color: var(--text-3);
  font-weight: 500;
  text-align: right;
  margin-top: 1px;
}

.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.order-items-preview {
  font-size: 12px;
  color: var(--text-2);
  font-weight: 400;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
  letter-spacing: 0.01em;
}

.status-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-processing  { background: var(--green-bg);   color: var(--green);   }
.status-processing::before  { background: var(--green); }
.status-pending     { background: var(--amber-bg);   color: var(--amber);   }
.status-pending::before     { background: var(--amber); }
.status-completed   { background: var(--blue-bg);    color: var(--blue);    }
.status-completed::before   { background: var(--blue); }
.status-cancelled   { background: var(--red-bg);     color: var(--red);     }
.status-cancelled::before   { background: var(--red); }
.status-on-hold     { background: var(--amber-bg);   color: var(--amber);   }
.status-on-hold::before     { background: var(--amber); }
.status-refunded    { background: var(--red-bg);     color: var(--red);     }
.status-refunded::before    { background: var(--red); }
.status-wc-shipped  { background: var(--shipped-bg); color: var(--shipped); }
.status-wc-shipped::before  { background: var(--shipped); }
.status-shipped     { background: var(--shipped-bg); color: var(--shipped); }
.status-shipped::before     { background: var(--shipped); }

/* ─── DETAIL ─────────────────────────────── */
#order-detail {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 40px;
}

.detail-hero {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
  border-radius: var(--r);
  padding: 28px 22px;
  text-align: center;
  animation: fadeUp 0.2s ease both;
  box-shadow: 0 8px 32px rgba(231,111,40,0.25);
}

.detail-hero .hero-amount {
  font-size: 42px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -2px;
  line-height: 1;
  margin-bottom: 6px;
}

.detail-hero .hero-number {
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  font-weight: 500;
  margin-bottom: 14px;
}

.hero-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(255,255,255,0.22);
  color: #fff;
  letter-spacing: 0.02em;
}

.hero-status-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.8);
  flex-shrink: 0;
}

.detail-section {
  background: var(--card);
  border-radius: var(--r);
  overflow: hidden;
  animation: fadeUp 0.2s ease both;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.detail-section:nth-child(1) { animation-delay: 0.04s; }
.detail-section:nth-child(2) { animation-delay: 0.08s; }
.detail-section:nth-child(3) { animation-delay: 0.12s; }
.detail-section:nth-child(4) { animation-delay: 0.16s; }
.detail-section:nth-child(5) { animation-delay: 0.20s; }

.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 16px 18px 10px;
}

.detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  border-top: 1px solid var(--sep);
}

.detail-row:first-of-type { border-top: none; }

.row-label {
  font-size: 14px;
  color: var(--text-2);
  font-weight: 400;
  flex-shrink: 0;
}

.row-value {
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
  text-align: right;
  max-width: 60%;
  word-break: break-word;
}

/* ─── ORDER ITEMS ────────────────────────── */
.order-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-top: 1px solid var(--sep);
}

.order-item:first-of-type { border-top: none; }

.product-img {
  width: 62px;
  height: 62px;
  object-fit: cover;
  border-radius: 12px;
  flex-shrink: 0;
  background: var(--bg);
  border: 1px solid var(--border);
}

.img-placeholder {
  width: 62px;
  height: 62px;
  border-radius: 12px;
  background: var(--accent-bg);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

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

.item-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
  line-height: 1.3;
}

.item-sku {
  font-size: 11px;
  color: var(--text-3);
  font-weight: 500;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.item-meta {
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 1px;
}

.item-qty {
  font-size: 12px;
  color: var(--text-3);
  font-weight: 500;
}

.item-price {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
  letter-spacing: -0.2px;
}

/* ─── NOTE ───────────────────────────────── */
.note-section {
  background: #fffbeb;
  border-radius: var(--r);
  border: 1px solid #fde68a;
  overflow: hidden;
  animation: fadeUp 0.2s ease both;
  box-shadow: var(--shadow-sm);
}

.note-section .section-label { color: var(--amber); }

.note-text {
  font-size: 14px;
  color: #92400e;
  line-height: 1.6;
  font-weight: 400;
  padding: 0 18px 16px;
  font-style: italic;
}

/* ─── ACTIONS ────────────────────────────── */
.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.action-btn {
  width: 100%;
  padding: 17px;
  border: none;
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  letter-spacing: 0.01em;
}

.action-btn:active { opacity: 0.8; transform: scale(0.99); }
.action-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-shipped {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 16px rgba(231,111,40,0.3);
}

/* ─── STATES ─────────────────────────────── */
.loading {
  padding: 80px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.loader {
  width: 26px;
  height: 26px;
  border: 2.5px solid var(--accent-bg-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading p {
  font-size: 13px;
  color: var(--text-3);
  font-weight: 500;
}

.empty {
  padding: 80px 20px;
  text-align: center;
  font-size: 14px;
  color: var(--text-3);
  font-weight: 500;
}

.error {
  padding: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--red);
  font-weight: 500;
}
