/* ═══════════════════════════════════════
   LEO Order Tracking — Frontend Styles
   ═══════════════════════════════════════ */

#leo-ot-wrap {
    --lot-primary: #b8a494;
    --lot-primary-dark: #8c7565;
    --lot-track-bg: #e8e4e0;
    --lot-card-bg: #faf9f8;
    --lot-text: #2c2c2c;
    --lot-text-muted: #6b6b6b;
    --lot-error: #c0392b;
    --lot-success: #5a8a5e;
    --lot-border: #e0dcd8;
    --lot-radius: 12px;

    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
                 Ubuntu, Cantarell, sans-serif;
    max-width: 720px;
    margin: 40px auto;
    padding: 0 16px;
    color: var(--lot-text);
}

/* ── Form Card ── */

#leo-ot-form-card {
    background: var(--lot-card-bg);
    border: 1px solid var(--lot-border);
    border-radius: var(--lot-radius);
    padding: 40px 36px;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.04);
}

.leo-ot-title {
    margin: 0 0 6px;
    font-size: 1.6em;
    font-weight: inherit;
    color: var(--lot-text);
    text-align: center;
}

.leo-ot-subtitle {
    margin: 0 0 28px;
    text-align: center;
    color: var(--lot-text-muted);
    font-size: 0.95em;
}

.leo-ot-field {
    margin-bottom: 18px;
}

.leo-ot-field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.9em;
    color: var(--lot-text);
}

.leo-ot-field input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--lot-border);
    border-radius: 8px;
    font-size: 1em;
    background: #fff;
    transition: border-color 0.25s, box-shadow 0.25s;
    box-sizing: border-box;
}

.leo-ot-field input:focus {
    outline: none;
    border-color: var(--lot-primary);
    box-shadow: 0 0 0 3px rgba(184, 164, 148, 0.2);
}

#leo-ot-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    margin-top: 24px;
    border: none;
    border-radius: 8px;
    background: var(--lot-primary-dark);
    color: #fff;
    font-size: 1.05em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.25s, transform 0.15s;
}

#leo-ot-submit:hover {
    background: #7a6555;
}
#leo-ot-submit:active {
    transform: scale(0.98);
}
#leo-ot-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Spinner */
.leo-ot-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: lotSpin 0.6s linear infinite;
}
@keyframes lotSpin {
    to { transform: rotate(360deg); }
}

/* Error */
#leo-ot-error {
    margin-top: 16px;
    padding: 12px 16px;
    background: #fef0f0;
    border: 1px solid #f5c6c6;
    border-radius: 8px;
    color: var(--lot-error);
    font-size: 0.9em;
    line-height: 1.5;
    text-align: center;
}

/* ── Results Container ── */

#leo-ot-results {
    animation: lotFadeUp 0.6s ease-out both;
}

@keyframes lotFadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ═══════════════════════════════════
   DESKTOP: Horizontal Progress Bar
   — dots positioned by cumulative %
   — inactive labels rotated at angle
   ═══════════════════════════════════ */

#leo-ot-progress-desktop {
    position: relative;
    padding: 50px 20px 120px;
    overflow: visible;
}

/* Track */
.leo-ot-track {
    position: relative;
    width: 100%;
    height: 8px;
    background: var(--lot-track-bg);
    border-radius: 4px;
    overflow: hidden;
}

.leo-ot-track-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--lot-primary), var(--lot-primary-dark));
    border-radius: 4px;
    transition: width 1.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Step dots container */
.leo-ot-steps-desktop {
    position: absolute;
    top: 0;
    left: 20px;
    right: 20px;
    bottom: 0;
    pointer-events: none;
    overflow: visible;
}

/* Individual step (positioned by JS via left:%) */
.leo-ot-step-d {
    position: absolute;
    top: 46px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translateX(-50%);
    opacity: 0;
    animation: lotDotIn 0.5s ease-out forwards;
}

/* Dot circle */
.leo-ot-dot-d {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--lot-track-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.5s, background 0.5s, transform 0.5s, box-shadow 0.5s;
    z-index: 2;
    position: relative;
}

.leo-ot-dot-d .leo-ot-check {
    width: 12px;
    height: 12px;
    opacity: 0;
    color: #fff;
    transition: opacity 0.3s;
}

