/* =========================================================
   ATYS App - stile dedicato alla mini-app "Gestione Pratiche"
   Riusa la palette del sito principale (blu/bordeaux dal logo).
   ========================================================= */
:root {
    --atys-blue: #4d7298;
    --atys-blue-dark: #3a5a7a;
    --atys-blue-light: #7095b5;
    --atys-maroon: #7d1f4d;
    --atys-maroon-dark: #5e1739;
    --atys-maroon-light: #a1416f;
    --atys-white: #ffffff;
    --atys-grey: #f5f6f8;
    --atys-dark-text: #2b2b2b;
    --atys-radius: 16px;
    --atys-shadow: 0 10px 30px rgba(43,43,43,0.10);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    margin: 0;
    font-family: 'Poppins', 'Segoe UI', Arial, sans-serif;
    color: var(--atys-dark-text);
    background: var(--atys-grey);
    min-height: 100vh;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-weight: 700; margin: 0 0 .5em 0; }

.app-shell {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--atys-white);
    display: flex;
    flex-direction: column;
    box-shadow: var(--atys-shadow);
}

/* ---- Top bar ---- */
.app-topbar {
    background: linear-gradient(120deg, var(--atys-blue) 0%, var(--atys-maroon) 100%);
    color: #fff;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 20;
}
.app-topbar .back-btn {
    font-size: 1.2rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.15);
    border-radius: 50%;
    flex-shrink: 0;
}
.app-topbar h1 {
    font-size: 1.05rem;
    margin: 0;
    line-height: 1.2;
}
.app-topbar .app-logo-mini {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    object-fit: cover;
    flex-shrink: 0;
}

/* ---- Main content ---- */
.app-main {
    flex: 1;
    padding: 22px 20px 100px;
}

/* ---- Hero on landing ---- */
.app-hero {
    text-align: center;
    padding: 10px 6px 28px;
}
.app-hero img.app-logo-big {
    width: 84px;
    height: 84px;
    border-radius: 20px;
    margin: 0 auto 16px;
    box-shadow: var(--atys-shadow);
}
.app-hero h2 {
    font-size: 1.4rem;
    color: var(--atys-maroon-dark);
}
.app-hero p {
    color: #666;
    font-size: .95rem;
    line-height: 1.5;
}

