/* mobile-gallery.css - Mobile-Optimized Photo Gallery Styles */

/* ========================================
   MOBILE GALLERY CONTAINER
   ======================================== */

.mobile-photo-gallery-section {
    margin-top: 15px;
    padding-top: 20px;
    border-top: 1px solid #E8E5E1;
    display: none; /* Hidden by default, shown only on mobile */
}

.mobile-photo-gallery-container {
    background: #F8F6F3;
    border-radius: 12px;
    padding: 15px;
    margin-top: 15px;
    width: 100%;
    box-sizing: border-box;
    border: 2px solid #e8e5e1;
    position: relative;
}

/* ========================================
   MAIN GALLERY DISPLAY
   ======================================== */

.mobile-gallery-images {
    position: relative;
    width: 100%;
    height: 250px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 15px;
    user-select: none;
    -webkit-user-select: none;
    touch-action: pan-y; /* Allow vertical scrolling, prevent horizontal */
}

.mobile-gallery-strip {
    display: flex;
    height: 100%;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

.mobile-gallery-slide {
    flex: 0 0 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
}

.mobile-gallery-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none; /* Prevent image dragging */
}

.mobile-gallery-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    color: white;
    padding: 15px 15px 10px;
    font-size: 14px;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

/* ========================================
   NAVIGATION BUTTONS
   ======================================== */

.mobile-gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
    touch-action: manipulation;
}

.mobile-gallery-nav:active {
    transform: translateY(-50%) scale(0.95);
    background: rgba(0, 0, 0, 0.8);
}

.mobile-gallery-prev {
    left: 10px;
}

.mobile-gallery-next {
    right: 10px;
}

.mobile-gallery-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ========================================
   DOT INDICATORS
   ======================================== */

.mobile-gallery-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.mobile-gallery-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.mobile-gallery-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    background: #D1D5DB;
    cursor: pointer;
    transition: all 0.3s ease;
    touch-action: manipulation;
}

.mobile-gallery-dot.active {
    background: #C9A961;
    transform: scale(1.25);
}

.mobile-gallery-dot:active {
    transform: scale(1.1);
}

/* ========================================
   COUNTER
   ======================================== */

.mobile-gallery-counter {
    text-align: center;
    font-size: 14px;
    color: #2C2C2C;
    opacity: 0.7;
    font-weight: 500;
}

/* ========================================
   EMPTY STATE
   ======================================== */

.mobile-gallery-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #666;
    text-align: center;
    padding: 20px;
}

.mobile-gallery-empty-icon {
    font-size: 32px;
    margin-bottom: 10px;
    opacity: 0.5;
}

.mobile-gallery-empty-text {
    font-style: italic;
    font-size: 14px;
}

