/* ==========================================================================
   WIZARD.CSS — Single source of truth for the pickup wizard
   Loaded by BOTH:
     usaGhana.html / index.html   (public)
     new-shipment.html            (dashboard)
   ========================================================================== */

:root {
    --wiz-primary:      #2563eb;
    --wiz-primary-dark: #1d4ed8;
    --wiz-secondary:    #16a34a;
    --wiz-label-color:  #1a5fc0;
}

/* ── Wrappers ────────────────────────────────────────────────────────────── */

/* Public page section — never height:100vh, content drives height */
.pickup-section {
    display: flex;
    flex-direction: column;
    gap: 0;
    height: auto !important;
    min-height: unset !important;
}

.pickup-wrapper {
    display: flex;
    justify-content: center;
    padding: 16px 20px 40px;
    width: 100%;
    box-sizing: border-box;

}

.pickup-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin: 0;
    align-self: center;
    max-width: 650px;
    padding: 2rem;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background-color: #ffffff;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05);
    box-sizing: border-box;
}

/* Dashboard host card — transparent shell, full width, flex-centered */
.stat-card {
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    padding: 0;
}

/* Auth bar above wizard on public page */
.auth-context-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eff6ff;
    border: 1px dashed #bfdbfe;
    border-radius: 8px;
    padding: 12px 20px;
    margin: 0 auto 12px auto;
    gap: 16px;
    width: 100%;
    max-width: 650px;
    box-sizing: border-box;
}

.auth-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-shrink: 0;
}

