/**
 * styles.css — RNSNB Stylesheet (v5.3.13)
 * Extracted from index.php for independent browser caching.
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Creepster:wght@400&display=swap'); /* Using specific weight for better loading */
body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #1f2937, #111827); /* Gradient Dark background */
    color: #d1d5db;
    min-height: 100vh;
    overflow-x: hidden;
}
.container-card {
    background-color: #1f2937;
    border: 1px solid #374151;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}
.btn-brand {
    background: linear-gradient(90deg, #f59e0b, #ef4444); /* Orange-Red Gradient */
    color: white;
    transition: all 150ms ease-in-out; /* Micro-interaction: 150ms. UI: 200ms. Modal/overlay: 300ms */
    transform: scale(1);
}
.btn-brand:hover {
    opacity: 0.9;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
    transform: scale(1.02);
}
#image-preview-container {
    min-height: 250px;
    display: flex;
    flex-direction: column; /* Allow message and image to stack */
    align-items: center;
    justify-content: center;
    
    text-align: center;
    background-color: #0c0f13;
}
.brand-text {
    font-family: 'Creepster', cursive; /* Fun, distinct font for brand */
    text-shadow: 2px 2px #ef4444;
}
/* Custom focus glow for inputs */
.custom-focus-glow:focus {
    outline: none;
    border-color: #f59e0b; /* Yellow/Orange border on focus */
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.8), 0 0 20px rgba(245, 158, 11, 0.4); /* Neon glow effect */
}
/* L-11: Windows High Contrast Mode — box-shadow is invisible, provide outline fallback */
@media (forced-colors: active) {
    .custom-focus-glow:focus {
        outline: 3px solid ButtonText;
    }
}
/* Zoom Modal Styles */
.zoom-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    animation: fadeIn 0.2s ease-in-out;
}
.zoom-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}
.zoom-modal img {
    max-width: 95%;
    max-height: 95vh;
    object-fit: contain;
    animation: zoomIn 0.3s ease-in-out;
}
.zoom-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 40px;
    font-weight: bold;
    color: #f59e0b;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10000;
    user-select: none;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.zoom-close:hover {
    color: #ef4444;
    transform: scale(1.1);
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes zoomIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Screen reader only utility (Accessibility - WCAG 2.4.1) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.sr-only.focus\:not-sr-only:focus {
    position: absolute;
    width: auto;
    height: auto;
    padding: 0;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Improved focus indicators (Accessibility - WCAG 2.4.7) */
*:focus-visible {
    outline: 3px solid #fbbf24;
    outline-offset: 2px;
}

/* Prompt Helper Styles */
.prompt-helper-category {
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
}
.prompt-helper-category:hover {
    background-color: rgba(55, 65, 81, 0.5);
}
.prompt-helper-category.active {
    background-color: #374151;
    color: #facc15;
    font-weight: 500;
}
.prompt-helper-item {
    position: relative;
    padding: 0.5rem;
    background-color: #374151;
    border: 1px solid #4b5563;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
    user-select: none;
}
.prompt-helper-item:hover {
    background-color: #4b5563;
    border-color: #6b7280;
    transform: translateY(-1px);
}
.prompt-helper-item.selected {
    background-color: #065f46;
    border-color: #10b981;
    color: #10b981;
}
.prompt-helper-item.favorite {
    position: relative;
}
.prompt-helper-item.favorite::before {
    content: '⭐';
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 0.75rem;
}
#prompt-helper-modal .modal-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: #4b5563 #1f2937;
}
#prompt-helper-modal .modal-scrollbar::-webkit-scrollbar {
    width: 8px;
}
#prompt-helper-modal .modal-scrollbar::-webkit-scrollbar-track {
    background: #1f2937;
}
#prompt-helper-modal .modal-scrollbar::-webkit-scrollbar-thumb {
    background: #4b5563;
    border-radius: 4px;
}
#prompt-helper-modal .modal-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* Mobile responsiveness for Prompt Helper */
@media (max-width: 640px) {
    .prompt-helper-category {
        padding: 0.375rem 0.5rem;
        font-size: 0.75rem;
    }
    .prompt-helper-item {
        padding: 0.375rem;
        font-size: 0.75rem;
    }
    .prompt-helper-item.favorite::before {
        font-size: 0.625rem;
        top: 1px;
        right: 2px;
    }
    /* Export menu as bottom sheet on mobile */
    #export-menu.mobile-bottom-sheet {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        top: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        border-radius: 1rem 1rem 0 0 !important;
        padding-bottom: env(safe-area-inset-bottom, 1rem);
    }
    /* Action buttons 2x2 grid on mobile */
    #image-output-controls {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 0.75rem !important;
    }
    #image-output-controls > * {
        width: 100% !important;
    }
    #image-output-controls > .relative {
        grid-column: span 1;
    }
}

