/* ========================================
   ARRIVALS REDESIGN 2026 - OSPITAMENTE
   Clean, modern, mobile-first
======================================== */

:root {
    --arr-bg: #f8f9fc;
    --arr-surface: #ffffff;
    --arr-border: #e8ecf1;
    --arr-border-light: #f0f2f5;
    --arr-text: #1a1f36;
    --arr-text-secondary: #6b7280;
    --arr-text-muted: #9ca3af;
    --arr-accent: #3b82f6;
    --arr-accent-light: #eff6ff;
    --arr-green: #10b981;
    --arr-green-light: #d1fae5;
    --arr-blue: #3b82f6;
    --arr-blue-light: #dbeafe;
    --arr-orange: #f59e0b;
    --arr-orange-light: #fef3c7;
    --arr-red: #ef4444;
    --arr-radius: 10px;
    --arr-radius-sm: 6px;
    --arr-shadow: 0 1px 3px rgba(0,0,0,0.06);
    --arr-shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --arr-font: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ============================================
   BASE
============================================ */
.arr-module {
    background: var(--arr-bg);
    font-family: var(--arr-font);
}

/* ============================================
   TOP BAR
============================================ */
.arr-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--arr-surface);
    border-bottom: 1px solid var(--arr-border);
}

.arr-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--arr-text);
    margin: 0;
}

.arr-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.arr-date {
    padding: 8px 12px;
    border: 1px solid var(--arr-border);
    border-radius: 8px;
    font-size: 13px;
    font-family: var(--arr-font);
    color: var(--arr-text);
    outline: none;
}

.arr-date:focus {
    border-color: var(--arr-accent);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.arr-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--arr-border);
    border-radius: 8px;
    background: var(--arr-surface);
    color: var(--arr-text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--arr-font);
}

.arr-btn:hover { background: var(--arr-border-light); }

.arr-btn-accent {
    background: var(--arr-accent);
    color: white;
    border-color: var(--arr-accent);
}

