/* ===== LOGIN ===== */
.login-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--color-bg-alt);
  padding: 20px;
}
.login-box {
  background: #fff; border-radius: var(--radius); padding: 36px;
  width: 360px; max-width: 100%; box-shadow: var(--shadow);
  text-align: center;
}
.login-box h2 { font-family: var(--font-heading); color: var(--color-primary-dark); margin-bottom: 8px; }
.login-hint { font-size: 0.8rem; color: var(--color-text-light); margin-bottom: 18px; }
.login-hint code { background: var(--color-bg-alt); padding: 2px 6px; border-radius: 4px; }
#login-password {
  width: 100%; padding: 12px; border: 1px solid var(--color-border); border-radius: 6px;
  margin-bottom: 12px; font-size: 0.95rem;
}
.login-error { color: #c0392b; font-size: 0.85rem; margin-top: 10px; min-height: 18px; }
.back-to-store { display: inline-block; margin-top: 16px; font-size: 0.85rem; color: var(--color-text-light); text-decoration: underline; }

.hidden { display: none !important; }

/* ===== ADMIN LAYOUT ===== */
.admin-body { background: var(--color-bg); }
.admin-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 28px; background: #fff; border-bottom: 1px solid var(--color-border);
}
.admin-header-actions { display: flex; gap: 10px; }

.admin-tabs {
  display: flex; gap: 8px; padding: 16px 28px 0;
  max-width: 1200px; margin: 0 auto;
}
.tab-btn {
  background: none; border: none; padding: 10px 18px; cursor: pointer;
  font-size: 0.9rem; font-weight: 500; color: var(--color-text-light);
  border-bottom: 2px solid transparent;
}
.tab-btn.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }

.tab-content { display: none; max-width: 1200px; margin: 0 auto; padding: 24px 28px 60px; }
.tab-content.active { display: block; }

.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.section-header h2 { font-family: var(--font-heading); color: var(--color-primary-dark); }

