/* B&B Rooms Gallery Styles - Versione Completa Responsive con Spaziature Mobile Ottimizzate */

/* Variabili CSS per facilitare la manutenzione */
:root {
    --bb-primary-shadow: 0 2px 8px rgba(0,0,0,0.1);
    --bb-hover-shadow: 0 8px 20px rgba(0,0,0,0.15);
    --bb-border-radius: 12px;
    --bb-max-width: 1200px;
    /* Variabili per padding responsive */
    --bb-padding-desktop: 24px;
    --bb-padding-tablet: 20px;
    --bb-padding-mobile: 16px;
    --bb-padding-mobile-small: 12px;
}

/* Reset box-sizing globale */
.bb-room-airbnb-style *,
.bb-room-airbnb-style *:before,
.bb-room-airbnb-style *:after,
.bb-room-card-style *,
.bb-room-card-style *:before,
.bb-room-card-style *:after,
.bb-room-minimal-style *,
.bb-room-minimal-style *:before,
.bb-room-minimal-style *:after {
    box-sizing: border-box;
}

/* Container principale */
.bb-rooms-container {
    max-width: var(--bb-max-width);
    margin: 0 auto;
    padding: 0 16px;
}

/* Griglia responsive */
.bb-rooms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    padding: 20px 0;
}

/* Card delle camere */
.bb-room-card {
    border-radius: var(--bb-border-radius);
    overflow: hidden;
    box-shadow: var(--bb-primary-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: #fff;
}

.bb-room-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--bb-hover-shadow);
}

/* Galleria immagini */
.bb-room-gallery {
    position: relative;
    height: 250px;
    overflow: hidden;
    background: #f5f5f5;
}

.bb-room-gallery img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease;
}

/* Navigazione galleria */
.bb-gallery-nav {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
    padding: 5px;
    background: rgba(0,0,0,0.3);
    border-radius: 20px;
}

.bb-gallery-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: background 0.3s ease;
}

.bb-gallery-dot.active {
    background: white;
    width: 10px;
    height: 10px;
}

/* Contenuto card */
.bb-room-content {
    padding: 20px;
}

.bb-room-title {
    margin: 0 0 10px 0;
    font-size: 24px;
    font-weight: 600;
    color: #222;
    line-height: 1.2;
}

.bb-room-description {
    color: #666;
    line-height: 1.6;
    margin: 0;
    font-size: 16px;
}

/* ===== STILI AIRBNB LAYOUT ===== */
.bb-room-airbnb-style {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.bb-airbnb-gallery {
    margin-bottom: 48px;
    overflow: hidden;
    position: relative;
}

/* Layout 1 immagine */
.bb-single-image {
    position: relative;
    width: 100%;
    height: 500px;
}

.bb-single-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Layout 2 immagini */
.bb-gallery-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    height: 500px;
}

/* Layout 3 immagini */
.bb-gallery-grid-3 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 8px;
    height: 500px;
}

.bb-gallery-grid-3 .bb-main-image {
    height: 100%;
}

.bb-gallery-grid-3 .bb-side-images {
    display: grid;
    grid-template-rows: 1fr 1fr;
    gap: 8px;
    height: 100%;
}

/* Layout 4 immagini */
.bb-gallery-grid-4 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 8px;
    height: 500px;
}

/* Layout 5+ immagini */
.bb-gallery-grid-5plus {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 8px;
    height: 500px;
    position: relative;
}

.bb-gallery-grid-5plus .bb-main-image {
    height: 500px;
    overflow: hidden;
}

.bb-gallery-grid-5plus .bb-main-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bb-gallery-grid-5plus .bb-side-images {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: calc(50% - 4px) calc(50% - 4px);
    gap: 8px;
    height: 500px;
}

.bb-gallery-grid-5plus .bb-small-image {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 100%;
}

.bb-gallery-grid-5plus .bb-small-image .bb-gallery-link {
    display: block;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    height: 100%;
    width: 100%;
}