.btn-auth-inline {
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.btn-login-trigger {
    background: #ffffff;
    color: #2563eb;
    border-color: #cbd5e1;
}

.btn-login-trigger:hover { background: #f8fafc; border-color: #94a3b8; }

.btn-register-trigger { background: #2563eb; color: #ffffff; }
.btn-register-trigger:hover { background: #1d4ed8; }

/* ── Step indicator ─────────────────────────────────────────────────────── */

.step-indicator {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    position: relative;
}

.step-indicator::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background-color: #e2e8f0;
    transform: translateY(-50%);
    z-index: 1;
}

.step-dot {
    width: 38px;
    height: 38px;
    background-color: #ffffff;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #94a3b8;
    position: relative;
    z-index: 2;
    transition: all 0.3s ease;
}

.step-dot.active {
    border-color: var(--wiz-primary);
    background-color: var(--wiz-primary);
    color: #ffffff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2);
}

.step-dot.completed {
    border-color: var(--wiz-secondary);
    background-color: var(--wiz-secondary);
    color: #ffffff;
}

/* ── Panel visibility ───────────────────────────────────────────────────── */

.form-step-panel { display: none; }

.form-step-panel.active {
    display: block;
    animation: wizardFadeIn 0.4s ease forwards;
}

@keyframes wizardFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Panel headings ─────────────────────────────────────────────────────── */

.panel-title {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 8px;
}

.panel-subtitle {
    font-size: 13px;
    color: #64748b;
    margin-top: 0;
    margin-bottom: 24px;
}

/* ── Form controls ──────────────────────────────────────────────────────── */

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 16px;
}

.form-group label,
.cargo-row .label {
    font-size: 12px;
    font-weight: 600;
    color: var(--wiz-label-color);
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 13px;
    color: #1e293b;
    outline: none;
    background-color: #ffffff;
    font-family: inherit;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.form-group input::placeholder,
.form-group textarea::placeholder { color: #94a3b8; }

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--wiz-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ── Address layout ─────────────────────────────────────────────────────── */

.address-grid-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-grid-split { display: flex; gap: 1rem; width: 100%; }
.form-grid-split .form-group { flex: 1; }

/* ── Shipment mode selector ─────────────────────────────────────────────── */

.shipment-mode-selector {
    display: flex;
    gap: 12px;
    margin: 8px 0 1.5rem;
}

.mode-card {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    background: #ffffff;
    transition: border-color 0.15s ease, background 0.15s ease;
    position: relative;
    margin-bottom: 0;
    font-weight: inherit;
    font-size: inherit;
    color: inherit;
    text-transform: none;
    letter-spacing: normal;
}

.mode-card input[type="radio"] {
    position: absolute !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    pointer-events: none !important;
}

.mode-card:has(input:checked)  { border-color: var(--wiz-primary); background: #eff6ff; }
.mode-card:has(input:disabled) { opacity: 0.5; cursor: not-allowed; }

.mode-icon {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    flex-shrink: 0;
    transition: background 0.15s ease, color 0.15s ease;
}

.mode-card:has(input:checked) .mode-icon { background: #dbeafe; color: #1d4ed8; }

.mode-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.mode-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: #1e293b;
    display: block;
    text-transform: none;
    letter-spacing: normal;
    margin-bottom: 0;
}

.mode-card:has(input:checked) .mode-name { color: #1d4ed8; }

.mode-eta {
    font-size: 0.75rem;
    color: #94a3b8;
    display: block;
    margin-top: 2px;
    font-weight: 400;
}

.mode-card:has(input:checked) .mode-eta { color: #3b82f6; }

.mode-coming {
    display: inline-block;
    background: #f1f5f9;
    color: #94a3b8;
    border-radius: 999px;
    padding: 1px 8px;
    font-size: 0.72rem;
    font-weight: 500;
}

.mode-check {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1.5px solid #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s ease;
    background: transparent;
}

.mode-card:has(input:checked) .mode-check {
    background: var(--wiz-primary);
    border-color: var(--wiz-primary);
}

.mode-card:has(input:checked) .mode-check::after {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ffffff;
}

/* ── Cargo item rows ────────────────────────────────────────────────────── */

.cargo-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 12px;
}

/*
 * Grid instead of flexbox here on purpose. This row mixes elements that
 * carry the shared `.form-group` class (display:flex; flex-direction:column)
 * with fixed-size controls (qty input, delete button) — using flex-grow on
 * the item field made it fragile to override from other stylesheets loaded
 * on the same page (dashboard.css / styles.css). Grid tracks size the row
 * deterministically regardless of what display/width rules land on a child,
 * so the item field reliably takes all remaining space.
 */
.item-inputs {
    display: grid;
    grid-template-columns: 1fr 90px 38px;
    align-items: start;
    gap: 10px;
}

.item-inputs .qty-wrapper .item-qty-input {
    width: 100%;
    padding: 11px 10px;
    text-align: center;
}

@media (max-width: 640px) {
    .item-inputs {
        grid-template-columns: 1fr 44px;
        grid-template-areas:
            "item   item"
            "qty    delete";
        row-gap: 10px;
    }
    .item-inputs .autocomplete-wrapper { grid-area: item; }
    .item-inputs .qty-wrapper          { grid-area: qty; }
    .item-inputs .btn-delete-item      { grid-area: delete; align-self: center; }
}

.btn-delete-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: #fee2e2;
    color: #ef4444;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease;
    padding: 0;
    align-self: center;
}

.btn-delete-item:hover  { background: #fca5a5; color: #b91c1c; }
.btn-delete-item:active { transform: scale(0.95); }
.delete-icon-svg        { width: 20px; height: 20px; }

.btn-add {
    background: transparent;
    border: 2px dashed #cbd5e1;
    color: var(--wiz-primary);
    padding: 12px;
    width: 100%;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 24px;
    transition: all 0.2s ease;
    font-family: inherit;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-add:hover { background: #f1f5f9; border-color: var(--wiz-primary); }

/* ── Summary cards ──────────────────────────────────────────────────────── */

.summary-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.summary-card-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--wiz-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 13px;
    color: #475569;
}

.summary-row strong { color: #0f172a; text-align: right; font-weight: 700; }

.financial-card        { background: #f8fafc; border-color: #cbd5e1; }
.total-cost-row strong { color: #b91c1c; font-size: 16px; }
.deposit-row strong    { color: #16a34a; font-size: 16px; }

/* ── Payment option cards ───────────────────────────────────────────────── */

.payment-option-card {
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

.payment-option-card:hover    { border-color: #93c5fd; background: #f8fafc; }
.payment-option-card.selected { border-color: var(--wiz-primary); background: #eff6ff; }
.payment-option-card input[type="radio"] { display: none; }

.payment-option-card label {
    font-weight: 600;
    color: #1e293b;
    cursor: pointer;
    font-size: 14px;
    margin-bottom: 0;
    text-transform: none;
    letter-spacing: normal;
}

.payment-notice { font-size: 0.82rem; color: #64748b; margin-top: 0.75rem; }

/* ── Shipping agreement ─────────────────────────────────────────────────── */

.shipping-agreement-block {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.agreement-label { display: flex; gap: 12px; align-items: flex-start; cursor:pointer; overflow: scroll; max-height: 15vh;
                   scrollbar-width: thin; scrollbar-color: #cbd5e1 #f8fafc; }

.agreement-label::-webkit-scrollbar{width: 6px;}

.agreement-label::-webkit-scrollbar-track{background: #f8fafc; border-radius: 3px;}

.agreement-label::-webkit-scrollbar-thumb{background-color: #cbd5e1; border-radius: 3px; border: 1px solid #f8fafc;}

.agreement-checkbox-wrapper {
    position: relative;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 2px;
}

.agreement-checkbox-wrapper input[type="checkbox"] {
    position: absolute !important;
    opacity: 0 !important;
    width: 18px !important;
    height: 18px !important;
    margin: 0 !important;
    padding: 0 !important;
    cursor: pointer;
    z-index: 1;
    top: 0;
    left: 0;
}

.agreement-checkmark {
    position: absolute;
    top: 0; left: 0;
    width: 18px;
    height: 18px;
    border: 2px solid #cbd5e1;
    border-radius: 4px;
    background: #ffffff;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.agreement-checkbox-wrapper input[type="checkbox"]:checked + .agreement-checkmark {
    background: var(--wiz-primary);
    border-color: var(--wiz-primary);
}

.agreement-checkbox-wrapper input[type="checkbox"]:checked + .agreement-checkmark::after {
    content: '';
    display: block;
    width: 5px;
    height: 9px;
    border: 2px solid #ffffff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg) translate(-1px, -1px);
}

.agreement-text {
    font-size: 0.85rem;
    color: #78350f;
    line-height: 1.55;
    font-weight: 400;
}

.agreement-hint {
    font-size: 0.78rem;
    color: var(--wiz-primary);
    margin: 8px 0 0 30px;
    font-style: italic;
    font-weight: 500;
}

/* ── Nav buttons ────────────────────────────────────────────────────────── */

.wizard-actions {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 32px;
    border-top: 1px solid #e2e8f0;
    padding-top: 24px;
}

.btn-nav {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
    border: none;
    flex: 1;
}

.btn-back { background: #ffffff; border: 1px solid #cbd5e1; color: #475569; }
.btn-back:hover { background: #f1f5f9; }

.btn-next {
    background: var(--wiz-primary);
    color: #ffffff;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-next:hover    { background: var(--wiz-primary-dark); }
.btn-next:disabled { background: #94a3b8; cursor: not-allowed; }

/* ── Alert box ──────────────────────────────────────────────────────────── */

.alert-box {
    padding: 1.25rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    font-weight: 600;
    display: none;
}

.alert-success {
    background-color: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 700px) {
    .pickup-wrapper { padding: 10px 8px 24px; }

    .pickup-container {
        padding: 1.25rem 0.9rem;
        border-radius: 12px;
    }

    .step-dot { width: 32px; height: 32px; font-size: 13px; }

    .auth-context-bar { padding: 10px 12px; }

    .auth-actions { flex-direction: row; }

    .btn-auth-inline { flex: 1; text-align: center; }
}

@media (max-width: 480px) {
    .form-grid-split        { flex-direction: column; gap: 1rem; }
    .shipment-mode-selector { flex-direction: column; }

    .pickup-wrapper { padding: 8px 4px 20px; }

    .pickup-container {
        padding: 1.1rem 0.7rem;
        border-radius: 10px;
    }

    .panel-title    { font-size: 18px; }
    .panel-subtitle { margin-bottom: 18px; }
}

/* ── Item autocomplete ──────────────────────────────────────────────────── */

.autocomplete-wrapper {
    position: relative;
    margin: 0;
}

.item-autocomplete-input {
    width: 100%;
    padding: 11px 14px;
    font-size: 16px; /* prevents iOS auto-zoom on focus */
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    color: #0f172a;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.item-autocomplete-input:focus {
    outline: none;
    border-color: var(--wiz-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.item-autocomplete-input.input-invalid,
.item-custom-input.input-invalid {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.autocomplete-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 50;
    max-height: 260px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12), 0 2px 8px rgba(15, 23, 42, 0.06);
    padding: 6px;
}

.autocomplete-dropdown.open {
    display: block;
}

.autocomplete-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 12px;
    min-height: 44px; /* touch-friendly tap target */
    border-radius: 7px;
    cursor: pointer;
    font-size: 0.92rem;
    color: #1e293b;
}

.autocomplete-option:hover,
.autocomplete-option.active {
    background: rgba(37, 99, 235, 0.08);
}

.autocomplete-option-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.autocomplete-option-price {
    flex-shrink: 0;
    font-weight: 600;
    color: var(--wiz-primary);
    font-variant-numeric: tabular-nums;
}

.autocomplete-empty {
    padding: 14px 12px;
    font-size: 0.88rem;
    color: #94a3b8;
    text-align: center;
}

@media (max-width: 640px) {
    .autocomplete-dropdown {
        max-height: 220px;
    }
    .autocomplete-option {
        padding: 12px;
    }
}