/* ===== SETTINGS ===== */
.settings-card {
  background: #fff; border: 1px solid var(--color-border);
  border-radius: var(--radius); padding: 24px; max-width: 520px;
}
.settings-group-title { font-family: var(--font-heading); color: var(--color-primary-dark); margin-bottom: 6px; font-size: 1.05rem; }
.settings-hint { font-size: 0.83rem; color: var(--color-text-light); margin-bottom: 18px; line-height: 1.5; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.settings-row label { font-size: 0.9rem; font-weight: 500; color: var(--color-text); }
.settings-input-wrap { display: flex; align-items: center; border: 1.5px solid var(--color-border); border-radius: 8px; overflow: hidden; background: #fff; }
.settings-currency { padding: 0 10px; background: var(--color-bg-alt); font-weight: 600; font-size: 0.9rem; border-right: 1px solid var(--color-border); height: 40px; display: flex; align-items: center; }
.settings-number-input { border: none; outline: none; padding: 0 12px; height: 40px; font-size: 0.95rem; font-family: inherit; width: 120px; }
.settings-saved-msg { font-size: 0.83rem; color: var(--color-success); margin-top: 10px; min-height: 18px; }

/* ===== STATS ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.stat-card { background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius); padding: 20px; }
.stat-label { display: block; font-size: 0.8rem; color: var(--color-text-light); margin-bottom: 6px; }
.stat-value { font-size: 1.8rem; font-weight: 700; color: var(--color-primary-dark); font-family: var(--font-heading); }

/* ===== ORDERS ===== */
.orders-list { display: flex; flex-direction: column; gap: 14px; }
.order-card { background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius); padding: 18px; }
.order-card-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.order-id { font-weight: 700; }
.order-date { font-size: 0.8rem; color: var(--color-text-light); }
.order-status {
  font-size: 0.75rem; font-weight: 600; padding: 4px 12px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.status-Pending { background: #fdf2e3; color: #b9770e; }
.status-Processing { background: #e3f0fd; color: #1f618d; }
.status-Shipped { background: #e6f4ea; color: #1e8449; }
.status-Delivered { background: #e8e2f5; color: #5b2c6f; }
.status-Cancelled { background: #fdecea; color: #c0392b; }

.order-customer { font-size: 0.9rem; margin-bottom: 8px; }
.order-customer strong { display: inline-block; min-width: 80px; }
.order-items { font-size: 0.85rem; border-top: 1px solid var(--color-border); padding-top: 10px; margin-top: 6px; }
.order-item-row { display: flex; justify-content: space-between; padding: 3px 0; }
.order-total-row { display: flex; justify-content: space-between; font-weight: 700; border-top: 1px solid var(--color-border); margin-top: 8px; padding-top: 8px; }

.order-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; align-items: center; }
.order-actions select { padding: 6px 10px; border-radius: 6px; border: 1px solid var(--color-border); font-size: 0.85rem; }
.delete-order-btn { background: none; border: none; color: #c0392b; cursor: pointer; font-size: 0.8rem; text-decoration: underline; }

.no-data { text-align: center; color: var(--color-text-light); padding: 40px 0; }

/* ===== PRODUCTS TABLE ===== */
.products-table-wrap { background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius); overflow-x: auto; }
.products-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.products-table th, .products-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--color-border); white-space: nowrap; }
.products-table th { background: var(--color-bg-alt); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--color-text-light); }
.products-table tbody tr:last-child td { border-bottom: none; }

.table-img { width: 44px; height: 44px; border-radius: 6px; background: var(--color-bg-alt); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; background-size: cover; background-position: center; }
.stock-yes { color: #1e8449; font-weight: 600; }
.stock-no { color: #c0392b; font-weight: 600; }

.table-actions { display: flex; gap: 8px; }
.table-actions button { background: none; border: 1px solid var(--color-border); border-radius: 6px; padding: 5px 12px; cursor: pointer; font-size: 0.8rem; }
.table-actions .edit-btn:hover { background: var(--color-bg-alt); }
.table-actions .delete-btn { color: #c0392b; border-color: #f5c6c0; }
.table-actions .delete-btn:hover { background: #fdecea; }

.checkbox-label { flex-direction: row !important; align-items: center; gap: 8px !important; }
.checkbox-label input { width: auto !important; }

/* ===== IMAGE UPLOAD / DROPZONE ===== */
.image-input-group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }

.image-dropzone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  background: var(--color-bg-alt);
  transition: border-color 0.15s, background 0.15s;
}
.image-dropzone.dragover {
  border-color: var(--color-primary);
  background: #fff;
}

.image-dropzone-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--color-text-light);
}

.image-preview-wrap {
  position: relative;
  display: inline-block;
  max-width: 100%;
}
.image-preview {
  max-width: 100%;
  max-height: 160px;
  border-radius: 8px;
  display: block;
  margin: 0 auto;
}
.image-remove-btn {
  position: absolute;
  top: -8px; right: -8px;
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: #fff;
  color: #c0392b;
  cursor: pointer;
  font-size: 0.8rem;
  line-height: 1;
}

.image-or-divider {
  text-align: center;
  font-size: 0.75rem;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ===== PRODUCT FORM (modal) ===== */
#product-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#product-form label {
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
#product-form input[type="text"],
#product-form input[type="number"],
#product-form textarea,
#product-form select {
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
  width: 100%;
}
#product-form textarea { resize: vertical; }

/* ===== MULTI-IMAGE GRID ===== */
.multi-img-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 4px;
}
.image-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg-alt);
  min-height: 80px;
  align-items: flex-start;
}
.img-thumb {
  position: relative;
  width: 76px;
  height: 76px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  flex-shrink: 0;
}
.img-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.img-thumb-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 0.65rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.img-thumb-remove:hover { background: #c0392b; }
.img-add-btn {
  width: 76px;
  height: 76px;
  border: 2px dashed var(--color-border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--color-text-light);
  font-weight: 600;
  transition: border-color 0.2s, color 0.2s;
  flex-shrink: 0;
}
.img-add-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* ===== COLOUR EDITOR ===== */
.color-editor { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.color-entry { display: flex; align-items: center; gap: 8px; }
.color-img-btn { flex-shrink: 0; cursor: pointer; display: block; }
.color-img-thumb {
  width: 38px; height: 38px; border-radius: 6px; border: 1px dashed var(--color-border);
  background: var(--color-bg-alt); background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center; font-size: 1rem;
  cursor: pointer; overflow: hidden; position: relative; flex-shrink: 0;
  transition: border-color 0.15s;
}
.color-img-btn:hover .color-img-thumb { border-color: var(--color-primary); }
.color-img-remove {
  position: absolute; top: 1px; right: 1px; width: 16px; height: 16px;
  border-radius: 50%; background: rgba(0,0,0,0.55); color: #fff; border: none;
  cursor: pointer; font-size: 0.6rem; line-height: 1; display: flex;
  align-items: center; justify-content: center; padding: 0;
}
.color-img-remove:hover { background: #c0392b; }
.color-hex-picker { width: 38px; height: 34px; padding: 2px; border: 1px solid var(--color-border); border-radius: 6px; cursor: pointer; flex-shrink: 0; }
.color-name-input { flex: 1; padding: 7px 10px; border: 1px solid var(--color-border); border-radius: 6px; font-size: 0.85rem; }
.color-price-input { width: 110px; padding: 7px 10px; border: 1px solid var(--color-border); border-radius: 6px; font-size: 0.85rem; flex-shrink: 0; }
.remove-color-btn { background: none; border: none; color: #c0392b; font-size: 1.1rem; cursor: pointer; padding: 2px 6px; line-height: 1; flex-shrink: 0; }
.no-colors-hint { font-size: 0.8rem; color: var(--color-text-light); margin: 0; }
.admin-section-label { font-size: 0.85rem; font-weight: 500; color: var(--color-text); margin-top: 4px; }
.field-hint { font-size: 0.75rem; font-weight: 400; color: var(--color-text-light); }
.btn-sm { font-size: 0.8rem; padding: 6px 14px; }

/* ===== DESIGN ENTRY WITH PER-LENGTH PRICES ===== */
.design-entry { align-items: flex-start !important; }
.design-entry-main { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.design-entry-top { display: flex; align-items: center; gap: 8px; }
.design-entry-top .color-name-input { flex: 1; }
.design-flat-price { width: 100% !important; box-sizing: border-box; }
.design-length-prices {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 8px 10px;
}
.design-length-prices-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 7px;
}
.design-length-grid { display: flex; flex-wrap: wrap; gap: 6px 10px; }
.design-length-row { display: flex; align-items: center; gap: 5px; }
.design-len-cb {
  width: 15px; height: 15px;
  accent-color: var(--color-primary);
  cursor: pointer; flex-shrink: 0;
}
.design-len-price:disabled {
  background: #f0f0f0; color: #bbb;
  border-color: #e0e0e0; cursor: not-allowed;
}
.design-len-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text);
  min-width: 34px;
}
.design-len-price {
  width: 82px;
  padding: 4px 7px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 0.8rem;
}
.design-len-price:focus { border-color: var(--color-primary); outline: none; }
.design-len-cb { width: 15px; height: 15px; cursor: pointer; accent-color: var(--color-primary); flex-shrink: 0; }
.design-custom-rate-row { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; flex-wrap: wrap; }
.design-custom-rate-label { font-size: 0.78rem; font-weight: 600; color: var(--color-text); white-space: nowrap; }
.design-len-price:disabled { background: var(--color-bg-alt); color: var(--color-text-light); cursor: not-allowed; opacity: 0.5; }

/* ===== SIZE OPTIONS WITH PRICE ===== */
.size-checkbox-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.size-option-row { display: flex; align-items: center; gap: 10px; }
.size-option-row label { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; font-weight: 400; min-width: 70px; cursor: pointer; margin: 0; }
.size-option-row label input[type="checkbox"] { width: auto; margin: 0; cursor: pointer; }
.option-price-input { width: 110px; padding: 5px 8px; border: 1px solid var(--color-border); border-radius: 6px; font-size: 0.8rem; }