.bb-gallery-grid-5plus .bb-small-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Stili comuni per tutte le immagini */
.bb-grid-image,
.bb-main-image,
.bb-small-image {
    position: relative;
    overflow: hidden;
    height: 100%;
}

.bb-grid-image img,
.bb-main-image img,
.bb-small-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    display: block;
}

.bb-gallery-link {
    display: block;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    height: 100%;
    width: 100%;
}

.bb-gallery-link:hover img {
    transform: scale(1.05);
}

.bb-more-photos {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
}

/* Contenuto Airbnb */
.bb-room-content-airbnb {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 80px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--bb-padding-desktop);
}

.bb-content-main {
    flex: 1;
}

.bb-room-content-airbnb .bb-room-title {
    font-size: 32px;
    font-weight: 600;
    margin: 0 0 16px 0;
}

.bb-room-quick-info {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
    color: #222;
}

.bb-info-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bb-detail-icon {
    font-size: 18px;
}

.bb-divider {
    border-bottom: 1px solid #dddddd;
    margin: 24px 0;
}

.bb-room-content-airbnb .bb-room-description {
    line-height: 1.6;
    color: #484848;
}

.bb-amenities-section {
    margin-top: 32px;
}

.bb-amenities-section h3 {
    font-size: 22px;
    font-weight: 500;
    margin: 0 0 24px 0;
    color: #222;
}

.bb-amenities-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.bb-amenity-item {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #484848;
}

.bb-amenity-icon {
    color: #222;
    font-size: 16px;
}

/* Price Sidebar */
.bb-price-sidebar {
    position: sticky;
    top: 24px;
    height: fit-content;
}

.bb-price-box {
    border: 1px solid #dddddd;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
    background: white;
}

.bb-room-price {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #222;
}