/* Completed dot */
.leo-ot-step-d.completed .leo-ot-dot-d {
    background: var(--lot-primary);
    border-color: var(--lot-primary);
}
.leo-ot-step-d.completed .leo-ot-dot-d .leo-ot-check {
    opacity: 1;
}

/* Current dot */
.leo-ot-step-d.current .leo-ot-dot-d {
    background: var(--lot-primary-dark);
    border-color: var(--lot-primary-dark);
    transform: scale(1.3);
    box-shadow: 0 0 0 6px rgba(140, 117, 101, 0.2);
    animation: lotPulseDesktop 2s ease-in-out infinite;
}
.leo-ot-step-d.current .leo-ot-dot-d .leo-ot-check {
    opacity: 1;
}

@keyframes lotPulseDesktop {
    0%, 100% { box-shadow: 0 0 0 6px rgba(140, 117, 101, 0.2); }
    50%      { box-shadow: 0 0 0 12px rgba(140, 117, 101, 0.08); }
}

/* ── Labels (desktop) ── */

.leo-ot-label-d {
    display: block;
    margin-top: 14px;
    font-size: 0.68em;
    color: #bbb;
    white-space: nowrap;
    text-align: left;
    transform: translateX(calc(50% + 3px)) rotate(90deg);
    transform-origin: 0 0;
    transition: transform 0.6s ease, color 0.5s ease;
}

/* Completed (passed) labels: 45° below dot */
.leo-ot-step-d.completed .leo-ot-label-d {
    color: var(--lot-primary-dark);
    transform: translateX(calc(50% + 3px)) rotate(45deg);
}

/* Current (active) label: horizontal ABOVE the dot */
.leo-ot-step-d.current .leo-ot-label-d {
    color: var(--lot-text);
    font-weight: 700;
    font-size: 0.78em;
    position: absolute;
    bottom: 100%;
    margin-bottom: 10px;
    margin-top: 0;
    white-space: nowrap;
    transform: none;
    transform-origin: center center;
    transition: none;
}

/* Future (not passed) labels: 90° below dot (same as default) */
.leo-ot-step-d.future .leo-ot-label-d {
    color: #bbb;
    transform: translateX(calc(50% + 3px)) rotate(90deg);
}

/* Future dot */
.leo-ot-step-d.future .leo-ot-dot-d {
    background: #fff;
    border-color: var(--lot-track-bg);
}

