/* ==========================================================================
   1. GLOBAL SYSTEM RESETS & MASTER CORE ARCHITECTURE
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

/* Defuse browser-default centering for data elements and system headings */
th, 
.bucket-title,
#control-panel-container .bucket-title,
.bucket-section .bucket-title {
    text-align: left !important;
/*    display: flex !important; */
    justify-content: flex-start !important;
    padding-left: 10px !important;
    margin-left: 0 !important;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #0b0b0c;
    color: #f5f5f7;
    line-height: 1.5;
    overflow-x: hidden;
}

/* Master Shared App View Container */
.matrix-wrapper {
    width: 100%;
    max-width: 1200px;
    margin: 10px auto;
    background: #222222;
    border: 1px solid #2c2c2e;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.6);
    overflow: hidden;
    min-height: 85vh;
    display: flex;
    flex-direction: column;
}

#photoGrid {
    flex: 1 0 auto; /* 👈 Forces the main grid area to puff up and fill all empty vertical space */
}

.app-bg-dark {
    background-color: #0b0b0c;
}

/* Global System Footer Pad Space */
.gallery-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 24px 0;
}


/* ==========================================================================
   2. BUTTON CONTROL CONTRAST INFRASTRUCTURE
   ========================================================================== */
.header-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

.header-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 175px;
    background: #007aff;
    color: white !important;
    border: none;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    transition: transform 0.1s, background-color 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
    justify-content: center;
}

.header-btn:active {
    transform: scale(0.95);
}

.header-btn-secondary {
    background: rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.header-btn-secondary:hover {
    background: rgba(0, 0, 0, 0.65) !important;
}

/* ==========================================================================
   3. DECOUPLED QR CODE & MODAL LAYOUT INFRASTRUCTURE
   ========================================================================== */

/* Mini QR Header Target Wrapper Box */
#mini-qr-target div {
    background: #ffffff;
    padding: 6px;
    border-radius: 8px;
    border: 1px solid #3a3a3c;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* Mini QR Header Target Sizing */
#header-mini-qr {
    width: 50px;
    height: 50px;
    display: block;
}

/* Modal UI Content Block Formatting */
.modal-content h2 {
    color: #ffffff;
    font-size: 1.25rem;
    margin-bottom: 8px;
    font-weight: 600;
}

.modal-content p {
    color: #8e8e93;
    font-size: 0.85rem;
    margin-bottom: 20px;
}

/* Lightbox Modal High-Res Target Container Box */
.modal-content .qr-container {
    background: #ffffff;
    padding: 16px;
    border-radius: 12px;
    display: inline-block;
    margin-bottom: 20px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

/* Large Modal QR Asset Image Dimensions */
#lightbox-large-qr {
    width: 220px;
    height: 220px;
    display: block;
}

/* Enforce fluid alignment inside modal structures */
.modal-content .header-btn {
    width: 100%;
}

/* Zero-Flash Privacy Guardrails */
.header-controls [hidden],
#eventHero [hidden],
[hidden] {
    display: none !important;
}

/* ==========================================================================
   4. LIGHTBOX & SYSTEM OVERLAY WINDOW MODULES
   ========================================================================== */
.overlay,
.modal-overlay-shroud {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

.lightbox-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#lightboxImg {
    max-width: 100%;
    max-height: 92vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 25px;
    color: #8e8e93;
    font-size: 2rem;
    font-weight: 300;
    cursor: pointer;
    z-index: 100001;
    transition: color 0.2s ease;
    user-select: none;
}
.close-btn:hover { 
    color: #ffffff; 
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    padding: 20px 15px;
    font-size: 2rem;
    cursor: pointer;
    z-index: 100000;
    border-radius: 8px;
    transition: background 0.2s;
}
.lightbox-nav:hover { background: rgba(255, 255, 255, 0.2); }
.prev-btn { left: 10px; }
.next-btn { right: 10px; }

/* Modal Content Base Grid Wrapper */
.modal-content {
    background: #1c1c1e;
    padding: 40px;
    border-radius: 24px;
    width: 90%;
    max-width: 450px;
    border: 1px solid #2c2c2e;
    position: relative;
    z-index: 100000;
}

