/**
 * Flixpost Tracking widget styles.
 *
 * The widget is a self-contained block: every colour is derived from custom
 * properties on the .fpt root so a theme can restyle it without overrides.
 */

.fpt {
    --fpt-accent: #4ec5f2;
    --fpt-accent-soft: rgba(78, 197, 242, 0.16);
    --fpt-card-bg: rgba(255, 255, 255, 0.06);
    --fpt-card-border: rgba(255, 255, 255, 0.13);
    --fpt-field-bg: rgba(255, 255, 255, 0.05);
    --fpt-field-border: rgba(255, 255, 255, 0.16);
    --fpt-text: #ffffff;
    --fpt-muted: rgba(255, 255, 255, 0.55);
    --fpt-line: rgba(255, 255, 255, 0.1);
    --fpt-success: #4ade80;
    --fpt-danger: #fb7185;
    --fpt-radius: 22px;

    box-sizing: border-box;
    width: 100%;
    margin-inline: auto;
    color: var(--fpt-text);
    font-size: 15px;
    line-height: 1.6;
}

.fpt *,
.fpt *::before,
.fpt *::after {
    box-sizing: inherit;
}

.fpt-theme-light {
    --fpt-card-bg: rgba(15, 23, 42, 0.04);
    --fpt-card-border: rgba(15, 23, 42, 0.1);
    --fpt-field-bg: #ffffff;
    --fpt-field-border: rgba(15, 23, 42, 0.14);
    --fpt-text: #0f172a;
    --fpt-muted: rgba(15, 23, 42, 0.55);
    --fpt-line: rgba(15, 23, 42, 0.1);
    --fpt-success: #15803d;
    --fpt-danger: #be123c;
}

@media (prefers-color-scheme: light) {
    .fpt-theme-auto {
        --fpt-card-bg: rgba(15, 23, 42, 0.04);
        --fpt-card-border: rgba(15, 23, 42, 0.1);
        --fpt-field-bg: #ffffff;
        --fpt-field-border: rgba(15, 23, 42, 0.14);
        --fpt-text: #0f172a;
        --fpt-muted: rgba(15, 23, 42, 0.55);
        --fpt-line: rgba(15, 23, 42, 0.1);
        --fpt-success: #15803d;
        --fpt-danger: #be123c;
    }
}

/* Cards
   ------------------------------------------------------------------------ */

.fpt-card {
    background: var(--fpt-card-bg);
    border: 1px solid var(--fpt-card-border);
    border-radius: var(--fpt-radius);
    padding: 26px 28px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.fpt-card + .fpt-card,
.fpt-message + .fpt-card {
    margin-top: 18px;
}

/* Head
   ------------------------------------------------------------------------ */

.fpt-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
}

.fpt-head-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    color: var(--fpt-accent);
}

.fpt-head-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.fpt-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--fpt-text);
}

/* Form
   ------------------------------------------------------------------------ */

.fpt-form {
    display: flex;
    align-items: stretch;
    gap: 14px;
}

.fpt-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 58px;
    padding: 0 20px;
    border-radius: 14px;
    border: 1px solid var(--fpt-field-border);
    background: var(--fpt-field-bg);
    color: var(--fpt-text);
    font: inherit;
    font-size: 15px;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.fpt-input::placeholder {
    color: var(--fpt-muted);
    letter-spacing: 0.04em;
}

.fpt-input:focus {
    border-color: var(--fpt-accent);
    box-shadow: 0 0 0 3px var(--fpt-accent-soft);
}

.fpt-btn {
    position: relative;
    flex: 0 0 auto;
    min-width: 168px;
    height: 58px;
    padding: 0 28px;
    border: 0;
    border-radius: 14px;
    background: var(--fpt-accent);
    color: #ffffff;
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: filter 0.18s ease, transform 0.18s ease;
}

.fpt-btn:hover {
    filter: brightness(1.08);
}

