/* =============================================================================
   Add Time dialog (release faadumo48) — src/components/AlphaExtendTime.jsx
   Same look as the Edit Sale Record dialog. Every rule is scoped to .aet-root.
   ============================================================================= */
.aet-root {
  --aet-surface: #ffffff;
  --aet-canvas: #f8fafc;
  --aet-ink: #0f172a;
  --aet-text: #1e293b;
  --aet-muted: #64748b;
  --aet-line: #e2e8f0;
  --aet-brand: #e11d2e;
  --aet-brand-deep: #be123c;
  --aet-brand-soft: #fff1f2;
  --aet-good: #047857;
  --aet-good-soft: #ecfdf5;
  --aet-warn: #b45309;
  --aet-warn-soft: #fffbeb;
  --aet-ease: cubic-bezier(0.22, 1, 0.36, 1);
}
.dark .aet-root {
  --aet-surface: #0f172a;
  --aet-canvas: #111c33;
  --aet-ink: #f8fafc;
  --aet-text: #e2e8f0;
  --aet-muted: #94a3b8;
  --aet-line: #1e293b;
  --aet-brand: #ef4444;
  --aet-brand-deep: #dc2626;
  --aet-brand-soft: rgba(239, 68, 68, 0.12);
  --aet-good: #6ee7b7;
  --aet-good-soft: rgba(52, 211, 153, 0.12);
  --aet-warn: #fcd34d;
  --aet-warn-soft: rgba(251, 191, 36, 0.12);
}
.aet-root *, .aet-root *::before, .aet-root *::after { box-sizing: border-box; }
.aet-root svg { width: 16px; height: 16px; flex: none; }

.aet-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  font-family: inherit;
  animation: aet-fade 0.2s var(--aet-ease) both;
}
.aet-dialog {
  width: 100%;
  max-width: 600px;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  background: var(--aet-surface);
  color: var(--aet-text);
  border: 1px solid var(--aet-line);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.3);
  overflow: hidden;
  animation: aet-pop 0.24s var(--aet-ease) both;
}
@keyframes aet-fade { from { opacity: 0; } }
@keyframes aet-pop { from { opacity: 0; transform: scale(0.96); } }

.aet-dialog:focus { outline: none; }
.aet-head { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--aet-line); }
.aet-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--aet-brand); color: #fff; flex: none; }
.aet-icon svg { width: 18px; height: 18px; }
.aet-head-text { flex: 1; min-width: 0; }
.aet-head h2 { margin: 0; font-size: 18px; font-weight: 800; color: var(--aet-ink); }
.aet-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--aet-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aet-x { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--aet-muted); cursor: pointer; }
.aet-x:hover { background: var(--aet-canvas); color: var(--aet-ink); }

.aet-body { display: flex; flex-direction: column; gap: 16px; padding: 18px 22px; overflow-y: auto; }
.aet-now { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.aet-now > div { padding: 10px 12px; border-radius: 12px; background: var(--aet-canvas); border: 1px solid var(--aet-line); min-width: 0; }
.aet-now span, .aet-metrics span { display: block; font-size: 10.5px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--aet-muted); }
.aet-now strong { display: block; margin-top: 2px; font-size: 14px; font-weight: 800; color: var(--aet-ink); font-variant-numeric: tabular-nums; }

.aet-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.aet-label { font-size: 12.5px; font-weight: 700; color: var(--aet-text); }
.aet-faint { color: var(--aet-muted); font-weight: 500; }
.aet-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.aet-chip,
.aet-days {
  height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--aet-line);
  background: var(--aet-surface);
  color: var(--aet-text);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, color 0.15s, transform 0.15s var(--aet-ease);
}
.aet-chip:hover { border-color: var(--aet-brand); }
.aet-chip:active { transform: scale(0.97); }
.aet-chip.is-active,
.aet-days.is-active { border-color: var(--aet-brand); background: var(--aet-brand-soft); color: var(--aet-brand-deep); box-shadow: 0 0 0 1px var(--aet-brand) inset; }
.aet-days { display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; cursor: text; }
.aet-days input { width: 52px; border: 0; outline: 0; background: transparent; color: inherit; font: inherit; font-weight: 700; }
.aet-days span { color: var(--aet-muted); font-weight: 600; }

.aet-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.aet-input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--aet-line);
  background: var(--aet-surface);
  color: var(--aet-text);
  font: inherit;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  outline: 0;
  transition: border-color 0.2s, box-shadow 0.2s var(--aet-ease);
}
.aet-input:focus { border-color: var(--aet-brand); box-shadow: 0 0 0 3px rgba(225, 29, 46, 0.14); }
.dark .aet-root .aet-input[type="date"] { color-scheme: dark; }
.aet-due { max-width: 320px; }

