/*
 * EU Withdrawal Button Compliance Manager for PrestaShop
 *
 * @author    HiddenTechies
 * @copyright 2026 HiddenTechies
 * @license   http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */

.ht-wd-order-block { border: 1px solid #e5e5e5; border-radius: 6px; }
.ht-wd-order-block .ht-wd-title { margin-top: 0; font-size: 1.1rem; }
.ht-wd-order-block .ht-wd-button { margin-top: .5rem; }
.ht-wd-remaining { font-weight: 600; }

/* The account-page entry intentionally has NO module CSS: it reuses the
   theme's own .link-item / column styling so it renders exactly like the
   native account links (same approach as psgdpr). */

/* Request-type selector (withdrawal / return / exchange / damaged) */
.ht-wd-types { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.25rem; }
.ht-wd-types .btn { flex: 0 0 auto; }
.ht-wd-type-buttons { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.ht-wd-type-buttons .ht-wd-button { margin-top: 0; }
.ht-wd-type-buttons .ht-wd-remaining { font-weight: 400; opacity: .85; }

/* Return instructions + logistics shown on the history page */
.ht-wd-instructions { font-size: .9rem; }
.ht-wd-pre { white-space: pre-line; }
.ht-wd-logistics { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin: .5rem 0; }
.ht-wd-logistics .material-icons { vertical-align: middle; font-size: 1.1rem; }
.ht-wd-tracking { font-size: .85rem; }
.ht-wd-my-attachments { font-size: .85rem; }
.ht-wd-selectall { margin-bottom: .75rem; font-weight: 600; }

/* Withdrawal / RMA form */
.ht-wd-form .ht-wd-line { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; padding: .75rem 0; border-bottom: 1px solid #f0f0f0; }
.ht-wd-form .ht-wd-line .ht-wd-line-img { flex: 0 0 auto; }
.ht-wd-form .ht-wd-line .ht-wd-line-img img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid #e6e6e6; background: #fff; display: block; }
.ht-wd-form .ht-wd-line .ht-wd-line-name { flex: 1 1 240px; font-weight: 600; }
.ht-wd-form .ht-wd-line .ht-wd-line-qty { width: 90px; }
.ht-wd-form .ht-wd-line.ht-wd-line-excluded { opacity: .55; }
.ht-wd-form .ht-wd-exclude-tag { font-size: .8rem; color: #b94a48; }
.ht-wd-form .ht-wd-legal { background: #f7f7f9; border-left: 3px solid #2980b9; padding: .75rem 1rem; margin: 1rem 0; font-size: .9rem; }
.ht-wd-form .ht-wd-confirm { margin: 1rem 0; }

/* Status badges + history */
.ht-wd-badge { display: inline-block; padding: .2rem .55rem; border-radius: 12px; color: #fff; font-size: .8rem; line-height: 1.4; }
.ht-wd-history-table { width: 100%; }
.ht-wd-history-table th, .ht-wd-history-table td { padding: .6rem; border-bottom: 1px solid #eee; vertical-align: top; }
.ht-wd-timeline { list-style: none; margin: 0; padding: 0; }
.ht-wd-timeline li { padding: .5rem 0 .5rem 1.2rem; border-left: 2px solid #e0e0e0; margin-left: .4rem; position: relative; }
.ht-wd-timeline li::before { content: ""; position: absolute; left: -6px; top: .8rem; width: 10px; height: 10px; border-radius: 50%; background: #2980b9; }
.ht-wd-timeline .ht-wd-time { color: #888; font-size: .8rem; }

/* Guest portal */
.ht-wd-guest .form-group { max-width: 420px; }

@media (max-width: 575px) {
  .ht-wd-form .ht-wd-line { flex-direction: column; align-items: flex-start; }
  .ht-wd-form .ht-wd-line .ht-wd-line-qty { width: 100%; }
  .ht-wd-history-table thead { display: none; }
  .ht-wd-history-table td { display: block; border: none; }
}

/* Inline validation + accessibility helpers (v1.1.1) */
.ht-wd-errors { margin: .75rem 0; }
.ht-wd-qty-hint { display: block; margin-top: .25rem; }
.ht-wd-resend { margin-top: 1rem; }
/* sr-only fallback for themes that ship Bootstrap 5 (which renames it to
   .visually-hidden) so the table caption stays accessible-only. */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Review table — keep readable on small screens */
.ht-wd-review-table { width: 100%; }
@media (max-width: 575px) {
  .ht-wd-review-table { font-size: .9rem; }
}

/* Footer withdrawal button (v1.1.0) */
.ht-wd-footer { margin: .75rem 0; }
.ht-wd-footer--left { text-align: left; }
.ht-wd-footer--center { text-align: center; }
.ht-wd-footer--right { text-align: right; }
.ht-wd-footer__btn { display: inline-block; text-decoration: none; border-radius: .375rem; font-weight: 600; line-height: 1.2; transition: opacity .15s ease; }
.ht-wd-footer__btn:hover { opacity: .9; text-decoration: none; }
.ht-wd-footer__btn--small { padding: .35rem .75rem; font-size: .85rem; }
.ht-wd-footer__btn--medium { padding: .55rem 1.1rem; font-size: .95rem; }
.ht-wd-footer__btn--large { padding: .8rem 1.6rem; font-size: 1.1rem; }
.ht-wd-footer__link { text-decoration: underline; }
.ht-wd-footer__icon { vertical-align: middle; margin-right: .4em; }
.ht-wd-footer--floating { position: fixed; right: 1rem; bottom: 1rem; z-index: 1030; margin: 0; }
.ht-wd-footer--floating-left { right: auto; left: 1rem; }

/* Order-history page button (injected by front.js into each eligible order row) */
.ht-wd-history-btn { display: inline-block; margin: 4px 0 0; padding: 4px 11px; border-radius: .25rem; font-size: .8125rem; line-height: 1.4; font-weight: 600; text-decoration: none; background: #2563eb; color: #fff; white-space: nowrap; }
.ht-wd-history-btn:hover { opacity: .92; color: #fff; text-decoration: none; }
.order-actions .ht-wd-history-btn { margin-left: 6px; }

/* ---------------------------------------------------------------------------
   Popup-wizard flow (FRONT_FLOW = wizard): modal overlay, steps and order picker
   --------------------------------------------------------------------------- */
.ht-wd-modal-open { overflow: hidden; }
.ht-wd-modal-overlay { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: flex-start; justify-content: center; padding: 4vh 16px; background: rgba(17, 24, 39, .55); overflow-y: auto; opacity: 0; transition: opacity .2s ease; }
.ht-wd-modal-overlay.is-visible { opacity: 1; }
.ht-wd-modal-overlay[hidden] { display: none; }
.ht-wd-modal { width: 100%; max-width: 640px; background: var(--ht-wd-body-bg, #fff); border-radius: var(--ht-wd-radius, 10px); box-shadow: 0 20px 50px rgba(0, 0, 0, .3); display: flex; flex-direction: column; max-height: 92vh; outline: none; overflow: hidden; opacity: 0; transform: translateY(14px) scale(.98); transition: opacity .25s ease, transform .25s cubic-bezier(.16, 1, .3, 1); }
.ht-wd-modal-overlay.is-visible .ht-wd-modal { opacity: 1; transform: none; }
.ht-wd-modal__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid #e5e7eb; background: var(--ht-wd-header-bg, #fff); }
.ht-wd-modal__title { margin: 0; font-size: 1.15rem; color: var(--ht-wd-header-font, #111827); }
.ht-wd-modal__close { border: 0; background: transparent; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--ht-wd-header-font, #6b7280); opacity: .7; padding: 0 4px; }
.ht-wd-modal__close:hover { opacity: 1; }
.ht-wd-modal__body { padding: 20px; overflow-y: auto; background: var(--ht-wd-body-bg, #fff); }
.ht-wd-modal__loading { padding: 44px 0; display: flex; flex-direction: column; align-items: center; gap: 14px; color: #6b7280; }
.ht-wd-modal__loading-text { font-size: .9rem; }
.ht-wd-spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid #e3e8ed; border-top-color: var(--ht-wd-accent, #2980b9);
  animation: htWdSpin .8s linear infinite;
}
@keyframes htWdSpin { to { transform: rotate(360deg); } }
.ht-wd-modal__error { text-align: center; }
.ht-wd-modal__error-text { margin: 0 0 12px; }
@media (prefers-reduced-motion: reduce) { .ht-wd-spinner { animation-duration: 1.6s; } }
.ht-wd-modal__foot { padding: 14px 20px; border-top: 1px solid #e5e7eb; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--ht-wd-body-bg, #fff); }
.ht-wd-modal__steps { color: #6b7280; font-size: .875rem; font-weight: 600; }
.ht-wd-modal__nav { display: flex; gap: 8px; margin-left: auto; }
.ht-wd-modal-msg { margin: 0; }

/* Accent — the merchant's wizard colour drives the primary Next / Submit actions
   and the active request-type buttons (falls back to the module blue). */
.ht-wd-modal .ht-wd-modal__next,
.ht-wd-modal .ht-wd-modal__submit,
.ht-wd-modal .ht-wd-wizard-type.btn-primary {
  background: var(--ht-wd-accent, #2563eb);
  border-color: var(--ht-wd-accent, #2563eb);
  color: var(--ht-wd-accent-font, #fff);
}
.ht-wd-modal .ht-wd-modal__next:hover,
.ht-wd-modal .ht-wd-modal__submit:hover { filter: brightness(.95); color: var(--ht-wd-accent-font, #fff); }
.ht-wd-modal .ht-wd-modal__submit:disabled { opacity: .55; cursor: not-allowed; }

/* Steps reuse the form styling; only visibility is wizard-controlled. */
.ht-wd-wizard-form .ht-wd-fieldset[hidden] { display: none; }
.ht-wd-modal__next, .ht-wd-modal__back, .ht-wd-modal__submit, .ht-wd-modal__close { transition: filter .15s ease, opacity .15s ease, background-color .15s ease; }

/* Smooth step changes — forward slides in from the right, Back from the left.
   Content swaps (picker <-> form <-> message) fade in. */
@keyframes htWdStepNext { from { opacity: 0; transform: translateX(22px); } to { opacity: 1; transform: none; } }
@keyframes htWdStepBack { from { opacity: 0; transform: translateX(-22px); } to { opacity: 1; transform: none; } }
@keyframes htWdFadeIn { from { opacity: 0; } to { opacity: 1; } }
.ht-wd-step-in-next { animation: htWdStepNext .26s cubic-bezier(.16, 1, .3, 1); }
.ht-wd-step-in-back { animation: htWdStepBack .26s cubic-bezier(.16, 1, .3, 1); }
.ht-wd-modal__body.ht-wd-fade-in { animation: htWdFadeIn .22s ease; }

/* Respect users who prefer reduced motion. */
@media (prefers-reduced-motion: reduce) {
  .ht-wd-modal-overlay, .ht-wd-modal { transition: none !important; }
  .ht-wd-step-in-next, .ht-wd-step-in-back, .ht-wd-modal__body.ht-wd-fade-in { animation: none !important; }
}

/* Order picker shown when the wizard opens without an order context. */
.ht-wd-order-picker { list-style: none; margin: 0; padding: 0; }
.ht-wd-order-picker__item { padding: 12px 0; border-bottom: 1px solid #eef0f3; }
.ht-wd-order-picker__item:last-child { border-bottom: 0; }
.ht-wd-order-picker__head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.ht-wd-order-picker__ref { font-weight: 600; }
.ht-wd-order-picker__types { display: flex; flex-wrap: wrap; gap: 6px; }

@media (max-width: 480px) {
  .ht-wd-modal__nav { width: 100%; }
  .ht-wd-modal__nav .btn { flex: 1 1 auto; }
}

/* ---- Conversation (two-way messaging) ---- */
.ht-wd-conversation { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid #e7ebef; }
.ht-wd-conversation-title {
  font-size: .95rem; font-weight: 600; letter-spacing: .01em;
  margin: 0 0 .85rem; display: flex; align-items: center; gap: .4rem; color: #33475b;
}
.ht-wd-conversation-title::before {
  content: ""; display: inline-block; width: 18px; height: 18px; flex: 0 0 18px;
  background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%232980b9'%3E%3Cpath d='M20 2H4a2 2 0 0 0-2 2v18l4-4h14a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2Zm-3 11H7v-2h10v2Zm0-3H7V8h10v2Z'/%3E%3C/svg%3E");
}

/* Chat thread */
.ht-wd-chat { display: flex; flex-direction: column; gap: .55rem; margin-bottom: 1rem; }
.ht-wd-msg {
  max-width: 85%; padding: .55rem .8rem; border-radius: 14px;
  box-shadow: 0 1px 2px rgba(16, 42, 67, .06); line-height: 1.35;
}
.ht-wd-msg-in { align-self: flex-start; background: #f1f4f7; border: 1px solid #e3e8ed; border-bottom-left-radius: 4px; }
.ht-wd-msg-out { align-self: flex-end; background: #e7f2fb; border: 1px solid #cfe4f5; border-bottom-right-radius: 4px; }
.ht-wd-msg-meta { display: flex; justify-content: space-between; gap: .75rem; font-size: .72rem; color: #8193a3; margin-bottom: .25rem; }
.ht-wd-msg-meta strong { color: #33475b; font-weight: 600; }
.ht-wd-msg-body { font-size: .9rem; color: #2b3a48; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.ht-wd-msg-atts { margin-top: .45rem; padding-top: .35rem; border-top: 1px dashed rgba(51, 71, 91, .18); font-size: .8rem; }
.ht-wd-msg-atts a { display: inline-block; margin-right: .85rem; }

/* Reply form */
.ht-wd-reply-form {
  background: #f8fafc; border: 1px solid #e7ebef; border-radius: 12px;
  padding: .9rem 1rem 1rem;
}
.ht-wd-reply-form .form-group { margin-bottom: .65rem; }
.ht-wd-reply-form textarea {
  width: 100%; min-height: 84px; resize: vertical;
  border: 1px solid #d4dbe2; border-radius: 8px; padding: .6rem .75rem;
  font-size: .9rem; background: #fff; transition: border-color .15s, box-shadow .15s;
}
.ht-wd-reply-form textarea:focus {
  outline: none; border-color: #2980b9; box-shadow: 0 0 0 3px rgba(41, 128, 185, .15);
}
.ht-wd-reply-files { margin-bottom: .75rem; }
.ht-wd-reply-files label { display: block; font-size: .8rem; font-weight: 600; color: #55677a; margin-bottom: .3rem; }
.ht-wd-reply-files input[type="file"] {
  width: 100%; max-width: 100%; font-size: .82rem; color: #55677a;
  background: #fff; border: 1px dashed #cbd4dd; border-radius: 8px; padding: .45rem .6rem;
}
.ht-wd-reply-form .btn { margin-top: .15rem; }
.ht-wd-closed-note { margin-top: .5rem; font-size: .85rem; font-style: italic; }

/* Document action buttons (PDF / return slip) below the conversation */
.ht-wd-doc-actions { margin-top: 1.25rem; display: flex; flex-wrap: wrap; gap: .5rem; }
