/**
 * Art Gallery Styles
 * 
 * Refactored to match Equipment Fleet with UCD styling
 * Foundation panel integration with consistent design
 * 
 * @package AstroUtah_Gallery
 * @since 2.2.0
 */

/* ============================================================================
   GALLERY CONTAINER (Two-Panel Layout)
   ============================================================================ */

.ag-gallery-container {
    /* Foundation handles the two-panel grid */
    min-height: 600px;
}

/* ============================================================================
   LEFT PANEL (Selection Panel) - UCD Style
   ============================================================================ */

.ag-selection-panel {
    background: #1f2937;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 12px; /* Rounded corners for container */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); /* Shadow like Equipment Fleet */
}

.ag-selection-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}


/* Selection Content (Scrollable) */
.ag-selection-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    background: #1f2937;
}

/* Custom Scrollbar */
.ag-selection-content::-webkit-scrollbar {
    width: 8px;
}

.ag-selection-content::-webkit-scrollbar-track {
    background: #1f2937;
}

.ag-selection-content::-webkit-scrollbar-thumb {
    background: #374151;
    border-radius: 4px;
}

.ag-selection-content::-webkit-scrollbar-thumb:hover {
    background: #3b82f6;
}

/* ============================================================================
   CATEGORY GROUPS (Accordion - UCD Style)
   ============================================================================ */

.ag-group {
    margin-bottom: 2px;
    border-bottom: 1px solid #374151;
    border-radius: 6px; /* Rounded corners */
    overflow: hidden;
}

.ag-group:last-child {
    border-bottom: none;
}

/* Group Header (Clickable) */
.ag-group-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    gap: 10px;
    background: #2d3748;
    border-radius: 6px; /* Rounded corners */
}

.ag-group-header:hover {
    background: #374151;
}

.ag-group.expanded .ag-group-header {
    background: #374151;
    border-bottom: 1px solid #4b5563;
    border-radius: 6px 6px 0 0; /* Rounded top corners only when expanded */
}

/* Toggle Arrow */
.ag-group-toggle {
    display: flex;
    align-items: center;
    transition: transform 0.3s ease;
    color: #60a5fa;
}

.ag-group.expanded .ag-group-toggle {
    transform: rotate(90deg);
}

/* Group Title */
.ag-group-title {
    flex: 1;
    color: #f3f4f6;
    font-size: 1em;
    font-weight: 500;
}

/* Item Count */
.ag-group-count {
    color: #9ca3af;
    font-size: 0.875em;
}

/* Group Icon */
.ag-group-icon {
    display: flex;
    align-items: center;
    color: #60a5fa;
}

/* Group Items (Collapsible List) */
.ag-group-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
    background: #1f2937;
}

.ag-group.expanded .ag-group-items {
    max-height: 1000px;
    transition: max-height 0.6s ease-in;
}

/* ============================================================================
   ARTWORK LIST ITEMS (UCD Style)
   ============================================================================ */

.ag-item {
    display: flex;
    align-items: center;
    padding: 10px 16px 10px 40px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    gap: 12px;
    background: #1f2937;
    border-radius: 6px; /* Rounded corners */
    margin: 2px 8px;
}

.ag-item:hover {
    background: #374151;
    border-left-color: #60a5fa;
}

.ag-item.selected {
    background: #2d3748;
    border-left-color: #3b82f6;
}

/* Item Thumbnail */
.ag-item-thumb {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    border-radius: 6px; /* Rounded corners */
    overflow: hidden;
    background: #374151;
}

.ag-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Item Content */
.ag-item-content {
    flex: 1;
    min-width: 0;
}

