/* ============================================
   LAYOUT BASE
   ============================================ */

.bb-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 16px;
    box-sizing: border-box;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.bb-header h1 {
    font-size: 22px;
    margin-bottom: 8px;
}

/* ============================================
   SEZIONE OSPITI E DATE
   ============================================ */

.bb-room-info {
    background: #ffffff;
    padding: 0;
    border-radius: 12px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    overflow: hidden;
}

.bb-guests-card {
    background: #f8fafc;
    padding: 16px 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.bb-guests-icon-wrapper {
    background: #ffffff;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.bb-guests-icon-wrapper .bb-icon {
    font-size: 24px;
    line-height: 1;
}

.bb-guests-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    gap: 6px;
}

/* Prima riga: numero + badge ospiti */
.bb-guests-row {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px 10px;
}

.bb-guests-number {
    font-size: 28px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

.bb-guests-label {
    font-size: 16px;
    font-weight: 500;
    color: #475569;
}

.bb-guests-badge {
    background: #dcfce7;
    border: 1px solid #86efac;
    color: #166534;
    padding: 2px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    display: inline-block;
    white-space: nowrap;
}

/* Seconda riga: letti */
.bb-letti-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 18px;
    color: #475569;
    background: #f1f5f9;
    padding: 2px 14px;
    border-radius: 16px;
    width: fit-content;
}

.bb-letti-info .bb-letti-icon {
    font-size: 20px;
}

/* ============================================
   DATE
   ============================================ */

.bb-dates {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: #ffffff;
    flex-wrap: wrap;
}

.bb-date-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.bb-date-icon {
    font-size: 16px;
    line-height: 1;
}

.bb-date-label {
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
}

.bb-date-value {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    background: #f1f5f9;
    padding: 2px 10px;
    border-radius: 6px;
}

.bb-date-arrow {
    color: #94a3b8;
    font-size: 16px;
    font-weight: 300;
    padding: 0 4px;
}

.bb-date-notti {
    margin-left: auto;
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    background: #e2e8f0;
    padding: 4px 14px;
    border-radius: 16px;
    white-space: nowrap;
    display: inline-block;
}

/* ============================================
   NOTE E COMPLETAMENTO
   ============================================ */

.bb-special-notes {
    background: #fefce8;
    border-left: 4px solid #eab308;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    color: #854d0e;
    margin: 0 20px 12px 20px;
}

.bb-completed-note {
    background: #dcfce7;
    border-left: 4px solid #22c55e;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    color: #166534;
    margin: 0 20px 12px 20px;
}

/* ============================================
   PROGRESS BAR
   ============================================ */

.bb-progress {
    margin: 16px 0;
}

.bb-progress-bar {
    width: 100%;
    height: 8px;
    background: #e1e4eb;
    border-radius: 999px;
    overflow: hidden;
}

.bb-progress-fill {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, #2ecc71, #27ae60);
    transition: width 0.2s ease;
}

.bb-progress-text {
    font-size: 13px;
    margin-top: 4px;
}

/* ============================================
   CHECKLIST
   ============================================ */

.bb-category {
    margin-bottom: 16px;
    background: #f8fafc;
    border-radius: 12px;
    padding: 14px 16px;
    border: 1px solid #e2e8f0;
}

