/* ==========================================
   FAMILY PHOTO VAULT - STYLING CORE
   ========================================== */

/* Global Reset & Base Variables */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #121212;
    color: #e0e0e0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    padding-bottom: 50px;
}

/* Splash Page / Password Wall Overlay */
#splash-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #0a0a0a;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    padding: 20px;
}

.modal {
    background-color: #1e1e1e;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 40px 30px;
    max-width: 500px;
    width: 100%;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.modal h2 {
    margin-bottom: 20px;
    color: #ffffff;
    font-size: 1.6rem;
}

.modal p {
    font-size: 0.9rem;
    text-align: left;
    color: #aaaaaa;
    margin-bottom: 25px;
    background: #262626;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #007bff;
}

.modal input[type="password"] {
    width: 100%;
    padding: 12px;
    background-color: #2a2a2a;
    border: 1px solid #444;
    border-radius: 6px;
    color: #fff;
    font-size: 1rem;
    margin-bottom: 15px;
    text-align: center;
}

.modal input[type="password"]:focus {
    border-color: #007bff;
    outline: none;
}

.modal button {
    width: 100%;
    padding: 12px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s ease;
}

.modal button:hover {
    background-color: #0056b3;
}

/* Language Switcher Dropdown (Top Right) */
.lang-switcher-container {
    position: absolute;
    top: 25px;
    right: 25px;
}

.lang-switcher-container select {
    padding: 6px 12px;
    font-size: 0.85rem;
    background-color: #1e1e1e;
    color: #fff;
    border: 1px solid #444;
    border-radius: 4px;
    cursor: pointer;
}

/* Main Layout Architecture */
#gallery-container {
    display: none; 
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

header h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #ffffff;
    font-size: 2rem;
    font-weight: 400;
}

/* Event Selector Box */
.collection-selector {
    margin-bottom: 40px;
    text-align: center;
}

.collection-selector label {
    font-size: 1rem;
    color: #b0b0b0;
}

.collection-selector select {
    padding: 12px 20px;
    font-size: 1.1rem;
    width: 100%;
    max-width: 400px;
    background-color: #1e1e1e;
    color: #fff;
    border: 1px solid #444;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 8px;
}

/* ==========================================
   MOBILE-OPTIMIZED RESPONSIVE GRID LAYOUT
   ========================================== */

/* The Core Photo Grid */

#gallery {
    /* Creates a fluid column count system */
    column-count: 2; 
    /* Gap spacing between columns */
    column-gap: 12px; 
    width: 100%;
    padding: 5px;
}

/* Individual Picture Card Structure */
.photo-card {
    background-color: #1e1e1e;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 12px; /* Bottom gap spacing between cascading elements */
    
    /* CRITICAL: Prevents cards from breaking awkwardly in half across columns */
    break-inside: avoid; 
    display: inline-block;
    width: 100%;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

/* Thumbnail Box Fitting Controls */
.photo-card img {
    width: 100%;
    /* CRITICAL: Allows height to adjust naturally based on photo proportions */
    height: auto; 
    /* Ensures no pixels are cropped, regardless of portrait or landscape orientation */
    object-fit: contain; 
    border-radius: 4px;
    background-color: #121212;
    display: block;
}

/* Shrink Action Row footprint slightly for mobile interfaces */
.action-row {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    justify-content: center;
}

.download-btn {
    flex: 1;
    background-color: #28a745;
    color: white;
    text-align: center;
    border: none;
    padding: 6px 4px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s ease;
}

.download-btn:hover {
    background-color: #218838;
}

.remove-btn {
    flex: 1;
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 6px 4px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    transition: background 0.2s ease;
}

.remove-btn:hover {
    background-color: #c82333;
}


/* Large Tablet and Desktop Monitor Layout Modifiers Override */
@media (min-width: 600px) {
    #gallery {
        column-count: 3;
        column-gap: 16px;
    }
    .photo-card {
        margin-bottom: 16px;
        padding: 10px;
    }
}

@media (min-width: 900px) {
    #gallery {
        column-count: 4;
        column-gap: 20px;
    }
}

@media (min-width: 1200px) {
    #gallery {
        column-count: 5;
    }
}


/* ==========================================
   LIGHTBOX OVERLAY LIGHT STYLING EXTENSION
   ========================================== */
#preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(10, 10, 10, 0.95);
    display: none; /* Controlled dynamically by Javascript elements */
    justify-content: center;
    align-items: center;
    z-index: 10000;
    padding: 20px;
}

.preview-content-box {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#preview-img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    border: 1px solid #333;
}

.close-preview-btn {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 2.5rem;
    font-weight: 300;
    cursor: pointer;
    transition: color 0.2s ease;
    user-select: none;
}

.close-preview-btn:hover {
    color: #dc3545;
}

/* Adjust image grid response for mobile touchscreen actions */
.photo-card img:hover {
    opacity: 0.85;
    transition: opacity 0.2s ease;
}