.bb-book-button {
    width: 100%;
    background: #7B0001;
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.bb-book-button:hover {
    background: #5C0001;
    color: white;
    text-decoration: none;
}

/* ===== CARD STYLE ===== */
.bb-room-card-style {
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    background: white;
}

.bb-card-image {
    position: relative;
    height: 200px;
    overflow: hidden;
}

.bb-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bb-card-content {
    padding: 20px;
}

.bb-room-card-style .bb-room-title {
    font-size: 22px;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: #222;
}

.bb-room-card-style .bb-room-description {
    color: #666;
    line-height: 1.6;
    font-size: 15px;
}

.bb-card-footer {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bb-card-footer .bb-room-price {
    font-size: 20px;
    font-weight: 600;
    color: #222;
}

.bb-card-footer .bb-book-button {
    width: auto;
    padding: 10px 20px;
    font-size: 14px;
}

/* ===== MINIMAL STYLE ===== */
.bb-room-minimal-style {
    padding: 20px 0;
}

.bb-room-minimal-style .bb-room-title {
    font-size: 28px;
    font-weight: 600;
    margin: 0 0 16px 0;
    color: #222;
}

.bb-room-minimal-style .bb-room-description {
    color: #484848;
    line-height: 1.6;
    font-size: 16px;
    margin-bottom: 24px;
}

.bb-minimal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e0e0e0;
}

.bb-minimal-footer .bb-room-price {
    font-size: 24px;
    font-weight: 600;
    color: #222;
}

.bb-minimal-footer .bb-book-button {
    width: auto;
    padding: 12px 24px;
}

/* ===== MEDIA QUERIES ===== */

/* Media Queries per Tablet (1024px) */
@media (max-width: 1024px) {
    .bb-rooms-grid {
        gap: 24px;
        padding: 16px 0;
    }
    
    .bb-room-content-airbnb {
        grid-template-columns: 1fr 320px;
        gap: 40px;
        padding: 0 var(--bb-padding-tablet);
    }
    
    .bb-single-image,
    .bb-gallery-grid-2,
    .bb-gallery-grid-3,
    .bb-gallery-grid-4,
    .bb-gallery-grid-5plus {
        height: 400px;
    }
    
    .bb-gallery-grid-5plus .bb-main-image,
    .bb-gallery-grid-5plus .bb-side-images {
        height: 400px;
    }
}

/* Media Queries per Mobile Large (768px) */
@media (max-width: 768px) {
    .bb-rooms-container {
        padding: 0 20px;
    }
    
    .bb-rooms-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 20px;
        padding: 16px 0;
    }
    
    .bb-room-gallery {
        height: 220px;
    }
    
    .bb-room-content {
        padding: 20px;
    }
    
    .bb-room-title {
        font-size: 20px;
        margin-bottom: 12px;
    }
    
    .bb-room-description {
        font-size: 15px;
        line-height: 1.7;
    }
    
    /* Airbnb gallery responsive */
    .bb-airbnb-gallery {
        margin-bottom: 32px;
        margin-left: -20px;
        margin-right: -20px;
        width: calc(100% + 40px);
    }
    
    .bb-single-image {
        height: 300px;
    }
    
    .bb-gallery-grid-2 {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .bb-gallery-grid-2 .bb-grid-image {
        height: 200px;
    }
    
    .bb-gallery-grid-3 {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .bb-gallery-grid-3 .bb-main-image {
        height: 300px;
        margin-bottom: 4px;
    }
    
    .bb-gallery-grid-3 .bb-side-images {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr;
        height: 150px;
    }
    
    .bb-gallery-grid-4 {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr 1fr;
        height: auto;
    }
    
    .bb-gallery-grid-4 .bb-grid-image {
        height: 150px;
    }
    
    .bb-gallery-grid-5plus {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .bb-gallery-grid-5plus .bb-main-image {
        height: 300px;
        margin-bottom: 4px;
    }
    
    .bb-gallery-grid-5plus .bb-side-images {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(2, 1fr);
        height: 300px;
    }
    
    .bb-gallery-grid-5plus .bb-small-image {
        height: 100%;
    }
    
    /* Content responsive */
    .bb-room-content-airbnb {
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 0 20px;
    }
    
    .bb-room-content-airbnb .bb-room-title {
        font-size: 26px;
        margin-bottom: 20px;
    }
    
    .bb-room-quick-info {
        flex-wrap: wrap;
        gap: 16px;
        margin-bottom: 28px;
    }
    
    .bb-info-item {
        background: #f7f7f7;
        padding: 8px 16px;
        border-radius: 8px;
        font-size: 14px;
    }
    
    .bb-divider {
        margin: 28px 0;
    }
    
    .bb-room-content-airbnb .bb-room-description {
        font-size: 16px;
        line-height: 1.7;
        padding: 0 4px;
    }
    
    .bb-amenities-grid {
        grid-template-columns: 1fr;
        gap: 14px;
        padding: 0 4px;
    }
    
    .bb-amenities-section {
        margin-top: 36px;
    }
    
    .bb-amenities-section h3 {
        font-size: 20px;
        margin-bottom: 20px;
    }
    
    .bb-amenity-item {
        background: #f7f7f7;
        padding: 12px 16px;
        border-radius: 8px;
        font-size: 15px;
    }
    
    .bb-price-sidebar {
        position: relative;
        top: 0;
        margin-top: 40px;
        padding-bottom: 100px;
    }
    
    .bb-price-box {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        border-radius: 16px 16px 0 0;
        z-index: 100;
        background: white;
        transition: transform 0.3s ease;
        padding: 20px 24px;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    }
    
    /* Card responsive */
    .bb-card-content {
        padding: 20px;
    }
    
    .bb-card-footer {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .bb-card-footer .bb-book-button {
        width: 100%;
        text-align: center;
    }
    
    /* Minimal responsive */
    .bb-room-minimal-style {
        padding: 20px;
    }
    
    .bb-minimal-footer {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
    }
    
    .bb-minimal-footer .bb-book-button {
        width: 100%;
        text-align: center;
    }
    
    /* Touch optimizations */
    .bb-gallery-dot {
        width: 10px;
        height: 10px;
    }
    
    .bb-gallery-dot.active {
        width: 12px;
        height: 12px;
    }
}

/* Media Queries per Mobile Medium (480px) */
@media (max-width: 480px) {
    .bb-rooms-container {
        padding: 0 16px;
    }
    
    .bb-rooms-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 16px 0;
    }
    
    .bb-room-gallery {
        height: 200px;
    }
    
    .bb-room-content {
        padding: 18px;
    }
    
    .bb-room-title {
        font-size: 19px;
        margin-bottom: 10px;
    }
    
    .bb-room-description {
        font-size: 14px;
        line-height: 1.65;
    }
    
    /* Gallery mobile optimizations */
    .bb-airbnb-gallery {
        margin-left: -16px;
        margin-right: -16px;
        width: calc(100% + 32px);
        margin-bottom: 28px;
    }
    
    .bb-single-image {
        height: 250px;
    }
    
    .bb-gallery-grid-2 .bb-grid-image {
        height: 180px;
    }
    
    .bb-gallery-grid-3 .bb-main-image {
        height: 250px;
    }
    
    .bb-gallery-grid-3 .bb-side-images {
        height: 120px;
    }
    
    .bb-gallery-grid-4 .bb-grid-image {
        height: 120px;
    }
    
    .bb-gallery-grid-5plus .bb-main-image {
        height: 250px;
    }
    
    .bb-gallery-grid-5plus .bb-side-images {
        height: 240px;
    }
    
    .bb-more-photos {
        font-size: 14px;
    }
    
    .bb-room-content-airbnb {
        padding: 0 16px;
    }
    
    .bb-room-content-airbnb .bb-room-title {
        font-size: 24px;
        margin-bottom: 18px;
    }
    
    .bb-room-quick-info {
        margin-bottom: 24px;
    }
    
    .bb-info-item {
        font-size: 13px;
        padding: 6px 12px;
    }
    
    .bb-divider {
        margin: 24px 0;
    }
    
    .bb-room-content-airbnb .bb-room-description {
        font-size: 15px;
        line-height: 1.65;
    }
    
    .bb-amenities-section {
        margin-top: 32px;
    }
    
    .bb-amenities-section h3 {
        font-size: 19px;
        margin-bottom: 18px;
    }
    
    .bb-amenity-item {
        font-size: 14px;
        padding: 10px 14px;
    }
    
    /* Card style mobile */
    .bb-card-image {
        height: 180px;
    }
    
    .bb-card-content {
        padding: 18px;
    }
    
    .bb-room-card-style .bb-room-title {
        font-size: 20px;
    }
    
    .bb-room-card-style .bb-room-description {
        font-size: 14px;
    }
    
    /* Minimal style mobile */
    .bb-room-minimal-style {
        padding: 18px;
    }
    
    .bb-room-minimal-style .bb-room-title {
        font-size: 24px;
    }
    
    .bb-room-minimal-style .bb-room-description {
        font-size: 15px;
    }
}

/* Media Queries per Mobile Small (360px) */
@media (max-width: 360px) {
    .bb-rooms-container {
        padding: 0 12px;
    }
    
    .bb-room-content {
        padding: 16px;
    }
    
    .bb-room-gallery {
        height: 180px;
    }
    
    .bb-room-title {
        font-size: 18px;
        margin-bottom: 8px;
    }
    
    /* Gallery adjustments */
    .bb-airbnb-gallery {
        margin-left: -12px;
        margin-right: -12px;
        width: calc(100% + 24px);
        margin-bottom: 24px;
    }
    
    .bb-single-image {
        height: 220px;
    }
    
    .bb-gallery-grid-2 .bb-grid-image {
        height: 160px;
    }
    
    .bb-gallery-grid-3 .bb-main-image {
        height: 220px;
    }
    
    .bb-gallery-grid-3 .bb-side-images {
        height: 100px;
    }
    
    .bb-gallery-grid-4 .bb-grid-image {
        height: 100px;
    }
    
    .bb-gallery-grid-5plus .bb-main-image {
        height: 220px;
    }
    
    .bb-gallery-grid-5plus .bb-side-images {
        height: 200px;
    }
    
    .bb-room-content-airbnb {
        padding: 0 12px;
    }
    
    .bb-room-content-airbnb .bb-room-title {
        font-size: 22px;
        margin-bottom: 16px;
    }
    
    .bb-room-quick-info {
        gap: 10px;
        margin-bottom: 20px;
    }
    
    .bb-info-item {
        font-size: 12px;
        padding: 5px 10px;
    }
    
    .bb-divider {
        margin: 20px 0;
    }
    
    .bb-room-content-airbnb .bb-room-description {
        font-size: 14px;
        line-height: 1.6;
    }
    
    .bb-amenities-section {
        margin-top: 28px;
    }
    
    .bb-amenities-section h3 {
        font-size: 18px;
        margin-bottom: 16px;
    }
    
    .bb-amenity-item {
        font-size: 13px;
        padding: 8px 12px;
        gap: 10px;
    }
    
    .bb-price-box {
        padding: 16px 20px;
    }
    
    .bb-room-price {
        font-size: 20px;
        margin-bottom: 12px;
    }
    
    .bb-book-button {
        padding: 12px 20px;
        font-size: 15px;
    }
    
    /* Card adjustments */
    .bb-card-content {
        padding: 16px;
    }
    
    .bb-room-card-style .bb-room-title {
        font-size: 19px;
    }
    
    /* Minimal adjustments */
    .bb-room-minimal-style {
        padding: 16px;
    }
    
    .bb-room-minimal-style .bb-room-title {
        font-size: 22px;
    }
}

/* Extra small devices (320px) */
@media (max-width: 320px) {
    .bb-rooms-container {
        padding: 0 10px;
    }
    
    .bb-airbnb-gallery {
        margin-left: -10px;
        margin-right: -10px;
        width: calc(100% + 20px);
    }
    
    .bb-room-content-airbnb {
        padding: 0 10px;
    }
    
    .bb-room-content-airbnb .bb-room-title {
        font-size: 20px;
    }
    
    .bb-info-item {
        font-size: 11px;
        padding: 4px 8px;
    }
    
    .bb-amenity-item {
        font-size: 12px;
    }
}

/* Ottimizzazioni per touch devices */
@media (hover: none) and (pointer: coarse) {
    .bb-room-card:hover {
        transform: none;
    }
    
    .bb-gallery-link:hover img {
        transform: none;
    }
    
    .bb-gallery-nav {
        padding: 8px;
    }
    
    .bb-gallery-dot {
        width: 12px;
        height: 12px;
    }
    
    /* Aumenta l'area cliccabile */
    .bb-gallery-link {
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Migliora i tap target */
    .bb-book-button {
        min-height: 44px;
    }
    
    .bb-info-item,
    .bb-amenity-item {
        min-height: 40px;
        display: flex;
        align-items: center;
    }
}

/* Supporto per schermi ad alta densità */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .bb-room-card {
        box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    }
    
    .bb-room-card:hover {
        box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    }
}

/* Modalità landscape per mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .bb-single-image {
        height: 200px;
    }
    
    .bb-gallery-grid-2 .bb-grid-image,
    .bb-gallery-grid-3 .bb-main-image,
    .bb-gallery-grid-4 .bb-grid-image,
    .bb-gallery-grid-5plus .bb-main-image {
        height: 180px;
    }
    
    .bb-gallery-grid-3 .bb-side-images,
    .bb-gallery-grid-5plus .bb-side-images {
        height: 180px;
    }
    
    .bb-price-box {
        position: relative;
    }
}

/* Fix per prenotazione mobile */
@media (max-width: 768px) {
    body.has-bb-booking {
        padding-bottom: 120px;
    }
}

/* Animazioni ottimizzate per performance */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}