.fpt-btn:active {
    transform: translateY(1px);
}

.fpt-btn:disabled {
    cursor: default;
    opacity: 0.75;
}

.fpt-spinner {
    display: none;
    position: absolute;
    inset: 0;
    margin: auto;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: fpt-spin 0.7s linear infinite;
}

.fpt.is-loading .fpt-btn-text {
    visibility: hidden;
}

.fpt.is-loading .fpt-spinner {
    display: block;
}

@keyframes fpt-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .fpt-spinner {
        animation-duration: 2s;
    }
}

/* Stats
   ------------------------------------------------------------------------ */

.fpt-stats {
    display: flex;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--fpt-line);
}

.fpt-stat {
    flex: 1 1 0;
    text-align: center;
    padding: 0 12px;
}

.fpt-stat + .fpt-stat {
    border-inline-start: 1px solid var(--fpt-line);
}

.fpt-stat-value {
    color: var(--fpt-accent);
    font-size: 21px;
    font-weight: 700;
    line-height: 1.3;
}

.fpt-stat-label {
    margin-top: 4px;
    color: var(--fpt-muted);
    font-size: 13px;
    letter-spacing: 0.05em;
}

/* Message
   ------------------------------------------------------------------------ */

.fpt-message {
    margin-top: 18px;
    padding: 14px 20px;
    border-radius: 14px;
    border: 1px solid var(--fpt-field-border);
    background: var(--fpt-card-bg);
    color: var(--fpt-text);
    font-size: 14px;
}

.fpt-message.is-error {
    border-color: rgba(251, 113, 133, 0.4);
    color: var(--fpt-danger);
}

/* Result grid
   ------------------------------------------------------------------------ */

.fpt-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 24px 20px;
}

.fpt-cell-wide {
    grid-column: span 2;
}

.fpt-label {
    color: var(--fpt-muted);
    font-size: 13px;
    line-height: 1.5;
}

.fpt-value {
    margin-top: 6px;
    color: var(--fpt-text);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

/* The tracking number and money values are Latin-ordered runs: they are laid
   out LTR and aligned to the reading edge so "#67300..." and "USD 2,450.00"
   never get reordered by the bidi algorithm inside an RTL card. */

.fpt-cell-code .fpt-value {
    direction: ltr;
    letter-spacing: 0.02em;
}

.fpt[dir="rtl"] .fpt-cell-code .fpt-value {
    text-align: right;
}

.fpt-state {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--fpt-accent);
}

.fpt[dir="rtl"] .fpt-state {
    flex-direction: row-reverse;
}

.fpt-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    flex: 0 0 8px;
}

.fpt-cell.is-success .fpt-state {
    color: var(--fpt-success);
}

.fpt-cell.is-danger .fpt-state {
    color: var(--fpt-danger);
}

.fpt-cell.is-neutral .fpt-state {
    color: var(--fpt-muted);
}

.fpt-money {
    display: flex;
    align-items: baseline;
    gap: 6px;
    direction: ltr;
    justify-content: flex-start;
}

.fpt[dir="rtl"] .fpt-money {
    justify-content: flex-end;
}

.fpt-money-currency {
    font-weight: 500;
    opacity: 0.85;
}

.fpt-cell.is-empty {
    display: none;
}

/* Responsive
   ------------------------------------------------------------------------ */

@media (max-width: 900px) {
    .fpt-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .fpt-card {
        padding: 22px 18px;
    }

    .fpt-form {
        flex-direction: column;
    }

    .fpt-btn {
        width: 100%;
        min-width: 0;
    }

    .fpt-stats {
        flex-wrap: wrap;
        gap: 16px 0;
    }

    .fpt-stat {
        flex: 1 1 50%;
    }

    .fpt-stat:nth-child(3) {
        flex-basis: 100%;
        border-inline-start: 0;
    }

    .fpt-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 18px;
    }

    .fpt-cell-wide {
        grid-column: span 1;
    }
}
