/* ==========================================================================
   PureLabs HelpCore - Mobile Enterprise Tech Suite ("PureLabs Tech On-The-Go")
   Design System: Light Medical Luxury | Palette: PureLabs Burgundy #990000,
   Slate #0F172A, Ice Blue #F0F9FF, Pure White #FFFFFF. Zero Dark Mode.
   ========================================================================== */

/* ─── Bottom Navigation Bar Fissa (Mobile Ergonomica 1-Hand) ─────────────── */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid #E2E8F0;
    box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.08);
    z-index: 9999 !important;
    pointer-events: auto !important;
    padding: 0 8px;
    box-sizing: border-box;
}

.mobile-bottom-nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-around;
    height: 100%;
    max-width: 540px;
    margin: 0 auto;
}

.mobile-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    outline: none;
    padding: 6px 4px;
    cursor: pointer;
    color: #64748B;
    transition: color 0.18s ease, transform 0.15s ease;
    position: relative;
    border-radius: 8px;
    -webkit-tap-highlight-color: transparent;
}

.mobile-nav-btn:active {
    transform: scale(0.94);
}

.mobile-nav-btn.active {
    color: var(--pure-red, #990000);
}

.mobile-nav-icon-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.mobile-nav-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: -0.2px;
    margin-top: 2px;
}

.mobile-nav-badge {
    position: absolute;
    top: -2px;
    right: -6px;
    background: #DC2626;
    color: #FFFFFF;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.35);
}

/* ─── Regole Viewport Anti-Overflow Orizzontale (Zero Tagli a Destra) ──── */
html, body {
    max-width: 100vw !important;
    overflow-x: hidden !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

*, *::before, *::after {
    box-sizing: border-box !important;
}

/* ─── Media Query per Visualizzazione Mobile (< 768px o .is-mobile-device) ─ */
@media (max-width: 768px), (pointer: coarse) and (max-width: 1024px) {
    .app-sidebar {
        display: none !important;
    }

    .main-content-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .main-container {
        padding: 10px 12px 90px 12px !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }

    .app-view, .director-governance-container {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
    }

    .director-header {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 14px 16px !important;
        gap: 12px !important;
    }

    .director-header > div {
        width: 100% !important;
    }

    .director-header .btn {
        width: 100% !important;
        justify-content: center !important;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px !important;
    }

    .stat-card {
        padding: 10px 12px !important;
        min-width: 0 !important;
    }

    .stat-card .stat-value {
        font-size: 18px !important;
    }

    .director-governance-container div[style*="minmax(320px"] {
        grid-template-columns: 1fr !important;
    }

    table, .table {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .mobile-bottom-nav {
        display: block !important;
    }

    /* Aggiungi padding-bottom al container principale per non coprire il contenuto */
    .app-main-content, #main-content-area, .content-container {
        padding-bottom: 80px !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }

    /* Header compatto mobile */
    .app-topbar {
        display: none !important;
    }

body.is-mobile-device .app-topbar,
body.is-mobile-device footer {
    display: none !important;
}

@media (max-width: 768px) {
    .app-topbar, footer {
        display: none !important;
    }
}

body.is-mobile-device .main-content-wrapper {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

body.is-mobile-device .mobile-bottom-nav {
    display: block !important;
}

/* ─── Card Ticket Mobile-First ───────────────────────────────────────────── */
.mobile-ticket-card {
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 12px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.03);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    position: relative;
    overflow: hidden;
}

.mobile-ticket-card:active {
    transform: scale(0.99);
}

.mobile-ticket-card.is-blocking {
    border-left: 4px solid #DC2626;
    background: linear-gradient(to right, #FEF2F2 0%, #FFFFFF 14%);
}

.mobile-ticket-card.is-high {
    border-left: 4px solid #EA580C;
}

.mobile-ticket-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.mobile-ticket-code {
    font-family: ui-monospace, monospace;
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    background: #F1F5F9;
    padding: 2px 6px;
    border-radius: 4px;
}

.mobile-ticket-title {
    font-size: 15px;
    font-weight: 700;
    color: #0F172A;
    line-height: 1.35;
    margin-bottom: 6px;
}

.mobile-ticket-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #64748B;
    margin-bottom: 10px;
}

.mobile-ticket-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
}

.mobile-ticket-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #F1F5F9;
}

.mobile-action-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.mobile-action-btn:active {
    transform: scale(0.96);
}

.btn-take-charge {
    background: #16A34A;
    color: #FFFFFF;
}

.btn-take-charge:hover {
    background: #15803D;
}

.btn-camera-photo {
    background: #F0F9FF;
    color: #0284C7;
    border: 1px solid #BAE6FD;
}

.btn-camera-photo:hover {
    background: #E0F2FE;
}

.btn-dispatch-nav {
    background: #FEF2F2;
    color: var(--pure-red, #990000);
    border: 1px solid #FECACA;
}

/* ─── Modulo Trasferte & Tracciamento Km On-The-Go ────────────────────────── */
.mobile-travel-card {
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

.travel-step-indicator {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    padding: 12px 14px;
    margin: 12px 0;
}

.travel-step-point {
    display: flex;
    flex-direction: column;
}

.travel-step-label {
    font-size: 11px;
    font-weight: 600;
    color: #64748B;
    text-transform: uppercase;
}

.travel-step-val {
    font-size: 14px;
    font-weight: 700;
    color: #0F172A;
}

.btn-travel-action {
    width: 100%;
    height: 46px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    border: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.btn-travel-start {
    background: linear-gradient(135deg, #0284C7 0%, #0369A1 100%);
    color: #FFFFFF;
}

.btn-travel-arrive {
    background: linear-gradient(135deg, #16A34A 0%, #15803D 100%);
    color: #FFFFFF;
}

/* ─── Sezione Note Spese con Fotocamera ──────────────────────────────────── */
.expense-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    margin-bottom: 8px;
}

.expense-thumb {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid #CBD5E1;
    cursor: pointer;
}

/* ─── Modal Signature Pad Touch Screen a 60 FPS ──────────────────────────── */
.signature-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(8px);
    z-index: 10000 !important;
    pointer-events: auto !important;
    align-items: center;
    justify-content: center;
    padding: 12px;
    box-sizing: border-box;
}

.signature-modal-dialog {
    background: #FFFFFF;
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
}

.signature-modal-header {
    background: #F8FAFC;
    border-bottom: 1px solid #E2E8F0;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.signature-canvas-container {
    background: #FFFFFF;
    position: relative;
    padding: 10px 14px;
}

.signature-canvas {
    width: 100%;
    height: 150px;
    background: #FAFAFA;
    border: 2px dashed #CBD5E1;
    border-radius: 12px;
    cursor: crosshair;
    touch-action: none;
}

.signature-guideline {
    position: absolute;
    bottom: 40px;
    left: 30px;
    right: 30px;
    border-bottom: 1px solid #E2E8F0;
    pointer-events: none;
    text-align: right;
    font-size: 10px;
    color: #94A3B8;
}

.signature-modal-footer {
    padding: 14px 18px;
    background: #F8FAFC;
    border-top: 1px solid #E2E8F0;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ─── Cockpit Presidi Edge Mobile (Chiamata Cellulare Nativa tel:) ────────── */
.mobile-edge-node-card {
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mobile-edge-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.btn-phone-call-native {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    padding: 0 14px;
    border-radius: 8px;
    background: #22C55E;
    color: #FFFFFF;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(34, 197, 94, 0.35);
    transition: background 0.15s ease;
}

.btn-phone-call-native:hover, .btn-phone-call-native:active {
    background: #16A34A;
}