@keyframes lotDotIn {
    from { opacity: 0; transform: translateX(-50%) translateY(8px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ═══════════════════════════════════
   MOBILE: Vertical Stepper
   — line heights set by JS based on %
   ═══════════════════════════════════ */

#leo-ot-progress-mobile {
    display: none;
    padding: 20px 0 10px;
}

.leo-ot-step-m {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    opacity: 0;
    transform: translateX(-20px);
    animation: lotStepSlide 0.5s ease-out forwards;
}

.leo-ot-indicator-m {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    width: 28px;
}

.leo-ot-dot-m {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--lot-track-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.5s;
    flex-shrink: 0;
    z-index: 2;
}

.leo-ot-dot-m .leo-ot-check {
    width: 14px;
    height: 14px;
    opacity: 0;
    color: #fff;
    transition: opacity 0.3s;
}

/* Line between dots — height set by JS */
.leo-ot-line-m {
    width: 3px;
    background: var(--lot-track-bg);
    border-radius: 2px;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.leo-ot-line-fill-m {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 0;
    background: var(--lot-primary);
    border-radius: 2px;
    transition: height 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Label — padding-bottom set by JS */
.leo-ot-label-m {
    font-size: 0.92em;
    line-height: 28px;
    color: var(--lot-text-muted);
    transition: color 0.4s, font-weight 0.4s;
    min-height: 28px;
}

/* Completed step (mobile) */
.leo-ot-step-m.completed .leo-ot-dot-m {
    background: var(--lot-primary);
    border-color: var(--lot-primary);
}
.leo-ot-step-m.completed .leo-ot-dot-m .leo-ot-check {
    opacity: 1;
}
.leo-ot-step-m.completed .leo-ot-line-fill-m {
    height: 100%;
}
.leo-ot-step-m.completed .leo-ot-label-m {
    color: var(--lot-primary-dark);
}

/* Current step (mobile) */
.leo-ot-step-m.current .leo-ot-dot-m {
    background: var(--lot-primary-dark);
    border-color: var(--lot-primary-dark);
    transform: scale(1.15);
    box-shadow: 0 0 0 6px rgba(140, 117, 101, 0.18);
    animation: lotPulseMobile 2s ease-in-out infinite;
}
.leo-ot-step-m.current .leo-ot-dot-m .leo-ot-check {
    opacity: 1;
}
.leo-ot-step-m.current .leo-ot-label-m {
    color: var(--lot-text);
    font-weight: 700;
    font-size: 1em;
}

@keyframes lotPulseMobile {
    0%, 100% { box-shadow: 0 0 0 6px rgba(140, 117, 101, 0.18); }
    50%      { box-shadow: 0 0 0 14px rgba(140, 117, 101, 0.05); }
}

/* Future step (mobile) */
.leo-ot-step-m.future .leo-ot-dot-m {
    background: #fff;
    border-color: var(--lot-track-bg);
}
.leo-ot-step-m.future .leo-ot-label-m {
    color: #c0b8b0;
}

@keyframes lotStepSlide {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ═══════════════════════════════════
   INFO CARD
   ═══════════════════════════════════ */

#leo-ot-info-card {
    background: var(--lot-card-bg);
    border: 1px solid var(--lot-border);
    border-radius: var(--lot-radius);
    padding: 28px 32px;
    margin-top: 28px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.03);
    opacity: 0;
    animation: lotFadeUp 0.5s ease-out 0.4s forwards;
}

.leo-ot-info-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 14px 0;
    border-bottom: 1px solid var(--lot-border);
}
.leo-ot-info-row:last-child {
    border-bottom: none;
}

.leo-ot-info-label {
    font-size: 0.88em;
    font-weight: 600;
    color: var(--lot-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.leo-ot-info-value {
    font-size: 1.05em;
    font-weight: 600;
    color: var(--lot-text);
    text-align: center;
    word-break: break-word;
}

.leo-ot-info-status .leo-ot-info-value {
    font-size: 1.15em;
    color: var(--lot-primary-dark);
}

.leo-ot-info-note .leo-ot-info-value {
    font-weight: 400;
    font-size: 0.95em;
    line-height: 1.6;
    max-width: 400px;
}

/* Back button */
#leo-ot-back-btn {
    display: block;
    margin: 28px auto 0;
    padding: 10px 28px;
    background: transparent;
    border: 2px solid var(--lot-border);
    border-radius: 8px;
    color: var(--lot-text-muted);
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.25s, color 0.25s;
}
#leo-ot-back-btn:hover {
    border-color: var(--lot-primary);
    color: var(--lot-primary-dark);
}

/* ── Hidden messages container ── */
#leo-ot-messages {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

/* ═══════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════ */

@media (max-width: 768px) {
    #leo-ot-wrap {
        margin: 20px auto;
    }

    #leo-ot-form-card {
        padding: 28px 20px;
    }

    .leo-ot-title {
        font-size: 1.3em;
    }

    /* Hide desktop, show mobile */
    #leo-ot-progress-desktop {
        display: none !important;
    }
    #leo-ot-progress-mobile {
        display: block !important;
    }

    /* Info card mobile */
    #leo-ot-info-card {
        padding: 20px;
    }

    .leo-ot-info-row {
        flex-direction: column;
        gap: 4px;
        padding: 12px 0;
    }

    .leo-ot-info-value {
        text-align: left;
    }

    .leo-ot-info-note .leo-ot-info-value {
        max-width: 100%;
    }
}

@media (min-width: 769px) {
    #leo-ot-progress-desktop {
        display: block;
    }
    #leo-ot-progress-mobile {
        display: none;
    }
}

/* ═══════════════════════════════════
   REDUCED MOTION
   ═══════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .leo-ot-track-fill {
        transition: none !important;
    }

    .leo-ot-step-m,
    .leo-ot-step-d {
        opacity: 1 !important;
        transform: none !important;
        animation: none !important;
    }

    #leo-ot-results,
    #leo-ot-info-card {
        opacity: 1 !important;
        transform: none !important;
        animation: none !important;
    }
}