.aet-result { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: 14px; border: 1px solid var(--aet-line); background: var(--aet-canvas); }
.aet-dates { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; font-size: 14px; color: var(--aet-muted); font-weight: 600; }
.aet-dates strong { font-size: 17px; color: var(--aet-ink); font-weight: 800; }
.aet-dates em { font-style: normal; font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: var(--aet-good-soft); color: var(--aet-good); }
.aet-arrow { color: var(--aet-brand); font-weight: 800; }
.aet-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.aet-metrics > div { padding: 8px 10px; border-radius: 10px; background: var(--aet-surface); border: 1px solid var(--aet-line); min-width: 0; }
.aet-metrics strong { display: block; margin-top: 2px; font-size: 14.5px; font-weight: 800; color: var(--aet-ink); font-variant-numeric: tabular-nums; }
.aet-good { color: var(--aet-good) !important; }
.aet-warn { color: var(--aet-warn) !important; }
.aet-bad { color: var(--aet-brand) !important; }

.aet-expired { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; border-radius: 12px; background: var(--aet-brand-soft); color: var(--aet-text); font-size: 13.5px; line-height: 1.5; }
.aet-expired p { margin: 0; }
.aet-error { margin: 0; padding: 9px 12px; border-radius: 10px; background: var(--aet-brand-soft); color: var(--aet-brand-deep); font-size: 13px; font-weight: 600; }

.aet-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--aet-line); background: var(--aet-surface); }
.aet-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
  transition: background-color 0.15s, transform 0.15s var(--aet-ease), opacity 0.15s;
}
.aet-btn:hover:not(:disabled) { transform: translateY(-1px); }
.aet-btn:active:not(:disabled) { transform: scale(0.97); }
.aet-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.aet-btn--primary { background: var(--aet-brand); color: #fff; box-shadow: 0 6px 16px rgba(225, 29, 46, 0.25); }
.aet-btn--primary:hover:not(:disabled) { background: var(--aet-brand-deep); }
.aet-btn--ghost { background: transparent; color: var(--aet-text); }
.aet-btn--ghost:hover:not(:disabled) { background: var(--aet-canvas); }
.aet-expired .aet-btn--ghost { background: var(--aet-surface); border-color: var(--aet-line); }
.aet-spin { animation: aet-spin 0.9s linear infinite; }
@keyframes aet-spin { to { transform: rotate(360deg); } }

.aet-root button:focus-visible { outline: 2px solid var(--aet-brand); outline-offset: 2px; }

@media (max-width: 640px) {
  .aet-overlay { align-items: flex-end; padding: 0; }
  .aet-dialog { max-width: none; max-height: 94vh; border-radius: 18px 18px 0 0; }
  .aet-head, .aet-body, .aet-foot { padding-left: 16px; padding-right: 16px; }
  .aet-now { grid-template-columns: 1fr 1fr; }
  .aet-now > div:last-child { grid-column: 1 / -1; }
  .aet-grid { grid-template-columns: 1fr; }
  .aet-metrics { grid-template-columns: 1fr 1fr; }
  .aet-chip, .aet-days, .aet-input, .aet-btn { height: 46px; font-size: 15px; }
  .aet-foot .aet-btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .aet-overlay, .aet-dialog, .aet-spin { animation: none; }
  .aet-btn, .aet-chip { transition: none; }
  .aet-btn:hover:not(:disabled), .aet-btn:active:not(:disabled), .aet-chip:active { transform: none; }
}

/* faadumo49: "Add extra time" button in the Edit Sale Record dialog footer */
.aet-edit-btn {
  margin-right: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid #a7f3d0;
  background: #ecfdf5;
  color: #047857;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: background-color 0.15s, transform 0.15s cubic-bezier(0.22, 1, 0.36, 1);
}
.aet-edit-btn svg { width: 16px; height: 16px; flex: none; }
.aet-edit-btn:hover { background: #d1fae5; transform: translateY(-1px); }
.aet-edit-btn:active { transform: scale(0.97); }
.aet-edit-btn:focus-visible { outline: 2px solid #e11d2e; outline-offset: 2px; }
.dark .aet-edit-btn { background: rgba(52, 211, 153, 0.12); border-color: #065f46; color: #6ee7b7; }
.dark .aet-edit-btn:hover { background: rgba(52, 211, 153, 0.2); }
@media (prefers-reduced-motion: reduce) { .aet-edit-btn, .aet-edit-btn:hover, .aet-edit-btn:active { transition: none; transform: none; } }

/* faadumo50: where the money is counted, and what happens to both sales */
.aet-month strong { color: var(--aet-brand) !important; }
.aet-how { margin: 0; padding: 0 0 0 18px; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; line-height: 1.45; color: var(--aet-muted); }
.aet-how b { color: var(--aet-ink); }
