/* ==========================================
   AS HOSTED GALLERIES - COMPLETE STYLES v2.3
   Gallery Display with Hero, Stats, Grid, Modal
   - Hero: full-width gradient
   - Content: constrained to 1200px/90%
   - Download: toggle mode (single button reveals toolbar)
   ========================================== */

/* Google Font Import */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;600;700;900&display=swap');

/* ==========================================
   GALLERY WRAPPER - Full width for hero
   ========================================== */

.ashg-gallery-wrapper {
    width: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.ashg-gallery-wrapper * {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Error message styling */
.ashg-error-message {
    max-width: 1200px;
    width: 90%;
    margin: 20px auto;
    padding: 20px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    color: #721c24;
    text-align: center;
}

.ashg-error-message code {
    background: rgba(0,0,0,0.1);
    padding: 2px 6px;
    border-radius: 3px;
}

/* ==========================================
   HERO SECTION - Full width gradient
   ========================================== */

.ashg-gallery-hero {
    width: 100%;
    padding: 80px 24px;
    text-align: center;
    background: linear-gradient(135deg, #0d3b66 0%, #1976d2 35%, #00a878 65%, #4ecdc4 100%);
    position: relative;
    overflow: hidden;
}

.ashg-gallery-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(0, 168, 120, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(78, 205, 196, 0.2) 0%, transparent 50%);
}

.ashg-hero-content {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
}

.ashg-hero-title {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: clamp(36px, 5vw, 56px);
    font-weight: 900;
    color: #ffffff;
    margin: 0 0 12px 0;
    line-height: 1.1;
    text-shadow: 2px 4px 12px rgba(0, 0, 0, 0.3);
    letter-spacing: -0.02em;
}

.ashg-hero-location {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: clamp(16px, 2vw, 20px);
    color: #ffffff;
    margin: 0;
    font-weight: 300;
    text-shadow: 1px 2px 6px rgba(0, 0, 0, 0.3);
    opacity: 0.9;
}

/* ==========================================
   STATS SECTION - White background, constrained
   ========================================== */

.ashg-stats-section {
    width: 100%;
    background: #ffffff;
    padding: 60px 24px;
    border-bottom: 1px solid #e9ecef;
}

.ashg-stats-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
}

.ashg-stat-box {
    padding: 20px;
}

/* Stat label - teal, uppercase, ABOVE value */
.ashg-stat-label {
    color: #00a878;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 8px;
    display: block;
}

/* Stat value - dark blue */
.ashg-stat-value,
.ashg-stat-number {
    font-size: clamp(24px, 3vw, 32px);
    font-weight: 700;
    color: #0d3b66;
    line-height: 1.2;
}

/* ==========================================
   DOWNLOAD TOGGLE BUTTON - Initial state
   ========================================== */

.ashg-download-toggle-section {
    width: 100%;
    background: #ffffff;
    padding: 20px 24px;
    border-bottom: 1px solid #e9ecef;
    text-align: center;
}

.ashg-download-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: #0d3b66;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ashg-download-toggle-btn:hover {
    background: #0a2d4d;
    transform: translateY(-1px);
}

.ashg-download-toggle-btn svg {
    flex-shrink: 0;
}

/* ==========================================
   SELECTION TOOLBAR - Hidden until toggled
   ========================================== */

#ashg-selection-toolbar {
    display: none;
    width: 100%;
    background: #f5f5f5;
    padding: 20px 24px;
    border-bottom: 1px solid #e9ecef;
}

#ashg-selection-toolbar.ashg-toolbar-visible {
    display: block;
}

.ashg-toolbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    max-width: 1200px;
    width: 90%;
    margin: 0 auto;
}

.ashg-select-all-section {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #333;
}

#ashg-select-all {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #00a878;
}

.ashg-select-all-label {
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
}

.ashg-selection-count {
    color: #666;
    font-size: 14px;
}

