/* ============================================================
   NewAssistance - Stili Telegram Mini App (responsive)
   ============================================================ */

:root {
    --na-primary: #2481cc;
    --na-bg: #0f1620;
    --na-card: #18222f;
    --na-border: #26333f;
    --na-text: #e8edf2;
    --na-muted: #8a97a8;
}

* { -webkit-tap-highlight-color: transparent; }

.miniapp-body {
    background: var(--tg-theme-bg-color, var(--na-bg));
    color: var(--na-text);
    min-height: 100vh;
    margin: 0;
    padding-bottom: 24px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Header */
.miniapp-header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(15, 22, 32, 0.85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--na-border);
}
.miniapp-title {
    font-size: 1.1rem;
    font-weight: 600;
    flex: 1;
    text-align: center;
}
.btn-back, .header-spacer {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-back {
    color: var(--na-text);
    background: var(--na-card);
    border-radius: 50%;
    text-decoration: none;
    transition: background 0.2s;
}
.btn-back:active { background: var(--na-border); }

.miniapp-main {
    padding: 20px 16px;
    max-width: 640px;
    margin: 0 auto;
}

/* Overlay auth */
.overlay-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--na-bg);
    z-index: 2000;
    padding: 24px;
}

/* Gate numero server */
.gate-screen {
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.gate-card {
    width: 100%;
    max-width: 360px;
    background: var(--na-card);
    border: 1px solid var(--na-border);
    border-radius: 20px;
    padding: 32px 24px;
}
.gate-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
}

/* Home */
.home-hero {
    padding: 24px 0 8px;
}
.home-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 8px;
}
.home-appname {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0;
}
.home-welcome {
    color: var(--na-muted);
    margin-top: 4px;
}
.home-cards {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 24px;
}
.home-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px;
    background: var(--na-card);
    border: 1px solid var(--na-border);
    border-radius: 18px;
    text-decoration: none;
    color: var(--na-text);
    transition: transform 0.15s, border-color 0.15s;
}
.home-card:active {
    transform: scale(0.98);
    border-color: var(--na-primary);
}
.home-card-icon {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #fff;
    flex-shrink: 0;
}
.home-card-body { flex: 1; }
.home-card-title { font-weight: 600; font-size: 1.05rem; }
.home-card-sub { color: var(--na-muted); font-size: 0.85rem; }
.home-card-arrow { color: var(--na-muted); }
.home-footer { margin-top: 28px; }

/* Page intro */
.page-intro { text-align: center; margin-bottom: 24px; }
.page-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 12px;
}
.page-title { font-size: 1.4rem; font-weight: 700; margin: 0; }
.page-sub { color: var(--na-muted); font-size: 0.9rem; margin-top: 4px; }

/* Form */
.na-form .form-control, .na-form .form-select,
.form-control, .form-select {
    background: var(--na-card);
    border: 1px solid var(--na-border);
    color: var(--na-text);
    border-radius: 12px;
    padding: 12px 14px;
}
.form-control:focus, .form-select:focus {
    background: var(--na-card);
    color: var(--na-text);
    border-color: var(--na-primary);
    box-shadow: 0 0 0 0.2rem rgba(36, 129, 204, 0.2);
}
.form-label { font-size: 0.88rem; color: var(--na-muted); margin-bottom: 6px; }
.btn-primary {
    background: var(--na-primary);
    border-color: var(--na-primary);
    border-radius: 12px;
    font-weight: 600;
    padding: 12px;
}

/* Section heading */
.section-heading {
    font-size: 1rem;
    font-weight: 600;
    margin: 24px 0 12px;
    color: var(--na-text);
}

/* Liste */
.list-stack { display: flex; flex-direction: column; gap: 10px; }
.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: var(--na-card);
    border: 1px solid var(--na-border);
    border-radius: 14px;
}
.list-item-link { text-decoration: none; color: var(--na-text); transition: border-color 0.15s; }
.list-item-link:active { border-color: var(--na-primary); }
.list-item-title { font-weight: 600; font-size: 0.95rem; }
.list-item-sub { color: var(--na-muted); font-size: 0.82rem; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--na-muted);
}
.empty-state i { font-size: 2.4rem; margin-bottom: 12px; opacity: 0.6; }

/* App list */
.app-list { display: flex; flex-direction: column; gap: 16px; }
.app-card {
    background: var(--na-card);
    border: 1px solid var(--na-border);
    border-radius: 18px;
    padding: 18px;
}
.app-card-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.app-logo {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    object-fit: cover;
    flex-shrink: 0;
}
.app-logo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--na-border);
    color: var(--na-muted);
    font-size: 1.4rem;
}
.app-name { font-weight: 600; font-size: 1.1rem; }
.app-desc { color: var(--na-muted); font-size: 0.85rem; }
.app-code {
    background: #0f1620;
    border: 1px solid var(--na-border);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
}
.app-code-label { font-size: 0.75rem; color: var(--na-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.app-code-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; }
.app-code-row code { font-size: 1.05rem; color: var(--na-primary); font-weight: 600; }
.app-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.app-instructions { margin-top: 12px; }
.app-instructions summary { cursor: pointer; color: var(--na-muted); font-size: 0.9rem; }
.app-instructions-body { margin-top: 8px; font-size: 0.88rem; color: var(--na-text); }

/* Ticket / chat */
.ticket-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: var(--na-card);
    border: 1px solid var(--na-border);
    border-radius: 14px;
    margin-bottom: 16px;
}
.ticket-subject { font-weight: 600; }
.ticket-cat { color: var(--na-muted); font-size: 0.82rem; }

.chat-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}
.chat-msg { display: flex; }
.chat-user { justify-content: flex-end; }
.chat-admin { justify-content: flex-start; }
.chat-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.92rem;
    word-break: break-word;
}
.chat-user .chat-bubble {
    background: var(--na-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-admin .chat-bubble {
    background: var(--na-card);
    border: 1px solid var(--na-border);
    border-bottom-left-radius: 4px;
}
.chat-time { font-size: 0.68rem; opacity: 0.7; margin-top: 4px; }
.chat-image { max-width: 200px; border-radius: 10px; margin-top: 6px; display: block; }

/* Barra risposta */
.reply-bar {
    position: sticky;
    bottom: 0;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 0;
    background: var(--na-bg);
}
.reply-bar textarea { flex: 1; resize: none; }
.reply-attach {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--na-card);
    border: 1px solid var(--na-border);
    border-radius: 12px;
    color: var(--na-muted);
    cursor: pointer;
    flex-shrink: 0;
}

/* Profilo */
.profile-card { text-align: center; padding: 24px 0; }
.profile-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--na-primary);
}
.profile-avatar-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--na-card);
    color: var(--na-muted);
    font-size: 2.4rem;
}
.profile-name { font-size: 1.4rem; font-weight: 700; margin: 12px 0 0; }
.profile-username { color: var(--na-muted); }
.profile-stats { display: flex; gap: 12px; margin-top: 8px; }
.profile-stat {
    flex: 1;
    background: var(--na-card);
    border: 1px solid var(--na-border);
    border-radius: 14px;
    padding: 16px;
    text-align: center;
}
.profile-stat-value { font-size: 1.6rem; font-weight: 700; color: var(--na-primary); }
.profile-stat-label { color: var(--na-muted); font-size: 0.82rem; }

code { background: rgba(0,0,0,0.25); padding: 2px 6px; border-radius: 6px; }