.ag-item-title {
    color: #f3f4f6;
    font-size: 0.9375rem;
    font-weight: 500;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ag-item-artist {
    color: #9ca3af;
    font-size: 0.8125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================================================
   RIGHT PANEL (Display Panel)
   ============================================================================ */

.ag-display-panel {
    background: #111827;
    padding: 20px;
    overflow-y: auto;
    border-radius: 12px; /* Rounded corners for right panel */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); /* Shadow like Equipment Fleet */
}

.ag-display-container {
    min-height: 400px;
}

/* ============================================================================
   WELCOME MESSAGE
   ============================================================================ */

.ag-welcome {
    text-align: center;
    padding: 60px 20px;
    color: #808080;
    background: #1a1a1a;
    border-radius: 12px; /* Rounded corners */
    margin: 20px;
}

.ag-welcome-icon {
    margin-bottom: 20px;
    color: #60a5fa;
    opacity: 0.5;
}

.ag-welcome h3 {
    color: #ffffff;
    font-size: 1.8em;
    margin: 0 0 15px 0;
}

.ag-welcome p {
    color: #a0a0a0;
    font-size: 1.1em;
    line-height: 1.6;
    max-width: 500px;
    margin: 0 auto;
}

/* ============================================================================
   ARTWORK DISPLAY (Right Panel Content)
   ============================================================================ */

.ag-artwork-display {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Content Grid - Info Panel + Image Side by Side */
.ag-content-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 20px;
    align-items: start;
}

.ag-info-section {
    min-width: 0;
}

.ag-image-section {
    position: sticky;
    top: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Download Button Section (Above Image) */
.ag-download-section {
    display: flex;
    justify-content: center;
}

/* Download Button */
.ag-download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: #3b82f6;
    color: #ffffff;
    border: none;
    border-radius: 8px; /* Rounded corners */
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.ag-download-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    color: #ffffff;
}

.ag-download-btn:active {
    transform: translateY(0);
}

.ag-download-btn svg {
    flex-shrink: 0;
}

/* ============================================
   DOWNLOAD BUTTON OVERLAY & QUOTA DISPLAY
   ============================================ */

/* Image Container - position relative for overlay */
.ag-image-container {
    position: relative;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    background: #f5f5f5;
    margin-bottom: 20px;
}

.ag-full-image {
    width: 100%;
    height: auto;
    display: block;
}

/* Download Button Overlay - positioned at bottom center of image */
.ag-download-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0) 100%);
    pointer-events: none; /* Allow clicking through the gradient */
    opacity: 0; /* Hidden by default */
    transition: opacity 0.3s ease; /* Smooth fade in/out */
}

/* Show overlay when hovering over the image container */
.ag-image-container:hover .ag-download-overlay {
    opacity: 1; /* Show on hover */
}

.ag-download-overlay .ag-download-btn {
    pointer-events: auto; /* But allow clicking the button */
}

/* Download Button */
.ag-download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: #3b82f6;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.ag-download-btn:hover:not(:disabled) {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.ag-download-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.ag-download-btn.quota-exceeded {
    background: #ef4444;
}

.ag-download-btn.success {
    background: #10b981;
}

.ag-download-btn svg {
    flex-shrink: 0;
}

/* Quota Section (below image) */
.ag-quota-section {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

/* Quota Indicator */
.ag-quota-indicator {
    font-size: 0.875rem;
    color: #64748b;
    min-height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px 16px;
    background: #f1f5f9;
    border-radius: 6px;
}

.ag-quota-indicator.unlimited {
    color: #10b981;
    font-weight: 500;
    background: #f0fdf4;
}

.ag-quota-indicator.low {
    color: #f59e0b;
    font-weight: 500;
    background: #fefce8;
}

.ag-quota-indicator.exceeded {
    color: #ef4444;
    font-weight: 600;
    background: #fef2f2;
}

.quota-loading {
    display: inline-flex;
    align-items: center;
    color: #94a3b8;
}

.quota-icon {
    display: inline-flex;
    align-items: center;
    margin-right: 4px;
}

/* Upgrade Prompt */
.ag-upgrade-prompt {
    margin-top: 15px;
    padding: 15px;
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: 8px;
    text-align: center;
}

.ag-upgrade-prompt p {
    margin: 0 0 10px 0;
    color: #92400e;
    font-size: 0.9rem;
}

.ag-upgrade-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #f59e0b;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.ag-upgrade-btn:hover {
    background: #d97706;
    color: #ffffff;
}

.ag-login-prompt {
    margin-top: 0;
    padding: 20px 24px;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(30, 41, 59, 0.95) 100%);
    border: 1px solid rgba(59, 130, 246, 0.35);
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(8px);
    width: 100%;
}

.ag-login-prompt-icon {
    font-size: 1.75rem;
    margin-bottom: 8px;
    display: block;
    filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.5));
}

