/* ===== TRACKING PAGE — Conforme al design MASTRO ===== */

:root {
    /* Palette dal sito principale */
    --c-bg: #0d0c0b;
    --c-bg-alt: #131210;
    --c-bg-card: #191714;
    --c-border: rgba(255, 255, 255, 0.07);
    --c-border-hi: rgba(255, 255, 255, 0.15);
    --c-ink: #f2ede6;
    --c-ink-2: rgba(242, 237, 230, 0.45);
    --c-ink-3: rgba(242, 237, 230, 0.22);
    --c-accent: #e05c1a;
    --c-accent-lo: rgba(224, 92, 26, 0.12);
    --c-shadow: rgba(0, 0, 0, 0.7);
    --c-green: #22c55e;
    --c-green-lo: rgba(34, 197, 94, 0.12);
    --c-green-border: rgba(34, 197, 94, 0.25);
    --radius: 6px;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: 'DM Mono', monospace;
    background: var(--c-bg);
    color: var(--c-ink);
    min-height: 100vh;
}

/* ===== CONTAINER ===== */
.tracking-container {
    padding: 16px;
    max-width: 720px;
    margin: 0 auto;
}

/* ===== SEARCH CARD ===== */
.search-card {
    background: var(--c-bg-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
}

.search-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.2rem;
    letter-spacing: 0.04em;
    color: var(--c-ink);
    margin-bottom: 16px;
}

.search-title svg {
    stroke: var(--c-accent);
}

.search-input-wrap {
    display: flex;
    gap: 10px;
}

.search-input-wrap input {
    flex: 1;
    min-width: 0;
    padding: 12px 16px;
    border: 1px solid var(--c-border-hi);
    border-radius: 3px;
    font-family: 'DM Mono', monospace;
    font-size: 16px;
    font-weight: 300;
    outline: none;
    transition: border-color 0.2s;
    color: var(--c-ink);
    background: var(--c-bg);
    -webkit-appearance: none;
}

.search-input-wrap input::placeholder {
    color: var(--c-ink-3);
}

.search-input-wrap input:focus {
    border-color: var(--c-accent);
}

.search-input-wrap button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 24px;
    background: var(--c-accent);
    color: #fff;
    border: none;
    border-radius: 3px;
    font-family: 'DM Mono', monospace;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 0.25s var(--ease-out), box-shadow 0.25s, filter 0.2s;
    white-space: nowrap;
}

.search-input-wrap button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(224, 92, 26, 0.3);
    filter: brightness(1.08);
}

.search-input-wrap button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ===== ERROR ===== */
.error-msg {
    display: none;
    background: rgba(220, 38, 38, 0.1);
    color: #f87171;
    border: 1px solid rgba(220, 38, 38, 0.2);
    padding: 12px 16px;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 300;
    margin-top: 12px;
    text-align: center;
}
.error-msg.visible { display: block; }

/* ===== RESULT SECTION ===== */
.result-section {
    display: none;
    animation: fadeIn 0.35s var(--ease-out);
}
.result-section.visible { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== PRATICA CARD ===== */
.pratica-card {
    background: var(--c-bg-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 28px 24px 24px;
    margin-bottom: 16px;
    overflow: hidden;
}

.pratica-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.pratica-info {
    display: flex;
    flex-direction: column;
}

.pratica-label {
    font-size: 0.55rem;
    font-weight: 500;
    color: var(--c-ink-3);
    text-transform: uppercase;
    letter-spacing: 0.2em;
}

.pratica-codice {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 2.2rem;
    color: var(--c-ink);
    line-height: 1.1;
    margin: 4px 0 6px;
    letter-spacing: 0.04em;
}

.pratica-date {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 300;
    color: var(--c-ink-3);
}

.pratica-date::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='rgba(242,237,230,0.22)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E") no-repeat center;
}

/* ===== STATO BADGE ===== */
.pratica-stato-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--c-green-lo);
    border: 1px solid var(--c-green-border);
    border-radius: 3px;
    padding: 12px 16px;
    max-width: 280px;
}