.bb-category h3 {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 12px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.bb-category h3 .bb-cat-icon {
    font-size: 20px;
}

/* ============================================
   TASK
   ============================================ */

.bb-task {
    margin-bottom: 10px;
}

.bb-check {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 12px 16px;
    background: #fee2e2;
    border-radius: 12px;
    border: 2px solid #fecaca;
    cursor: pointer;
    transition: all 0.25s ease;
}

.bb-check:hover {
    background: #fecaca;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}

.bb-check-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

.bb-check-box {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2.5px solid #f87171;
    box-sizing: border-box;
    flex-shrink: 0;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    margin-top: 2px;
}

.bb-check-mark {
    font-size: 3em;
    font-weight: 700;
    line-height: 1;
    color: #06c347;
    opacity: 0;
    transform: scale(0.4);
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

}

.bb-check-input:checked ~ .bb-check-box {
    background: #16a34a;
    border-color: #16a34a;
    box-shadow: 0 2px 12px rgba(22, 163, 74, 0.3);
}

.bb-check-input:checked ~ .bb-check-box .bb-check-mark {
    opacity: 1;
    transform: scale(1);
}

.bb-check:has(.bb-check-input:checked) {
    background: #dcfce7;
    border-color: #86efac;
}

.bb-check-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.bb-task-title {
    font-size: 18px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.4;
    transition: color 0.2s ease;
    letter-spacing: -0.2px;
}

.bb-task-desc {
    font-size: 14px;
    color: #475569;
    line-height: 1.6;
    padding-left: 2px;
}

.bb-check:has(.bb-check-input:checked) .bb-task-title {
    color: #14532d;
}

.bb-check:has(.bb-check-input:checked) .bb-task-desc {
    color: #166534;
}

.bb-check-input:disabled ~ .bb-check-box {
    border-color: #d1d5db;
    background: #f9fafb;
}

.bb-check-input:disabled ~ .bb-check-content {
    opacity: 0.7;
}

/* ============================================
   IMMAGINE TASK (cliccabile, indipendente dalla checkbox)
   ============================================ */

.bb-task-image {
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e2e8f0;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    margin-left: auto;
    order: 10;
    user-select: none;
    -webkit-user-select: none;
    z-index: 5;
}

.bb-task-image:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 3;
    border-color: #22c55e;
}

.bb-task-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.bb-task-image .bb-no-image {
    font-size: 24px;
    color: #94a3b8;
}

.bb-zoom-badge {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.65);
    color: #ffffff;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    pointer-events: none;
    line-height: 1.4;
    backdrop-filter: blur(2px);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.bb-check:has(.bb-check-input:checked) .bb-task-image {
    border-color: #86efac;
}

/* ============================================
   LIGHTBOX
   ============================================ */

.bb-lightbox-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 999999;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.bb-lightbox-overlay.active {
    display: flex;
}

.bb-lightbox-content {
    max-width: 95vw;
    max-height: 95vh;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.bb-lightbox-image {
    max-width: 95vw;
    max-height: 85vh;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    object-fit: contain;
    background: #1a1a1a;
    cursor: pointer;
}

.bb-lightbox-caption {
    color: #ffffff;
    font-size: 16px;
    font-weight: 500;
    margin-top: 16px;
    text-align: center;
    opacity: 0.9;
    padding: 0 20px;
    max-width: 90vw;
}

.bb-lightbox-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 36px;
    cursor: pointer;
    padding: 8px 12px;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    z-index: 10;
}

.bb-lightbox-close:hover {
    opacity: 1;
}

.bb-lightbox-hint {
    color: rgba(255, 255, 255, 0.4);
    font-size: 13px;
    margin-top: 10px;
    text-align: center;
}

/* ============================================
   SEGNALAZIONI, AZIONI, PULSANTI
   ============================================ */

.bb-reports textarea.bb-segnalazioni {
    width: 100%;
    box-sizing: border-box;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    font-size: 14px;
}

.bb-actions {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.bb-btn {
    border: none;
    border-radius: 999px;
    padding: 10px 18px;
    font-size: 14px;
    cursor: pointer;
    background: #22c55e;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.bb-btn:active {
    transform: scale(0.97);
}

.bb-save-status {
    font-size: 13px;
}

.bb-btn-reopen {
    background: #f59e0b !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 999px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: center;
    margin-top: 10px !important;
}

.bb-btn-reopen:hover {
    background: #d97706 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.35);
}

.bb-btn-reopen:active {
    transform: scale(0.97);
}

.bb-btn-reopen:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* ============================================
   CAMPO NOME OPERATORE
   ============================================ */

.bb-operator {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 2px solid #e2e8f0;
}

.bb-operator h3 {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 8px 0;
}

.bb-operatore-input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1.5px solid #e2e8f0;
    font-size: 14px;
    font-family: inherit;
    background: #f8fafc;
    transition: border-color 0.2s ease;
}

.bb-operatore-input:focus {
    outline: none;
    border-color: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}

.bb-operatore-input:disabled {
    background: #f1f5f9;
    cursor: not-allowed;
}

/* ============================================
   AVVISO SOVRAPPOSIZIONE
   ============================================ */

.bb-overlap-warning {
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 16px;
    color: #991b1b;
    font-size: 14px;
}

.bb-overlap-warning strong {
    color: #7f1d1d;
}

/* ============================================
   RESPONSIVE - TABLET/MOBILE (<= 480px)
   ============================================ */

@media (max-width: 480px) {
    .bb-container {
        padding: 4px 4px 8px 4px;
        margin: 0;
    }

    .bb-header {
        padding: 8px 10px;
        margin-bottom: 8px;
        border-radius: 8px;
    }

    .bb-header h1 {
        font-size: 18px;
        margin-bottom: 6px;
    }

    .bb-room-info {
        margin-bottom: 10px;
    }

    .bb-guests-card {
        padding: 10px 12px;
        gap: 10px;
        border-radius: 8px;
        flex-wrap: wrap;
    }

    .bb-guests-icon-wrapper {
        width: 32px;
        height: 32px;
    }

    .bb-guests-icon-wrapper .bb-icon {
        font-size: 16px;
    }

    .bb-guests-info {
        gap: 4px;
    }

    .bb-guests-number {
        font-size: 20px;
    }

    .bb-guests-label {
        font-size: 13px;
    }

    .bb-guests-badge {
        font-size: 11px;
        padding: 1px 8px;
    }

    .bb-letti-info {
        font-size: 15px;
        padding: 2px 10px;
    }

    .bb-letti-info .bb-letti-icon {
        font-size: 16px;
    }

    .bb-dates {
        padding: 8px 12px;
        gap: 6px;
        border-radius: 6px;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .bb-date-arrow {
        display: none;
    }

    .bb-date-label {
        font-size: 11px;
    }

    .bb-date-value {
        font-size: 12px;
        padding: 1px 6px;
    }

    .bb-date-icon {
        font-size: 13px;
    }

    .bb-date-notti {
        font-size: 14px;
        padding: 3px 12px;
        margin-left: 0;
    }

    .bb-special-notes,
    .bb-completed-note {
        padding: 6px 10px;
        font-size: 12px;
        margin: 0 10px 8px 10px;
    }

    .bb-progress {
        margin: 8px 0;
        padding: 8px 10px;
    }

    .bb-progress-bar {
        height: 6px;
    }

    .bb-progress-text {
        font-size: 11px;
        margin-top: 3px;
    }

    .bb-checklist {
        padding: 8px;
        border-radius: 8px;
    }

    .bb-category {
        padding: 6px 8px;
        border-radius: 6px;
        margin-bottom: 8px;
    }

    .bb-category h3 {
        font-size: 16px;
        padding-bottom: 4px;
        margin-bottom: 6px;
    }

    .bb-category h3 .bb-cat-icon {
        font-size: 16px;
    }

    .bb-task {
        margin-bottom: 4px;
    }

    .bb-check {
        padding: 5px 6px;
        gap: 8px;
        border-radius: 6px;
        border-width: 1.5px;
    }

    .bb-check-box {
        width: 24px;
        height: 24px;
        border-width: 2px;
        margin-top: 1px;
    }

    .bb-check-mark {
        font-size: 5em;
    }

    .bb-check-content {
        gap: 2px;
    }

    .bb-task-title {
        font-size: 16px;
    }

    .bb-task-desc {
        font-size: 14px;
        line-height: 1.5;
        padding-left: 0;
    }

    .bb-task-image {
        width: 60px;
        height: 60px;
        border-radius: 8px;
        border-width: 2px;
    }

    .bb-zoom-badge {
        font-size: 10px;
        padding: 1px 5px;
        bottom: 2px;
        right: 2px;
    }

    .bb-reports {
        margin-top: 8px;
        padding-top: 8px;
    }

    .bb-reports h3 {
        font-size: 13px;
        margin-bottom: 4px;
    }

    .bb-reports textarea.bb-segnalazioni {
        padding: 4px 8px;
        font-size: 13px;
        border-radius: 6px;
        border-width: 1px;
    }

    .bb-operator {
        margin-top: 8px;
        padding-top: 8px;
    }

    .bb-operator h3 {
        font-size: 13px;
        margin-bottom: 4px;
    }

    .bb-operatore-input {
        padding: 4px 8px;
        font-size: 13px;
        border-radius: 6px;
        border-width: 1px;
    }

    .bb-actions {
        margin-top: 8px;
        gap: 4px;
        flex-direction: column;
    }

    .bb-btn {
        padding: 6px 12px;
        font-size: 12px;
        border-radius: 6px;
        width: 100%;
        justify-content: center;
    }

    .bb-save-status {
        font-size: 11px;
        text-align: center;
        width: 100%;
    }

    .bb-completed-message {
        padding: 6px 10px;
        font-size: 12px;
        border-radius: 6px;
    }

    .bb-btn-reopen {
        padding: 6px 12px !important;
        font-size: 12px !important;
        margin-top: 4px !important;
    }

    .bb-lightbox-image {
        max-height: 60vh;
    }

    .bb-lightbox-close {
        top: -40px;
        font-size: 28px;
    }

    .bb-lightbox-caption {
        font-size: 13px;
        margin-top: 10px;
    }
}

/* ============================================
   RESPONSIVE - MOBILE MOLTO PICCOLO (<= 380px)
   ============================================ */

@media (max-width: 380px) {
    .bb-container {
        padding: 2px 2px 4px 2px;
    }

    .bb-header {
        padding: 6px 8px;
    }

    .bb-header h1 {
        font-size: 16px;
    }

    .bb-guests-card {
        padding: 8px 10px;
    }

    .bb-guests-number {
        font-size: 18px;
    }

    .bb-guests-badge {
        display: block;
        margin-top: 4px;
        width: 100%;
    }

    .bb-category h3 {
        font-size: 18px;
    }

    .bb-check {
        padding: 4px 4px;
        gap: 6px;
    }

    .bb-check-box {
        width: 20px;
        height: 20px;
    }

    .bb-check-mark {
        font-size: 14px;
    }

    .bb-task-title {
        font-size: 15px;
    }

    .bb-task-desc {
        font-size: 13px;
    }

    .bb-task-image {
        width: 50px;
        height: 50px;
    }
}