.ag-login-prompt p {
    margin: 0 0 14px 0;
    font-size: 0.875rem;
    line-height: 1.5;
}

.ag-login-prompt p.ag-login-title {
    color: #e2e8f0;
    font-weight: 600;
    font-size: 0.9375rem;
    margin-bottom: 4px;
}

.ag-login-prompt p.ag-login-message {
    color: #94a3b8;
    font-size: 0.8125rem;
    margin-bottom: 16px;
}

.ag-login-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff !important;
    border-radius: 7px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: 0.01em;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
    transition: all 0.2s ease;
}

.ag-login-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
    text-decoration: none;
}

.ag-quota-indicator.login-required {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #93c5fd;
}

/* Loading spinner animation */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.spin {
    animation: spin 1s linear infinite;
}

/* ============================================================================
   DESCRIPTION SECTION - Blue Information Card
   ============================================================================ */

.ag-description-section {
    margin-top: 20px;
    width: 100%;
    background: #1e3a8a;  /* Blue background */
    border-radius: 8px;
    border-left: 4px solid #60a5fa;  /* Blue left accent */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    padding: 16px;
    color: #e5e7eb;
}

.ag-description-intro {
    margin: 0 0 12px 0;
    line-height: 1.6;
    font-size: 14px;
}

.ag-description-intro strong {
    color: #60a5fa;
}

.ag-description-story {
    color: #e5e7eb;
}

.ag-description-story p {
    margin: 0 0 12px 0;
    line-height: 1.6;
    font-size: 14px;
}

.ag-description-story p:last-child {
    margin-bottom: 0;
}

.ag-description-story strong {
    color: #60a5fa;
}

/* Responsive - Stack on smaller screens */
@media (max-width: 1200px) {
    .ag-content-grid {
        grid-template-columns: 1fr;
    }
    
    .ag-image-section {
        position: static;
        order: 2;
    }
    
    .ag-description-section {
        order: 3;
    }
}

/* ============================================================================
   PHASE 3: UPLOAD TOOLBAR
   ============================================================================ */

/* Wrapper added by render_display_panel so the toolbar sits above the
   display container as a persistent sibling. */
.ag-display-panel-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.ag-upload-toolbar {
    display: flex;
    justify-content: flex-end;
    padding: 0 0 12px 0;
    flex-shrink: 0;
}

.ag-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 18px;
    background: #6b7280;
    border: none;
    border-radius: 7px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.ag-upload-btn:hover { background: #4b5563; }

/* ============================================================================
   PHASE 3: UPLOAD MODAL
   ============================================================================ */

.ag-upload-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.75);
    padding: 20px;
}

.ag-upload-box {
    position: relative;
    background: #1a2235;
    border: 1px solid #2d3748;
    border-radius: 12px;
    padding: 32px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
}

.ag-upload-box h2 {
    font-size: 20px;
    font-weight: 700;
    color: #f1f5f9;
    margin: 0 0 4px;
}

.ag-upload-subtitle {
    font-size: 13px;
    color: #6b7280;
    margin: 0 0 20px;
}

.ag-upload-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    color: #6b7280;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color 0.15s;
}

.ag-upload-modal-close:hover { color: #e5e7eb; }

/* -- Dropzone -- */
.ag-upload-dropzone {
    border: 2px dashed #374151;
    border-radius: 8px;
    background: #111827;
    min-height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
}

.ag-upload-dropzone.ag-dz--dragover {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.06);
}

.ag-upload-dropzone.ag-dz--has-file {
    border-style: solid;
    border-color: #374151;
}

.ag-dz-prompt {
    text-align: center;
    padding: 20px;
    pointer-events: none;
}

.ag-dz-icon {
    font-size: 32px;
    margin-bottom: 8px;
    opacity: 0.6;
}

.ag-dz-prompt p {
    font-size: 14px;
    color: #9ca3af;
    margin: 0 0 6px;
}

.ag-dz-prompt small {
    font-size: 11px;
    color: #4b5563;
}

.ag-dz-browse {
    background: transparent;
    border: none;
    color: #60a5fa;
    cursor: pointer;
    font-size: inherit;
    padding: 0;
    text-decoration: underline;
    pointer-events: auto;
}