.pratica-stato-badge.in-progress {
    background: var(--c-accent-lo);
    border-color: rgba(224, 92, 26, 0.25);
}

.badge-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.badge-title {
    display: block;
    font-family: 'DM Mono', monospace;
    font-size: 0.65rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--c-green);
}

.pratica-stato-badge.in-progress .badge-title {
    color: var(--c-accent);
}

.badge-desc {
    display: block;
    font-size: 0.72rem;
    font-weight: 300;
    color: var(--c-ink-2);
    line-height: 1.3;
    margin-top: 2px;
}

/* ===== STEPPER ===== */
.stepper {
    position: relative;
    display: flex;
    justify-content: space-between;
    padding: 0 4px;
}

.stepper-line {
    position: absolute;
    top: 36px;
    left: 40px;
    right: 40px;
    height: 3px;
    background: var(--c-border-hi);
    border-radius: 2px;
    z-index: 0;
}

.stepper-line-fill {
    height: 100%;
    background: var(--c-green);
    border-radius: 2px;
    transition: width 0.6s var(--ease-out);
    width: 0;
}

.stepper-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
    flex: 1;
}

.step-num {
    font-family: 'DM Mono', monospace;
    font-size: 0.6rem;
    font-weight: 500;
    color: var(--c-ink-3);
    margin-bottom: 6px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--c-border-hi);
    border-radius: 3px;
}

.stepper-step.completed .step-num,
.stepper-step.active .step-num {
    border-color: var(--c-green);
    color: var(--c-green);
    background: var(--c-green-lo);
}

.step-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--c-border-hi);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    transition: all 0.3s var(--ease-out);
}

.step-icon {
    display: block;
    width: 20px;
    height: 20px;
}

/* Stato default: cerchio grigio */
.stepper-step .step-icon {
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='rgba(242,237,230,0.22)' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3C/svg%3E") no-repeat center;
}

/* Completato: check verde */
.stepper-step.completed .step-circle {
    background: var(--c-green);
}
.stepper-step.completed .step-icon {
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") no-repeat center;
}

/* Attivo: cerchio accent con alone */
.stepper-step.active .step-circle {
    background: var(--c-accent);
    box-shadow: 0 0 0 8px var(--c-accent-lo);
}
.stepper-step.active .step-icon {
    width: 24px;
    height: 24px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M18.92 6.01C18.72 5.42 18.16 5 17.5 5h-11c-.66 0-1.21.42-1.42 1.01L3 12v8c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-1h12v1c0 .55.45 1 1 1h1c.55 0 1-.45 1-1v-8l-2.08-5.99zM6.5 16C5.67 16 5 15.33 5 14.5S5.67 13 6.5 13 8 13.67 8 14.5 7.33 16 6.5 16zm11 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zM5 11l1.5-4.5h11L19 11H5z'/%3E%3C/svg%3E") no-repeat center / contain;
}

.step-label {
    font-family: 'DM Mono', monospace;
    font-size: 0.65rem;
    font-weight: 400;
    color: var(--c-ink-3);
    text-align: center;
    max-width: 80px;
    line-height: 1.25;
}

.stepper-step.completed .step-label,
.stepper-step.active .step-label {
    color: var(--c-ink);
}

.step-status {
    font-size: 0.6rem;
    font-weight: 300;
    color: var(--c-ink-3);
    margin-top: 2px;
}

.stepper-step.completed .step-status {
    color: var(--c-green);
}

.stepper-step.active .step-status {
    color: var(--c-accent);
    font-weight: 500;
}