/* Active Visibility Handlers */
.modal-overlay-shroud.modal-visible,
#userProfileModal.modal-visible {
    display: flex !important;
}

/* ==========================================================================
   5. REAL-TIME ASYNC SYSTEM PROGRESS TOAST
   ========================================================================== */
.upload-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #1c1c1e;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    z-index: 9999;
    width: 90%;
    max-width: 400px;
    border: 1px solid #3a3a3c;
}

.upload-toast p {
    text-align: center;
    margin: 0;
    font-size: 0.85rem;
    color: #ffffff;
}

.progress-bar {
    height: 6px;
    background: #2c2c2e;
    border-radius: 3px;
    margin-top: 10px;
    overflow: hidden;
}

#progressFill {
    height: 100%;
    background: #007aff;
    width: 0%;
    transition: width 0.3s ease;
}

/* ==========================================================================
   6. GLOBAL APP FRAMEWORK INFRASTRUCTURE & LAYOUT TOKENS
   ========================================================================== */
.modal-display-flex { display: flex !important; }
.field-label {
    font-size: 0.75rem;
    color: #8e8e93;
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.panel-title-hero { font-size: 2rem; letter-spacing: -1px; margin-bottom: 10px; }
.panel-subtitle-hero { color: #8e8e93; margin-bottom: 30px; }
.panel-subtitle-hero a { color: inherit; text-decoration: none; opacity: 0.85; }
.panel-subtitle-hero a:hover { color: #007aff; opacity: 1; }
.panel-login-form-wrap { max-width: 320px; margin: 0 auto; }
.panel-error-toast { color: #ff453a; margin-top: 20px; font-weight: 600; display: none; }
.panel-title { font-size: 1.6rem; font-weight: 800; }

.login-subcontrol { font-size: 0.75rem; color: #5a5a65; opacity: 0.85; margin: 20px 0; text-align: center; }
.login-subcontrol a { color: inherit; text-decoration: none; transition: color 0.2s ease; }
.login-subcontrol a:hover { color: #6d6d7a; opacity: 1; }

.display-none,
#eventHero .header-controls.display-none,
#eventHero.display-none {
    display: none !important;
}

/* ==========================================================================
   7. GLOBAL HEADER ENGINE & SHARED OVERLAY ARCHITECTURE (Unified Migrations)
   ========================================================================== */

/* --- PUBLIC DISPLAY ENGINE (Media/Gallery Variant) --- */
#eventHero {
    background-size: cover;
    background-position: center;
    position: relative;
    transition: background-image 0.8s ease-in-out;
    min-height: 280px;
    display: flex !important;
    align-items: flex-end;
    padding: 32px;
    border-radius: 0 0 24px 24px;
    overflow: hidden;
    margin-top: 0 !important;
    margin-bottom: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

#eventHero::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.85) 100%);
    z-index: 1;
}

.hero-flex-container {
    position: relative;
    z-index: 2;
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: flex-end !important;
    width: 100% !important;
}

.hero-text {
    padding-right: 20px;
}

.hero-text h1 {
    font-size: 2.2rem;
    margin: 0;
    color: #ffffff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.8);
    font-weight: 800;
    letter-spacing: -0.03em;
}

.hero-text p {
    font-size: 1rem;
    color: #a1a1aa;
    margin: 6px 0 0 0;
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

/* --- ADMIN & WORKSPACE variant HEADER --- */
.panel-header-flex {
    padding: 30px;
    background: #1c1c1e;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #2c2c2e;
}

/* --- CORE CONTROL ALIGNMENTS --- */
#eventHero #headerControls,
#eventHero .header-controls,
.panel-header-flex .header-controls {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;
    justify-content: flex-end !important;
    gap: 8px !important;
    width: auto !important;
    min-width: 140px;
}

/* Lightbox Modal Sizing Override Injection */
#qrLightboxOverlay .modal-content {
    background: #1c1c1e !important;
    padding: 35px !important;
    border-radius: 24px !important;
    border: 1px solid #2c2c2e !important;
    text-align: center !important;
}