.ag-dz-browse:hover { color: #93c5fd; }

.ag-upload-preview {
    width: 100%;
    position: relative;
}

.ag-upload-preview img {
    width: 100%;
    max-height: 200px;
    object-fit: contain;
    display: block;
    border-radius: 6px;
}

.ag-upload-remove-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: #e5e7eb;
    font-size: 18px;
    line-height: 1;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.ag-upload-remove-btn:hover { background: rgba(239, 68, 68, 0.7); }

/* -- Form fields -- */
.ag-upload-fields {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 16px;
}

.ag-upload-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ag-upload-field label {
    font-size: 12px;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ag-upload-field input,
.ag-upload-field select,
.ag-upload-field textarea {
    background: #111827;
    border: 1px solid #374151;
    border-radius: 6px;
    color: #e5e7eb;
    font-size: 14px;
    padding: 8px 12px;
    transition: border-color 0.15s;
    width: 100%;
    box-sizing: border-box;
}

.ag-upload-field input:focus,
.ag-upload-field select:focus,
.ag-upload-field textarea:focus {
    outline: none;
    border-color: #3b82f6;
}

.ag-upload-field textarea { resize: vertical; }

.ag-upload-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.ag-upload-field-hint {
    font-size: 11px;
    color: #4b5563;
    margin-top: 2px;
}

.ag-required { color: #ef4444; margin-left: 2px; }

/* -- Progress bar -- */
.ag-upload-progress {
    height: 4px;
    background: #1f2937;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 12px;
}

.ag-upload-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    border-radius: 2px;
    transition: width 0.2s linear;
    width: 0%;
}

/* -- Error -- */
.ag-upload-error {
    font-size: 13px;
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 12px;
}

/* -- Footer -- */
.ag-upload-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 4px;
}

.ag-upload-cancel-btn {
    padding: 9px 20px;
    background: transparent;
    border: 1px solid #374151;
    border-radius: 7px;
    color: #9ca3af;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

.ag-upload-cancel-btn:hover {
    border-color: #6b7280;
    color: #e5e7eb;
}

.ag-upload-submit-btn {
    padding: 9px 22px;
    background: #3b82f6;
    border: none;
    border-radius: 7px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.ag-upload-submit-btn:hover:not(:disabled) { background: #2563eb; }

.ag-upload-submit-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ============================================================================
   PHASE 3: CAPTURE DETAILS
   ============================================================================ */

.ag-capture-section {
    margin-top: 16px;
    border: 1px solid #1f2937;
    border-radius: 8px;
    overflow: hidden;
}

.ag-capture-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 11px 14px;
    background: #111827;
    border: none;
    color: #9ca3af;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, color 0.15s;
}

.ag-capture-toggle:hover {
    background: #1a2235;
    color: #e5e7eb;
}

.ag-capture-arrow {
    margin-left: auto;
    color: #4b5563;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
}

.ag-capture-arrow--open { transform: rotate(90deg); }

.ag-capture-body {
    padding: 12px 14px 14px;
    background: #0d1117;
}

.ag-capture-rig-name {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #e5e7eb;
    margin: 0 0 10px;
}

.ag-capture-components {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ag-capture-component {
    display: flex;
    flex-direction: column;
    padding: 5px 8px;
    background: #111827;
    border-radius: 5px;
    border-left: 2px solid #1f2937;
}

.ag-capture-comp-name {
    font-size: 13px;
    color: #d1d5db;
}

.ag-capture-comp-sub {
    font-size: 11px;
    color: #4b5563;
    margin-top: 1px;
}

/* ============================================================================
   PHASE 3: UPLOADER ACTIONS
   ============================================================================ */

.ag-uploader-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

.ag-delete-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 6px;
    color: #9ca3af;
    font-size: 12px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.ag-delete-upload-btn:hover {
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.6);
    background: rgba(239, 68, 68, 0.06);
}

/* ============================================================================
   PHASE 3: GALLERY TOAST
   ============================================================================ */

.ag-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 11000;
    padding: 10px 22px;
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 8px;
    color: #e5e7eb;
    font-size: 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    pointer-events: none;
}

/* ============================================================================
   RESPONSIVE BREAKPOINTS
   ============================================================================ */

@media (max-width: 768px) {
    
    .ag-item {
        padding: 8px 12px 8px 30px;
        margin: 2px 4px;
    }
    
    .ag-item-thumb {
        width: 40px;
        height: 40px;
    }
    
    .ag-display-panel {
        padding: 15px;
    }
    
    .ag-artwork-image {
        padding: 15px;
    }
    
    .ag-description-section {
        padding: 15px;
        margin-top: 15px;
    }
    
    .ag-download-btn {
        font-size: 0.875rem;
        padding: 10px 20px;
    }
}

/* ============================================================================
   ACCESSIBILITY
   ============================================================================ */

/* Focus styles */
.ag-item:focus,
.ag-group-header:focus {
    outline: 2px solid #60a5fa;
    outline-offset: -2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .ag-item:hover,
    .ag-item.selected {
        border-left-width: 4px;
    }
    
    .ag-group-header:hover {
        background: #4b5563;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .ag-group-items,
    .ag-artwork-display,
    .ag-group-toggle,
    .ag-download-btn {
        transition: none;
        animation: none;
    }
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */

@media print {
    .ag-selection-panel {
        display: none;
    }
    
    .ag-display-panel {
        background: #ffffff;
        padding: 0;
    }
    
    .ag-content-grid {
        grid-template-columns: 1fr;
    }
    
    .ag-download-btn {
        display: none;
    }
}

/* =============================================================================
   BMAC PROMPT SYSTEM — Toast & Modal
   ============================================================================= */

/* ── Toast ── */
#ag-bmac-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 9999;

    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(99, 102, 241, 0.35);
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.45);
    max-width: calc(100vw - 32px);
    pointer-events: auto;
}

#ag-bmac-toast.ag-bmac-toast--visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.ag-bmac-toast-msg {
    color: #e2e8f0;
    font-size: 0.875rem;
    white-space: nowrap;
}

.ag-bmac-toast-link {
    color: #fbbf24;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s;
}

.ag-bmac-toast-link:hover { color: #fde68a; }

.ag-bmac-toast-close {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 2px 4px;
    border-radius: 4px;
    transition: color 0.2s;
    flex-shrink: 0;
}

.ag-bmac-toast-close:hover { color: #94a3b8; }

/* ── Modal (bottom sheet) ── */
#ag-bmac-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0);
    transition: background 0.3s ease;
    pointer-events: none;
}

#ag-bmac-modal.ag-bmac-modal--visible {
    background: rgba(0, 0, 0, 0.55);
    pointer-events: auto;
}

.ag-bmac-modal-sheet {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    width: 100%;
    max-width: 480px;
    background: #0f172a;
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-bottom: none;
    border-radius: 20px 20px 0 0;
    padding: 28px 24px 32px;
}

#ag-bmac-modal.ag-bmac-modal--visible .ag-bmac-modal-sheet {
    transform: translateX(-50%) translateY(0);
}

.ag-bmac-modal-heading {
    font-size: 1.1rem;
    font-weight: 700;
    color: #f1f5f9;
    margin: 0 0 10px;
}

.ag-bmac-modal-body {
    font-size: 0.9rem;
    color: #94a3b8;
    line-height: 1.6;
    margin: 0 0 20px;
}

.ag-bmac-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ag-bmac-modal-cta {
    display: block;
    text-align: center;
    padding: 12px 20px;
    border-radius: 10px;
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
    color: #0f172a;
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
    transition: opacity 0.2s;
}

.ag-bmac-modal-cta:hover { opacity: 0.9; color: #0f172a; }

.ag-bmac-modal-dismiss {
    background: none;
    border: 1px solid rgba(100, 116, 139, 0.3);
    border-radius: 10px;
    color: #64748b;
    font-size: 0.875rem;
    padding: 10px 20px;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.ag-bmac-modal-dismiss:hover {
    border-color: rgba(100, 116, 139, 0.6);
    color: #94a3b8;
}

@media (max-width: 480px) {
    #ag-bmac-toast { flex-wrap: wrap; justify-content: center; text-align: center; }
    .ag-bmac-toast-msg { white-space: normal; }
}