.ashg-download-buttons {
    display: flex;
    gap: 12px;
    align-items: center;
}

.ashg-download-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Download Selected - Outline style */
.ashg-download-btn#ashg-download-selected {
    background: transparent;
    color: #00a878;
    border: 2px solid #00a878;
}

.ashg-download-btn#ashg-download-selected:hover:not(:disabled) {
    background: #00a878;
    color: white;
}

/* Download All - Solid style */
.ashg-download-btn#ashg-download-all {
    background: #0d3b66;
    color: white;
    border: 2px solid #0d3b66;
}

.ashg-download-btn#ashg-download-all:hover:not(:disabled) {
    background: #0a2d4d;
    border-color: #0a2d4d;
}

.ashg-download-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Cancel button */
.ashg-cancel-btn {
    background: transparent;
    color: #666;
    border: 2px solid #ccc;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ashg-cancel-btn:hover {
    border-color: #999;
    color: #333;
}

/* ==========================================
   PHOTO GRID SECTION - Constrained width
   ========================================== */

.ashg-gallery-section {
    width: 100%;
    padding: 40px 24px 80px;
    background: #ffffff;
}

.ashg-photo-grid {
    display: grid;
    gap: 20px;
    margin: 0 auto 40px;
    max-width: 1200px;
    width: 90%;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

/* Dynamic column classes */
.ashg-photo-grid[data-columns="2"] {
    grid-template-columns: repeat(2, 1fr);
}

.ashg-photo-grid[data-columns="3"] {
    grid-template-columns: repeat(3, 1fr);
}

.ashg-photo-grid[data-columns="4"] {
    grid-template-columns: repeat(4, 1fr);
}

.ashg-photo-grid[data-columns="5"] {
    grid-template-columns: repeat(5, 1fr);
}

/* ==========================================
   PHOTO CARDS
   ========================================== */

.ashg-photo-item {
    position: relative;
    background: #f5f5f5;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.ashg-photo-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* Image container */
.ashg-photo-link {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 3 / 2;
    background: #e8e8e8;
    overflow: hidden;
}

.ashg-photo-item img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Lazy loading states */
.ashg-photo-item img.ashg-lazy-image:not([src]) {
    opacity: 0;
}

.ashg-photo-item img.ashg-lazy-image[src],
.ashg-photo-item img.ashg-loaded {
    opacity: 1;
}

.ashg-photo-item:hover img {
    transform: scale(1.02);
}

/* Caption */
.ashg-photo-caption {
    padding: 12px 16px;
    background: white;
    color: #333;
    font-size: 0.875rem;
    font-weight: 500;
    border-top: 1px solid #e5e5e5;
}

.ashg-photo-persons {
    padding: 12px 16px;
    background: white;
    color: #333;
    font-size: 0.875rem;
    font-weight: 500;
    border-top: 1px solid #e5e5e5;
}

/* Photo checkbox - Hidden until selection mode */
.ashg-photo-checkbox-wrapper {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
    display: none;
}

.ashg-photo-checkbox-wrapper.ashg-checkbox-visible {
    display: block;
}

.ashg-photo-checkbox {
    width: 22px;
    height: 22px;
    cursor: pointer;
    accent-color: #00a878;
}

/* ==========================================
   INFINITE SCROLL INDICATORS
   ========================================== */

.ashg-infinite-loader,
.ashg-infinite-end {
    text-align: center;
    padding: 40px 20px;
    margin: 20px auto;
    max-width: 1200px;
    width: 90%;
}

.ashg-loader-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 16px;
    border: 4px solid #e5e5e5;
    border-top-color: #00a878;
    border-radius: 50%;
    animation: ashg-spin 0.8s linear infinite;
}

@keyframes ashg-spin {
    to { transform: rotate(360deg); }
}

.ashg-infinite-loader p,
.ashg-infinite-loader span,
.ashg-infinite-end {
    color: #666;
    font-size: 0.875rem;
    font-weight: 500;
}

/* ==========================================
   MODAL OVERLAY
   ========================================== */

.ashg-photo-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
}