.arr-btn-accent:hover { background: #2563eb; }

.arr-btn-green {
    background: var(--arr-green);
    color: white;
    border-color: var(--arr-green);
}

.arr-btn-green:hover { background: #059669; }

.arr-btn-orange {
    background: var(--arr-orange);
    color: white;
    border-color: var(--arr-orange);
}

.arr-btn-orange:hover { background: #d97706; }

.arr-btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.arr-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   STATS
============================================ */
.arr-stats {
    display: flex;
    gap: 12px;
    padding: 14px 20px;
    background: var(--arr-surface);
    border-bottom: 1px solid var(--arr-border);
}

.arr-stat {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border-radius: 12px;
    flex: 1;
    min-width: 0;
}

.arr-stat-green { background: var(--arr-green-light); }
.arr-stat-blue { background: var(--arr-blue-light); }
.arr-stat-orange { background: var(--arr-orange-light); }

.arr-stat-num {
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
}

.arr-stat-green .arr-stat-num { color: #065f46; }
.arr-stat-blue .arr-stat-num { color: #1e40af; }
.arr-stat-orange .arr-stat-num { color: #92400e; }

.arr-stat-lbl {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.arr-stat-green .arr-stat-lbl { color: #065f46; }
.arr-stat-blue .arr-stat-lbl { color: #1e40af; }
.arr-stat-orange .arr-stat-lbl { color: #92400e; }

/* ============================================
   SEZIONI
============================================ */
.arr-section {
    margin: 12px 16px;
    background: var(--arr-surface);
    border-radius: var(--arr-radius);
    border: 1px solid var(--arr-border);
    overflow: hidden;
}

.arr-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    color: white;
}

.arr-hdr-green { background: var(--arr-green); }
.arr-hdr-blue { background: var(--arr-blue); }
.arr-hdr-orange { background: var(--arr-orange); }

/* ============================================
   TABELLA DESKTOP
============================================ */
.arr-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

.arr-table thead th {
    background: var(--arr-bg);
    color: var(--arr-text-secondary);
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--arr-border);
}

.arr-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--arr-border-light);
    vertical-align: middle;
    color: var(--arr-text);
}

.arr-table tbody tr:hover {
    background: var(--arr-accent-light);
}

.arr-table tbody tr:last-child td {
    border-bottom: none;
}

.arr-guest-name {
    font-weight: 600;
    color: var(--arr-text);
    display: block;
}

.arr-guest-email {
    font-size: 11px;
    color: var(--arr-text-muted);
}

.arr-room-num {
    font-weight: 700;
    font-size: 15px;
    color: var(--arr-text);
}

.arr-cleaning-badge {
    display: inline-flex;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    margin-top: 2px;
}

.arr-clean { background: #d1fae5; color: #065f46; }
.arr-dirty { background: #fee2e2; color: #991b1b; }
.arr-progress { background: #fef3c7; color: #92400e; }
.arr-inspected { background: #dbeafe; color: #1e40af; }

.arr-inhouse-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    background: var(--arr-blue-light);
    color: #1e40af;
    font-size: 11px;
    font-weight: 600;
}

/* ============================================
   CARDS MOBILE
============================================ */
.arr-cards {
    padding: 8px;
}

.arr-card {
    background: var(--arr-surface);
    border: 1px solid var(--arr-border-light);
    border-radius: var(--arr-radius);
    padding: 14px;
    margin-bottom: 8px;
}

.arr-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.arr-card-room {
    font-size: 20px;
    font-weight: 800;
    color: var(--arr-text);
}

.arr-card-type {
    font-size: 11px;
    color: var(--arr-text-muted);
}

.arr-card-guest {
    font-weight: 600;
    font-size: 14px;
    color: var(--arr-text);
    margin-bottom: 4px;
}

.arr-card-info {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--arr-text-secondary);
    margin-bottom: 10px;
}

.arr-card-actions {
    display: flex;
    gap: 8px;
}

.arr-card-actions .arr-btn {
    flex: 1;
    justify-content: center;
}

.arr-empty {
    text-align: center;
    padding: 30px;
    color: var(--arr-text-muted);
    font-size: 13px;
}

/* ============================================
   MODAL CHECK-IN
============================================ */
.arr-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
}

.arr-modal-content {
    background: var(--arr-surface);
    margin: 3% auto;
    border-radius: 14px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    overflow: hidden;
}

.arr-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--arr-border);
}

.arr-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--arr-text);
}

.arr-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: var(--arr-bg);
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
    color: var(--arr-text-secondary);
}

.arr-modal-body {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

.arr-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid var(--arr-border);
    background: var(--arr-bg);
}

/* Booking info card */
.ci-booking-info {
    background: var(--arr-bg);
    border-radius: var(--arr-radius);
    padding: 16px;
    margin-bottom: 16px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.ci-info-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ci-info-label {
    font-size: 10px;
    color: var(--arr-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.ci-info-val {
    font-size: 14px;
    font-weight: 600;
    color: var(--arr-text);
}

/* ============================================
   SEZIONE ALLOGGIATI COLLAPSIBILE
============================================ */
.ci-alloggiati-section {
    border: 1px solid var(--arr-border);
    border-radius: var(--arr-radius);
    overflow: hidden;
}

.ci-alloggiati-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--arr-bg);
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.ci-alloggiati-header:hover {
    background: var(--arr-border-light);
}

.ci-alloggiati-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--arr-text);
}

.ci-alloggiati-badge {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ci-optional-tag {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 10px;
    background: var(--arr-blue-light);
    color: #1e40af;
    font-weight: 600;
}

.ci-chevron {
    transition: transform 0.3s;
}

.ci-chevron.open {
    transform: rotate(180deg);
}

.ci-alloggiati-body {
    padding: 16px;
    border-top: 1px solid var(--arr-border);
}

/* ============================================
   UPLOAD DOCUMENTI
============================================ */
.ci-doc-upload {
    margin-bottom: 16px;
}

.ci-doc-hint {
    font-size: 12px;
    color: var(--arr-text-secondary);
    margin: 0 0 10px;
}

.ci-doc-buttons {
    display: flex;
    gap: 8px;
}

.ci-doc-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border: 2px dashed var(--arr-border);
    border-radius: var(--arr-radius);
    background: var(--arr-bg);
    cursor: pointer;
    flex: 1;
    justify-content: center;
    font-size: 13px;
    font-weight: 500;
    color: var(--arr-text-secondary);
    transition: all 0.2s;
    font-family: var(--arr-font);
}

.ci-doc-btn:hover {
    border-color: var(--arr-accent);
    color: var(--arr-accent);
    background: var(--arr-accent-light);
}

.ci-doc-btn-camera {
    border-color: var(--arr-green);
    color: var(--arr-green);
}

.ci-doc-btn-camera:hover {
    background: var(--arr-green-light);
}

.ci-doc-preview {
    margin-top: 12px;
    position: relative;
    border-radius: var(--arr-radius);
    overflow: hidden;
    border: 1px solid var(--arr-border);
}

.ci-doc-preview img {
    width: 100%;
    max-height: 200px;
    object-fit: contain;
    background: #f0f0f0;
}

.ci-doc-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--arr-bg);
    font-size: 12px;
    font-weight: 500;
    color: var(--arr-text-secondary);
}