/* Prompt Helper selection checkmark indicator */
.prompt-helper-item.selected::after {
    content: '✓';
    position: absolute;
    top: 2px;
    left: 4px;
    font-size: 0.75rem;
    color: #10b981;
    font-weight: bold;
}
/* Gallery thumbnail hover tooltip */
.gallery-thumbnail {
    position: relative;
    overflow: hidden;
}
/* Dark overlay on hover */
.gallery-thumbnail::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1;
}
/* Centered text on hover */
.gallery-thumbnail::after {
    content: 'Click to iterate';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #facc15;
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 2;
}
.gallery-thumbnail:hover::before,
.gallery-thumbnail:hover::after {
    opacity: 1;
}
@media (hover: none) {
    .gallery-thumbnail::before,
    .gallery-thumbnail::after {
        display: none; /* Hide overlay and tooltip on touch/non-hover devices */
    }
}

/* Professional Controls 2-column grid on desktop */
@media (min-width: 640px) {
    #professional-controls-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem 1.5rem;
        align-items: end;
    }
    /* Override space-y-4 margin in grid layout for proper alignment */
    #professional-controls-grid > div {
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }
    /* Ensure consistent label styling */
    #professional-controls-grid > div > label {
        display: block;
        height: 1.25rem;
        line-height: 1.25rem;
        margin-bottom: 0.25rem !important;
    }
    /* Ensure consistent select styling */
    #professional-controls-grid > div > select {
        height: 2.5rem;
    }
    #professional-controls-grid > p {
        grid-column: span 2;
        margin-top: 0.5rem !important;
    }
}

/* Gallery scroll indicator */
#gallery-grid {
    position: relative;
}
#gallery-grid.gallery-scrollable {
    max-height: 624px; /* 6 rows: 6 * (96px + 8px gap) = 624px */
    overflow-y: auto;
    padding-right: 4px; /* Space for scrollbar */
}
/* Empty state animation */
.empty-state-icon {
    animation: gentleBounce 3s ease-in-out infinite;
}
@keyframes gentleBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* Loading animation - bounce + spin */
.loading-banana {
    animation: bounceSpin 1.5s ease-in-out infinite;
    display: inline-block;
}
@keyframes bounceSpin {
    0% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-15px) rotate(90deg); }
    50% { transform: translateY(0) rotate(180deg); }
    75% { transform: translateY(-15px) rotate(270deg); }
    100% { transform: translateY(0) rotate(360deg); }
}

/* @Mention Autocomplete Dropdown */
#mention-dropdown {
    min-width: 200px;
    max-width: 300px;
}
.mention-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    gap: 8px;
}
.mention-item:hover, .mention-item.selected {
    background-color: #374151;
}
.mention-item img {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}
.mention-item span {
    color: #facc15;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* 3D Camera Control Widget */
#camera3d-canvas {
    display: block;
    touch-action: none;
}
#camera3d-canvas-wrapper {
    background: #1a1a1a;
    border-radius: 12px;
}
#cam-prompt-overlay {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    padding: 8px 16px;
    border-radius: 8px;
    font-family: monospace;
    font-size: 12px;
    color: #00ff88;
    white-space: nowrap;
    z-index: 10;
    pointer-events: none;
}
.cam-number-input {
    width: 60px;
    background: #111827;
    border: 1px solid #374151;
    border-radius: 6px;
    color: #facc15;
    font-family: monospace;
    font-size: 16px; /* Prevents iOS Safari auto-zoom */
    padding: 2px 6px;
    text-align: right;
    outline: none;
}
.cam-number-input:focus {
    border-color: #facc15;
    box-shadow: 0 0 8px rgba(250, 204, 21, 0.4); /* Neon glow effect on focus */
}
.cam-slider-track::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #facc15;
    cursor: pointer;
    border: 2px solid #111827;
}
.cam-slider-track::-moz-range-thumb {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #facc15;
    cursor: pointer;
    border: 2px solid #111827;
}
.cam-slider-track {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, #f59e0b, #6b7280);
    outline: none;
}
