/* 
 * Camera Landscape Mode Styles
 * 
 * This file contains CSS styles that are ONLY applied when the camera modal
 * has the 'landscape-mode' class. These styles are completely isolated from
 * the portrait mode styles in style.css.
 * 
 * Safe to remove or modify without affecting portrait functionality.
 */

/* Main modal container adjustments for landscape */
#camera-modal.landscape-mode .camera-modal-content {
    flex-direction: row; /* Change from column to row layout */
    align-items: center; /* Center items vertically in the row */
    width: 95vw; /* Use more of the viewport width */
    height: 90vh; /* Use more of the viewport height */
    max-width: none; /* Remove width restrictions */
    max-height: 90vh; /* Maintain height control */
    padding: 15px; /* Adjust padding for landscape */
    gap: 15px; /* Add gap between video and controls */
}

/* Video stream takes majority of space in landscape */
#camera-modal.landscape-mode #camera-stream {
    flex: 1; /* Allow video to take available space */
    width: auto; /* Reset width to allow flex to control it */
    height: 100%; /* Fill the modal content height */
    max-width: 70%; /* Video takes up to 70% of the row width */
    max-height: 100%; /* Allow video to use full modal content height */
    order: 1; /* Video comes first in the row flow */
    object-fit: contain; /* Ensure video fits properly within its container */
    border-radius: 8px;
    background-color: #000;
}

/* Controls container becomes a vertical sidebar */
#camera-modal.landscape-mode .camera-controls-sidebar {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    order: 2; /* Controls come after the video stream */
    min-width: 140px; /* Minimum width for controls */
    max-width: 200px; /* Maximum width for controls */
    height: 100%; /* Full height of modal content */
    gap: 15px; /* Space between control sections */
}

/* Close button repositioning for landscape */
#camera-modal.landscape-mode #close-camera-button {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 1200; /* Ensure it's on top */
    width: 36px;
    height: 36px;
}

/* Camera controls row becomes vertical stack in landscape */
#camera-modal.landscape-mode .camera-controls-row {
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    margin: 0;
    border-top: none;
    border-left: 1px solid var(--border-color);
    padding-left: 10px;
    width: 100%;
    gap: 10px;
}

/* Zoom control adjustments for vertical layout */
#camera-modal.landscape-mode .zoom-control {
    flex-direction: column;
    max-width: none;
    width: 100%;
    gap: 5px;
    text-align: center;
}

#camera-modal.landscape-mode .zoom-control label {
    font-size: 12px;
    margin-bottom: 5px;
}

#camera-modal.landscape-mode #zoom-slider {
    width: 100%;
}

#camera-modal.landscape-mode #zoom-value {
    font-size: 11px;
    text-align: center;
}

/* Flash/torch button adjustments */
#camera-modal.landscape-mode #toggle-flash-button {
    width: 36px;
    height: 36px;
    align-self: center;
}

/* Main camera buttons stack vertically */
#camera-modal.landscape-mode .camera-buttons {
    flex-direction: column;
    gap: 10px;
    margin-top: 0;
    width: 100%;
}

#camera-modal.landscape-mode .camera-buttons .btn {
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    justify-content: center;
}

/* Capture button gets emphasis in landscape */
#camera-modal.landscape-mode #capture-button {
    background-color: var(--accent-color);
    font-weight: 600;
    padding: 12px;
}

#camera-modal.landscape-mode #switch-camera-button {
    background-color: var(--button-bg);
}

/* Safe area adjustments for landscape devices with notches */
#camera-modal.landscape-mode {
    padding-left: max(env(safe-area-inset-left), 10px);
    padding-right: max(env(safe-area-inset-right), 10px);
    padding-top: max(env(safe-area-inset-top), 10px);
    padding-bottom: max(env(safe-area-inset-bottom), 10px);
}

/* Ensure close button respects safe areas */
#camera-modal.landscape-mode #close-camera-button {
    top: max(env(safe-area-inset-top), 15px);
    right: max(env(safe-area-inset-right), 15px);
}

/* Handle very small landscape screens (phones in landscape) */
@media screen and (max-height: 500px) and (orientation: landscape) {
    #camera-modal.landscape-mode .camera-modal-content {
        height: 95vh;
        padding: 10px;
        gap: 10px;
    }
    
    #camera-modal.landscape-mode .camera-controls-sidebar {
        min-width: 120px;
        gap: 8px;
    }
    
    #camera-modal.landscape-mode .camera-buttons .btn {
        padding: 6px 8px;
        font-size: 12px;
    }
    
    #camera-modal.landscape-mode #close-camera-button {
        width: 32px;
        height: 32px;
        top: 10px;
        right: 10px;
    }
}

/* Handle larger landscape screens (tablets in landscape) */
@media screen and (min-width: 768px) and (orientation: landscape) {
    #camera-modal.landscape-mode .camera-modal-content {
        max-width: 90vw;
        gap: 20px;
    }
    
    #camera-modal.landscape-mode .camera-controls-sidebar {
        min-width: 180px;
        max-width: 220px;
    }
    
    #camera-modal.landscape-mode #camera-stream {
        max-width: 75%;
    }
}