/* ===== INFO CARD ===== */
.info-card {
    background: var(--c-bg-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 12px;
}

.info-main {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 24px;
    background: var(--c-green-lo);
    border-bottom: 1px solid var(--c-green-border);
}

.info-icon-wrap {
    width: 52px;
    height: 52px;
    background: var(--c-green);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.info-icon-wrap svg {
    stroke: white;
}

.info-title {
    font-family: 'DM Mono', monospace;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--c-green);
    display: block;
}

.info-desc {
    font-size: 0.75rem;
    font-weight: 300;
    color: var(--c-ink-2);
    line-height: 1.5;
    margin-top: 3px;
}

.info-details {
    display: flex;
    gap: 0;
}

.info-detail {
    flex: 1;
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    align-items: flex-start;
}

.info-detail + .info-detail {
    border-left: 1px solid var(--c-border);
}

.info-detail-icon {
    width: 34px;
    height: 34px;
    background: var(--c-green-lo);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.info-detail-icon svg {
    stroke: var(--c-green);
}

.info-detail strong {
    font-family: 'DM Mono', monospace;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--c-ink);
    display: block;
    margin-bottom: 3px;
}

.info-detail p {
    font-size: 0.72rem;
    font-weight: 300;
    color: var(--c-ink-2);
    line-height: 1.5;
    margin: 0;
    white-space: pre-line;
}

.info-detail a {
    color: var(--c-accent);
    text-decoration: none;
    font-weight: 500;
}

.info-detail a:hover {
    text-decoration: underline;
}

/* ===== FOOTER BAR ===== */
.footer-bar {
    background: var(--c-bg-card);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.footer-msg {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 300;
    color: var(--c-ink-2);
    flex: 1;
}

.footer-msg svg {
    stroke: var(--c-accent);
}

.footer-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--c-accent);
    font-family: 'DM Mono', monospace;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-decoration: none;
    padding: 8px 16px;
    border: 1px solid var(--c-border-hi);
    border-radius: 3px;
    transition: all 0.2s var(--ease-out);
    white-space: nowrap;
}

.footer-link:hover {
    border-color: var(--c-accent);
    background: var(--c-accent-lo);
}

/* ===== BACK LINK ===== */
.back-link {
    display: block;
    text-align: center;
    margin-top: 20px;
    margin-bottom: 12px;
    color: var(--c-ink-3);
    font-size: 0.72rem;
    font-weight: 300;
    letter-spacing: 0.08em;
    text-decoration: none;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--c-accent);
}

/* ===== MOBILE ===== */
@media (max-width: 600px) {
    .tracking-container {
        padding: 10px;
    }

    .search-card {
        padding: 16px;
    }

    .pratica-card {
        padding: 20px 16px 16px;
    }

    .pratica-card-top {
        flex-direction: column;
        margin-bottom: 24px;
    }

    .pratica-stato-badge {
        max-width: 100%;
    }

    .pratica-codice {
        font-size: 1.8rem;
    }

    .stepper {
        padding: 0;
    }

    .step-circle {
        width: 32px;
        height: 32px;
    }

    .step-icon {
        width: 14px;
        height: 14px;
    }

    .stepper-step.active .step-icon {
        width: 18px;
        height: 18px;
    }

    .step-num {
        width: 16px;
        height: 16px;
        font-size: 0.5rem;
        border-width: 1.5px;
        border-radius: 2px;
        margin-bottom: 4px;
    }

    .stepper-line {
        top: 27px;
        left: 20px;
        right: 20px;
        height: 3px;
    }

    .step-label {
        font-size: 0.55rem;
        max-width: 56px;
    }


    .step-status {
        font-size: 0.5rem;
    }

    .stepper-step.active .step-circle {
        box-shadow: 0 0 0 5px var(--c-accent-lo);
    }

    .info-main {
        padding: 16px;
    }

    .info-details {
        flex-direction: column;
    }

    .info-detail + .info-detail {
        border-left: none;
        border-top: 1px solid var(--c-border);
    }

    .footer-bar {
        flex-direction: column;
        text-align: center;
        padding: 14px 16px;
    }

    .footer-link {
        width: 100%;
        justify-content: center;
    }
}

/* ===== DESKTOP ===== */
@media (min-width: 768px) {
    .tracking-container {
        padding: 32px 20px;
    }

    .search-card {
        padding: 28px 32px;
    }

    .pratica-card {
        padding: 32px;
    }

    .step-circle {
        width: 50px;
        height: 50px;
    }

    .step-icon {
        width: 22px;
        height: 22px;
    }

    .stepper-line {
        top: 40px;
    }

    .step-label {
        font-size: 0.72rem;
        max-width: 100px;
    }
}