.ashg-photo-modal.ashg-modal-visible {
    display: block;
}

.ashg-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 99999;
    animation: ashg-fadeIn 0.3s ease-out;
}

@keyframes ashg-fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

body.ashg-modal-open {
    overflow: hidden;
}

/* ==========================================
   MODAL CONTAINER
   ========================================== */

.ashg-modal-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.ashg-modal-content {
    position: relative;
    width: 100%;
    max-width: 1200px;
    max-height: 90vh;
    background: #e8e8e8;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: ashg-slideUp 0.3s ease-out;
}

@keyframes ashg-slideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================
   MODAL HEADER
   ========================================== */

.ashg-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #0d3b66 0%, #1a5a8a 100%);
}

.ashg-modal-header-persons {
    font-size: 1.125rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
    flex: 1;
    padding-right: 20px;
}

.ashg-modal-close-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.ashg-modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* ==========================================
   MODAL IMAGE
   ========================================== */

.ashg-modal-image-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e8e8e8;
    overflow: hidden;
    position: relative;
    min-height: 300px;
    padding: 12px;
    box-sizing: border-box;
}

#ashg-modal-image {
    max-width: calc(100% - 24px);
    max-height: calc(100% - 24px);
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

/* ==========================================
   MODAL FOOTER
   ========================================== */

.ashg-modal-footer {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 16px 20px;
    background: #d8d8d8;
    border-top: 1px solid #ccc;
    flex-wrap: wrap;
}

.ashg-metadata-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    color: #333;
}

.ashg-metadata-label {
    color: #0d8a8a;
    font-weight: 600;
}

.ashg-modal-download-btn {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #00a878;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ashg-modal-download-btn:hover {
    background: #00c78a;
    transform: translateY(-1px);
}

.ashg-modal-download-btn svg {
    flex-shrink: 0;
}

/* ==========================================
   MODAL NAVIGATION
   ========================================== */

.ashg-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.ashg-modal-nav:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: translateY(-50%) scale(1.1);
}

.ashg-modal-prev { left: 16px; }
.ashg-modal-next { right: 16px; }

/* ==========================================
   FLASH NOTIFICATION
   ========================================== */

#ashg-flash-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100001;
    padding: 24px 40px;
    background: #10b981;
    color: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: ashg-flash-fadeIn 0.3s ease-out;
    min-width: 300px;
    justify-content: center;
}

#ashg-flash-modal.error { background: #ef4444; }
#ashg-flash-modal.warning { background: #f59e0b; }

.ashg-flash-icon { font-size: 24px; flex-shrink: 0; }
.ashg-flash-message { line-height: 1.4; }