.ci-doc-status.success {
    background: var(--arr-green-light);
    color: #065f46;
}

.ci-doc-status.error {
    background: #fee2e2;
    color: #991b1b;
}

.ci-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--arr-border);
    border-top-color: var(--arr-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ============================================
   FORM OSPITE
============================================ */
.ci-guest-form {
    margin-top: 16px;
}

.ci-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

.ci-form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ci-form-group label {
    font-size: 11px;
    color: var(--arr-text-secondary);
    font-weight: 600;
}

.ci-input {
    padding: 8px 10px;
    border: 1px solid var(--arr-border);
    border-radius: 6px;
    font-size: 13px;
    font-family: var(--arr-font);
    color: var(--arr-text);
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
    box-sizing: border-box;
}

.ci-input:focus {
    border-color: var(--arr-accent);
    box-shadow: 0 0 0 2px rgba(59,130,246,0.1);
}

.ci-input.filled {
    background: #f0fdf4;
    border-color: var(--arr-green);
}

/* Link modulo completo */
.ci-alloggiati-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--arr-border-light);
    font-size: 12px;
    color: var(--arr-text-muted);
}

.ci-link-btn {
    padding: 6px 12px;
    border: none;
    background: none;
    color: var(--arr-accent);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--arr-font);
}

.ci-link-btn:hover {
    text-decoration: underline;
}

/* ============================================
   RESPONSIVE
============================================ */
.arr-desktop-only { display: table; }
.arr-mobile-only { display: none; }

@media (max-width: 768px) {
    .arr-top-bar {
        padding: 12px 14px;
    }

    .arr-title { font-size: 18px; }

    .arr-stats {
        padding: 10px 14px;
        gap: 8px;
    }

    .arr-stat {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 10px 8px;
        gap: 2px;
    }

    .arr-stat-num { font-size: 24px; }
    .arr-stat-lbl { font-size: 10px; }

    .arr-section {
        margin: 8px 10px;
    }

    /* SWAP table/cards */
    .arr-desktop-only { display: none !important; }
    .arr-mobile-only { display: block !important; }

    .arr-modal-content {
        margin: 0;
        border-radius: 14px 14px 0 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        max-height: 90vh;
    }

    .arr-modal-body {
        max-height: 60vh;
    }

    .ci-form-row {
        grid-template-columns: 1fr;
    }

    .ci-booking-info {
        grid-template-columns: 1fr 1fr;
    }

    .ci-doc-buttons {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .arr-stats {
        gap: 6px;
    }

    .arr-stat-num { font-size: 20px; }

    .ci-booking-info {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   PRINT
============================================ */
@media print {
    .arr-actions, .arr-modal { display: none !important; }
    .arr-mobile-only { display: none !important; }
    .arr-desktop-only { display: table !important; }
    .arr-section { break-inside: avoid; }
}

/* ============================================
   LEGACY COMPAT
============================================ */
.arrivals-module > .module-header { display: none; }
.arrivals-module > .stats-cards { display: none; }
.arrivals-module > .section-card { display: none; }
.arrivals-module > style { display: none; }
/* Partenza anticipata - opzioni */
.arr-eco-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 2px solid var(--arr-border);
    border-radius: 10px;
    background: var(--arr-surface);
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
    font-family: var(--arr-font);
    width: 100%;
}

.arr-eco-option:hover {
    border-color: var(--arr-accent);
    background: var(--arr-accent-light);
}

.arr-eco-recalc:hover {
    border-color: var(--arr-green);
    background: var(--arr-green-light);
}

.arr-eco-custom:hover {
    border-color: var(--arr-orange);
    background: var(--arr-orange-light);
}

.arr-eco-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.arr-eco-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.arr-eco-text strong {
    font-size: 14px;
    color: var(--arr-text);
}

.arr-eco-text span {
    font-size: 12px;
    color: var(--arr-text-secondary);
}