/* ---- Action cards on landing ---- */
.app-action-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--atys-grey);
    border-radius: var(--atys-radius);
    padding: 18px;
    margin-bottom: 14px;
    border: 1px solid #eceef1;
    transition: transform .15s ease, box-shadow .15s ease;
}
.app-action-card:active { transform: scale(.98); }
.app-action-card .icon-box {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: #fff;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--atys-blue), var(--atys-blue-dark));
}
.app-action-card.maroon .icon-box {
    background: linear-gradient(135deg, var(--atys-maroon), var(--atys-maroon-dark));
}
.app-action-card .content h3 { font-size: 1rem; margin: 0 0 3px; }
.app-action-card .content p { font-size: .82rem; color: #777; margin: 0; }
.app-action-card .chevron { margin-left: auto; color: #bbb; }

/* ---- Install banner ---- */
.install-banner {
    background: #fff8e6;
    border: 1px solid #f4dfa0;
    border-radius: var(--atys-radius);
    padding: 14px 16px;
    font-size: .82rem;
    color: #7a5c00;
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    line-height: 1.5;
}
.install-banner i { font-size: 1.1rem; margin-top: 2px; }

/* ---- Steps indicator ---- */
.step-indicator {
    display: flex;
    justify-content: space-between;
    margin-bottom: 26px;
    padding: 0 4px;
}
.step-indicator .step {
    flex: 1;
    text-align: center;
    position: relative;
    font-size: .72rem;
    color: #aaa;
}
.step-indicator .step .dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e6e8eb;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 6px;
    font-weight: 700;
    font-size: .82rem;
}
.step-indicator .step.active .dot {
    background: var(--atys-maroon);
    color: #fff;
}
.step-indicator .step.done .dot {
    background: var(--atys-blue);
    color: #fff;
}
.step-indicator .step.active { color: var(--atys-maroon-dark); font-weight: 600; }

/* ---- Form ---- */
.app-form-step { display: none; }
.app-form-step.active { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--atys-dark-text);
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 13px 14px;
    border: 1.5px solid #e2e5e9;
    border-radius: 10px;
    font-family: inherit;
    font-size: .95rem;
    background: #fff;
    color: var(--atys-dark-text);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--atys-blue);
}
.form-hint { font-size: .75rem; color: #999; margin-top: 5px; }

/* ---- Document capture ---- */
.doc-capture-card {
    border: 1.5px dashed #d7dbe0;
    border-radius: var(--atys-radius);
    padding: 18px;
    text-align: center;
    margin-bottom: 16px;
    background: var(--atys-grey);
    position: relative;
}
.doc-capture-card.has-image { border-style: solid; border-color: var(--atys-blue-light); background: #fff; }
.doc-capture-card .doc-icon { font-size: 1.8rem; color: var(--atys-blue); margin-bottom: 8px; }
.doc-capture-card h4 { font-size: .92rem; margin: 0 0 4px; }
.doc-capture-card p { font-size: .78rem; color: #888; margin: 0 0 12px; }
.doc-capture-card img.doc-preview {
    max-width: 100%;
    max-height: 160px;
    border-radius: 10px;
    margin: 0 auto 12px;
    object-fit: contain;
}
.doc-capture-card input[type="file"] { display: none; }
.doc-capture-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}
.btn-capture {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--atys-blue);
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 50px;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
}
.btn-capture.retake { background: #fff; color: var(--atys-blue); border: 1.5px solid var(--atys-blue); }
.btn-capture-alt {
    background: #fff;
    color: var(--atys-maroon);
    border: 1.5px solid var(--atys-maroon);
}
.doc-badge-ok {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #1f8a4c;
    color: #fff;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .7rem;
}

/* ---- Summary ---- */
.summary-card {
    background: var(--atys-grey);
    border-radius: var(--atys-radius);
    padding: 16px;
    margin-bottom: 14px;
}
.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e6e8eb;
    font-size: .88rem;
}
.summary-row:last-child { border-bottom: none; }
.summary-row .label { color: #888; }
.summary-row .value { font-weight: 600; text-align: right; }
.summary-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: linear-gradient(120deg, var(--atys-blue) 0%, var(--atys-maroon) 100%);
    border-radius: var(--atys-radius);
    color: #fff;
    margin: 6px 0 20px;
}
.summary-total .label { font-size: .9rem; opacity: .9; }
.summary-total .value { font-size: 1.6rem; font-weight: 700; }

/* ---- Price breakdown (translation service pricing detail) ---- */
.price-breakdown {
    background: var(--atys-grey);
    border-radius: var(--atys-radius);
    padding: 16px;
    margin: 4px 0 14px;
    border: 1px solid #e6e8eb;
}
.price-breakdown h4 {
    font-size: .85rem;
    margin: 0 0 10px;
    color: var(--atys-maroon-dark);
}
.price-breakdown .pb-row {
    display: flex;
    justify-content: space-between;
    font-size: .82rem;
    padding: 6px 0;
    border-bottom: 1px dashed #dfe2e6;
    color: #666;
}
.price-breakdown .pb-row:last-of-type { border-bottom: none; }
.price-breakdown .pb-row .pb-value { font-weight: 600; color: var(--atys-dark-text); }
.price-breakdown .pb-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 12px;
    border-top: 2px solid #e6e8eb;
}
.price-breakdown .pb-total .pb-total-label { font-size: .88rem; font-weight: 700; color: var(--atys-maroon-dark); }
.price-breakdown .pb-total .pb-total-value { font-size: 1.3rem; font-weight: 800; color: var(--atys-maroon-dark); }
.price-breakdown .pb-note { font-size: .72rem; color: #999; margin-top: 8px; line-height: 1.4; }

/* ---- Buttons ---- */
.app-btn {
    display: block;
    width: 100%;
    text-align: center;
    padding: 15px;
    border-radius: 50px;
    font-weight: 600;
    font-size: .98rem;
    border: none;
    cursor: pointer;
    transition: opacity .2s ease, transform .15s ease;
}
.app-btn:active { transform: scale(.98); }
.app-btn-primary { background: var(--atys-maroon); color: #fff; }
.app-btn-outline { background: transparent; color: var(--atys-blue); border: 1.5px solid var(--atys-blue); }
.app-btn[disabled] { opacity: .5; cursor: not-allowed; }
.app-btn-row { display: flex; gap: 12px; margin-top: 22px; }
.app-btn-row .app-btn { flex: 1; }

/* ---- Bottom fixed action ---- */
.app-bottom-bar {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding: 14px 20px;
    border-top: 1px solid #eceef1;
    max-width: 480px;
    margin: 0 auto;
}

/* ---- Tracking page ---- */
.tracking-search {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
}
.tracking-search input {
    flex: 1;
    padding: 13px 14px;
    border: 1.5px solid #e2e5e9;
    border-radius: 10px;
    font-size: .95rem;
    text-transform: uppercase;
}
.tracking-search button {
    background: var(--atys-maroon);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 0 20px;
    font-weight: 600;
    cursor: pointer;
}

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
    display: flex;
    gap: 14px;
    padding-bottom: 26px;
    position: relative;
}
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
    content: '';
    position: absolute;
    left: 13px;
    top: 28px;
    bottom: 0;
    width: 2px;
    background: #e6e8eb;
}
.timeline li:last-child::before { display: none; }
.timeline .t-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e6e8eb;
    color: #aaa;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    flex-shrink: 0;
    z-index: 1;
}
.timeline li.done .t-dot { background: #1f8a4c; color: #fff; }
.timeline li.current .t-dot { background: var(--atys-maroon); color: #fff; }
.timeline .t-content h4 { font-size: .92rem; margin: 0 0 3px; }
.timeline .t-content p { font-size: .8rem; color: #888; margin: 0; }
.timeline li.done .t-content h4, .timeline li.current .t-content h4 { color: var(--atys-dark-text); }
.timeline li:not(.done):not(.current) .t-content h4 { color: #bbb; }

.tracking-order-card {
    background: var(--atys-grey);
    border-radius: var(--atys-radius);
    padding: 18px;
    margin-bottom: 24px;
}
.tracking-order-card .order-number {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--atys-maroon-dark);
}
.status-pill {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
}
.status-pill.paid { background: #e2f6ea; color: #1f8a4c; }
.status-pill.pending { background: #fff3d6; color: #8a6d1f; }
.status-pill.failed, .status-pill.cancelled { background: #fbe4e4; color: #a12b2b; }
.status-pill.refunded { background: #e6e8ee; color: #555; }

.tracking-empty, .tracking-error {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}
.tracking-empty i, .tracking-error i { font-size: 2rem; margin-bottom: 12px; display: block; color: #ccc; }

/* ---- Grazie page ---- */
.thankyou-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #e2f6ea;
    color: #1f8a4c;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    margin: 10px auto 20px;
}
.tracking-code-box {
    background: linear-gradient(120deg, var(--atys-blue) 0%, var(--atys-maroon) 100%);
    color: #fff;
    border-radius: var(--atys-radius);
    padding: 22px;
    text-align: center;
    margin: 20px 0;
}
.tracking-code-box .label { font-size: .78rem; opacity: .85; margin-bottom: 6px; }
.tracking-code-box .code { font-size: 1.8rem; font-weight: 700; letter-spacing: 2px; }
.copy-hint { font-size: .75rem; text-align: center; color: #888; margin-top: -10px; margin-bottom: 20px; }

/* ---- Admin ---- */
.admin-warning-app {
    background: #fff3d6;
    border: 1.5px solid #f0c93a;
    border-radius: var(--atys-radius);
    padding: 16px;
    font-size: .82rem;
    color: #7a5c00;
    margin-bottom: 22px;
    line-height: 1.5;
}
.admin-warning-app strong { color: #5c4400; }
.order-admin-card {
    background: var(--atys-grey);
    border-radius: var(--atys-radius);
    padding: 16px;
    margin-bottom: 14px;
}
.order-admin-card .oa-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
}
.order-admin-card .oa-head strong { font-size: .95rem; }
.order-admin-card .oa-meta { font-size: .78rem; color: #888; margin-bottom: 10px; }
.order-admin-card .oa-row { display: flex; gap: 10px; margin-bottom: 8px; }
.order-admin-card select {
    flex: 1;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1.5px solid #e2e5e9;
    font-size: .82rem;
    background: #fff;
}
.order-admin-card .oa-docs { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.order-admin-card .oa-docs img { width: 62px; height: 62px; object-fit: cover; border-radius: 8px; border: 1px solid #ddd; }
.order-admin-card .save-btn {
    margin-top: 10px;
    width: 100%;
    background: var(--atys-blue);
    color: #fff;
    border: none;
    padding: 10px;
    border-radius: 8px;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
}
.admin-filter-bar { display: flex; gap: 8px; margin-bottom: 18px; overflow-x: auto; padding-bottom: 4px; }
.admin-filter-bar button {
    flex-shrink: 0;
    padding: 8px 14px;
    border-radius: 50px;
    border: 1.5px solid #e2e5e9;
    background: #fff;
    font-size: .8rem;
    cursor: pointer;
    white-space: nowrap;
}
.admin-filter-bar button.active { background: var(--atys-maroon); color: #fff; border-color: var(--atys-maroon); }

.spinner-block { text-align: center; padding: 40px 0; color: #aaa; }

/* ---- Responsive: wider screens center the phone-shell like a mockup ---- */
@media (min-width: 560px) {
    body { background: #e9ebee; padding: 24px 0; }
    .app-shell { border-radius: 24px; overflow: hidden; min-height: auto; }
}