.mobile-gallery-error {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    background: #F8F6F3;
    border-radius: 8px;
    color: #666;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* ========================================
   DISCLAIMER
   ======================================== */

.mobile-gallery-disclaimer {
    margin-top: 10px;
    font-size: 11px;
    color: #666;
    text-align: center;
    line-height: 1.4;
    font-style: italic;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* Show mobile gallery only on mobile devices */
@media (max-width: 768px) {
    .mobile-photo-gallery-section {
        display: block;
    }
    
    .mobile-gallery-images {
        height: 280px;
    }
    
    .mobile-gallery-caption {
        font-size: 13px;
        padding: 12px 12px 8px;
    }
    
    .mobile-gallery-nav {
        width: 38px;
        height: 38px;
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .mobile-photo-gallery-container {
        padding: 12px;
        margin-top: 12px;
    }
    
    .mobile-gallery-images {
        height: 260px;
        margin-bottom: 12px;
    }
    
    .mobile-gallery-caption {
        font-size: 12px;
        padding: 10px 10px 6px;
    }
    
    .mobile-gallery-nav {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
    
    .mobile-gallery-prev {
        left: 8px;
    }
    
    .mobile-gallery-next {
        right: 8px;
    }
    
    .mobile-gallery-dot {
        width: 6px;
        height: 6px;
    }
    
    .mobile-gallery-counter {
        font-size: 12px;
    }
    
    .mobile-gallery-disclaimer {
        font-size: 10px;
        margin-top: 8px;
    }
}

/* ========================================
   DEVICE-SPECIFIC VISIBILITY RULES
   ======================================== */

/* Hide desktop gallery on mobile devices */
@media (max-width: 768px) {
    .modal-photo-gallery-section {
        display: none !important;
    }
}

/* Additional body class-based visibility for more precise control */
body.mobile-gallery-device .modal-photo-gallery-section {
    display: none !important;
}

body.desktop-gallery-device .mobile-photo-gallery-section {
    display: none !important;
}

/* Show mobile gallery only on mobile devices */
@media (max-width: 768px) {
    .mobile-photo-gallery-section {
        display: block;
    }
}

/* Force mobile gallery visibility on detected mobile devices */
body.mobile-gallery-device .mobile-photo-gallery-section {
    display: block !important;
}

/* ========================================
   ACCESSIBILITY IMPROVEMENTS
   ======================================== */

.mobile-gallery-nav:focus,
.mobile-gallery-dot:focus {
    outline: 2px solid #C9A961;
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .mobile-gallery-strip {
        transition: none;
    }
    
    .mobile-gallery-nav,
    .mobile-gallery-dot {
        transition: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .mobile-gallery-nav {
        background: rgba(0, 0, 0, 0.9);
        border: 1px solid white;
    }
    
    .mobile-gallery-dot {
        border: 1px solid #000;
    }
    
    .mobile-gallery-dot.active {
        background: #000;
        border: 1px solid #fff;
    }
}

/* ========================================
   LOADING STATES
   ======================================== */

.mobile-gallery-slide img[src=""] {
    background: #f0f0f0;
    position: relative;
}

.mobile-gallery-slide img[src=""]:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ddd;
    border-top-color: #C9A961;
    border-radius: 50%;
    animation: mobile-gallery-spin 1s linear infinite;
}

@keyframes mobile-gallery-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===============================================
   MOBILE FULLSCREEN BUTTON
   =============================================== */

.mobile-fullscreen-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
    opacity: 0.8;
    touch-action: manipulation;
}

.mobile-fullscreen-btn:hover,
.mobile-fullscreen-btn:active {
    background: rgba(0, 0, 0, 0.9);
    opacity: 1;
    transform: scale(1.05);
}

.mobile-fullscreen-btn:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Show fullscreen button on touch devices */
@media (pointer: coarse) {
    .mobile-fullscreen-btn {
        opacity: 1;
    }
}

/* ===============================================
   MOBILE FULLSCREEN OVERLAY
   =============================================== */

.mobile-fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    opacity: 1;
    animation: mobileFullscreenFadeIn 0.3s ease-out;
    touch-action: manipulation;
}

@keyframes mobileFullscreenFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Mobile Fullscreen Header */
.mobile-fullscreen-header {
    background: rgba(0, 0, 0, 0.8);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.mobile-fullscreen-counter {
    color: white;
    font-size: 16px;
    font-weight: 500;
}

.mobile-fullscreen-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 22px;
    font-size: 24px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.mobile-fullscreen-close:hover,
.mobile-fullscreen-close:active {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Mobile Fullscreen Content */
.mobile-fullscreen-content {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-height: 0;
}

.mobile-fullscreen-image-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    touch-action: pan-x; /* Allow horizontal panning for swipe */
}

.mobile-fullscreen-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    user-select: none;
    -webkit-user-select: none;
}

/* Mobile Fullscreen Navigation */
.mobile-fullscreen-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 25px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 20;
    touch-action: manipulation;
}

.mobile-fullscreen-prev {
    left: 20px;
}

.mobile-fullscreen-next {
    right: 20px;
}

.mobile-fullscreen-nav:hover,
.mobile-fullscreen-nav:active {
    background: rgba(0, 0, 0, 0.9);
    transform: translateY(-50%) scale(1.1);
}

.mobile-fullscreen-nav:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Mobile Fullscreen Footer */
.mobile-fullscreen-footer {
    background: rgba(0, 0, 0, 0.8);
    padding: 16px 20px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.mobile-fullscreen-disclaimer {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    line-height: 1.4;
    margin-bottom: 16px;
}

/* Mobile Fullscreen Dots */
.mobile-fullscreen-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    max-width: 100%;
    overflow-x: auto;
    padding: 0 10px;
}

.mobile-fullscreen-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.4);
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
    touch-action: manipulation;
}

.mobile-fullscreen-dot.active {
    background: white;
    border-color: white;
}

.mobile-fullscreen-dot:hover,
.mobile-fullscreen-dot:focus {
    border-color: rgba(255, 255, 255, 0.8);
    transform: scale(1.2);
}

.mobile-fullscreen-dot:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* ===============================================
   MOBILE FULLSCREEN RESPONSIVE
   =============================================== */

/* Small mobile adjustments */
@media (max-width: 480px) {
    .mobile-fullscreen-header {
        padding: 12px 16px;
    }
    
    .mobile-fullscreen-counter {
        font-size: 14px;
    }
    
    .mobile-fullscreen-close {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .mobile-fullscreen-image-container {
        padding: 15px;
    }
    
    .mobile-fullscreen-nav {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
    
    .mobile-fullscreen-prev {
        left: 15px;
    }
    
    .mobile-fullscreen-next {
        right: 15px;
    }
    
    .mobile-fullscreen-footer {
        padding: 12px 16px;
    }
    
    .mobile-fullscreen-disclaimer {
        font-size: 11px;
        margin-bottom: 12px;
    }
    
    .mobile-fullscreen-dots {
        gap: 6px;
    }
    
    .mobile-fullscreen-dot {
        width: 8px;
        height: 8px;
    }
}

/* Landscape mode adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    .mobile-fullscreen-header,
    .mobile-fullscreen-footer {
        padding: 10px 20px;
    }
    
    .mobile-fullscreen-disclaimer {
        margin-bottom: 10px;
    }
    
    .mobile-fullscreen-image-container {
        padding: 10px 60px; /* More horizontal padding for nav buttons */
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .mobile-fullscreen-image {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Accessibility - Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .mobile-fullscreen-overlay,
    .mobile-fullscreen-nav,
    .mobile-fullscreen-close,
    .mobile-fullscreen-dot {
        animation: none;
        transition: none;
    }
}

/* Touch device optimizations */
@media (pointer: coarse) {
    .mobile-fullscreen-nav,
    .mobile-fullscreen-close {
        min-height: 44px;
        min-width: 44px;
    }
    
    .mobile-fullscreen-dot {
        min-width: 12px;
        min-height: 12px;
    }
}