@keyframes ashg-flash-fadeIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes ashg-flash-fadeOut {
    from { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    to { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */

@media (max-width: 1024px) {
    .ashg-photo-grid[data-columns="5"] { grid-template-columns: repeat(3, 1fr); }
    .ashg-photo-grid[data-columns="4"] { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .ashg-gallery-hero {
        padding: 60px 24px;
    }
    
    .ashg-hero-title {
        font-size: 2rem;
    }
    
    .ashg-stats-section {
        padding: 40px 24px;
    }
    
    .ashg-stats-container {
        gap: 20px;
    }
    
    .ashg-stat-box {
        padding: 12px 8px;
    }
    
    .ashg-stat-value,
    .ashg-stat-number {
        font-size: 20px;
    }
    
    .ashg-stat-label {
        font-size: 11px;
        letter-spacing: 1px;
    }
    
    .ashg-gallery-section {
        padding: 30px 16px 60px;
    }
    
    .ashg-photo-grid,
    .ashg-photo-grid[data-columns="2"],
    .ashg-photo-grid[data-columns="3"],
    .ashg-photo-grid[data-columns="4"],
    .ashg-photo-grid[data-columns="5"] {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        width: 100%;
    }
    
    .ashg-modal-content {
        margin: 0;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .ashg-modal-nav {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .ashg-modal-prev { left: 8px; }
    .ashg-modal-next { right: 8px; }
    
    .ashg-modal-header,
    .ashg-modal-footer {
        padding: 12px 16px;
    }
    
    .ashg-modal-header-persons {
        font-size: 1rem;
    }
    
    .ashg-modal-footer {
        gap: 12px;
    }
    
    .ashg-metadata-item {
        font-size: 0.8125rem;
    }
    
    /* Toolbar responsive */
    #ashg-selection-toolbar {
        padding: 16px;
    }
    
    .ashg-toolbar-container {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }
    
    .ashg-download-buttons {
        flex-direction: column;
    }
    
    .ashg-download-btn,
    .ashg-cancel-btn {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .ashg-hero-title {
        font-size: 1.5rem;
    }
    
    .ashg-hero-location {
        font-size: 1rem;
    }
    
    .ashg-stat-value,
    .ashg-stat-number {
        font-size: 16px;
    }
    
    .ashg-stat-label {
        font-size: 10px;
    }
    
    .ashg-photo-grid,
    .ashg-photo-grid[data-columns="2"],
    .ashg-photo-grid[data-columns="3"],
    .ashg-photo-grid[data-columns="4"],
    .ashg-photo-grid[data-columns="5"] {
        grid-template-columns: 1fr;
    }
    
    #ashg-flash-modal {
        padding: 20px 32px;
        font-size: 16px;
        min-width: 280px;
        max-width: 90%;
    }
    
    .ashg-flash-icon {
        font-size: 20px;
    }
}

/* ==========================================
   PRINT STYLES
   ========================================== */

@media print {
    .ashg-photo-modal,
    .ashg-modal-close-btn,
    .ashg-modal-nav,
    #ashg-flash-modal,
    #ashg-selection-toolbar,
    .ashg-download-toggle-section {
        display: none !important;
    }
    
    .ashg-photo-grid {
        display: block;
    }
    
    .ashg-photo-item {
        break-inside: avoid;
        margin-bottom: 20px;
    }
}

/* ==========================================
   GALLERY FEED PAGE (Fallback)
   When no event is specified
   ========================================== */

.ashg-feed-page .ashg-feed-hero {
    padding: 80px 24px;
}

.ashg-feed-page .ashg-hero-description {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: clamp(16px, 2vw, 20px);
    color: #ffffff;
    margin: 0 auto;
    max-width: 800px;
    font-weight: 300;
    text-shadow: 1px 2px 6px rgba(0, 0, 0, 0.3);
    line-height: 1.6;
}

.ashg-feed-intro-section {
    width: 100%;
    background: #ffffff;
    padding: 80px 24px 60px;
}

.ashg-feed-intro {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.ashg-feed-tag {
    color: #00a878;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 12px;
    display: block;
}

.ashg-feed-heading {
    color: #0d3b66;
    font-size: clamp(28px, 4vw, 40px);
    margin: 0 0 16px 0;
    font-weight: 700;
    line-height: 1.2;
}

.ashg-feed-description {
    color: #666666;
    font-size: 18px;
    font-weight: 300;
    line-height: 1.7;
    margin: 0;
}

.ashg-feed-container-section {
    width: 100%;
    background: #ffffff;
    padding: 0 24px 100px;
}

.ashg-feed-container {
    max-width: 1200px;
    width: 90%;
    margin: 0 auto;
}

/* Responsive for feed page */
@media (max-width: 768px) {
    .ashg-feed-page .ashg-feed-hero {
        padding: 60px 24px;
    }
    
    .ashg-feed-intro-section {
        padding: 60px 24px 40px;
    }
    
    .ashg-feed-container-section {
        padding: 0 16px 80px;
    }
    
    .ashg-feed-container {
        width: 100%;
    }
}