/**
 * ImageViewer Minimal CSS
 *
 * Contains only styles that cannot be converted to Tailwind inline classes:
 * - Dynamic class modifiers applied by JavaScript
 * - Panzoom zoom state styles
 * - Keyframe animations
 */

/* Panzoom zoom state styles - applied dynamically by ImageViewer */

/* Base image styles for Panzoom compatibility */
.iv-image {
    transform-origin: center center;
    will-change: transform;
}

/* Ready state: user can click to activate zoom */
.iv-zoom-ready {
    cursor: zoom-in;
}

.iv-zoom-ready .iv-image {
    cursor: zoom-in;
}

/* Active state: zoom is enabled, user can scroll to zoom */
.iv-zoom-active {
    cursor: grab;
}

.iv-zoom-active .iv-image {
    cursor: grab;
}

/* Zoomed in state: user is panning */
.iv-zoomed-in {
    cursor: grab;
}

.iv-zoomed-in .iv-image {
    cursor: grab;
}

.iv-zoomed-in:active,
.iv-zoomed-in:active .iv-image {
    cursor: grabbing;
}

/* Disable image transitions during slideshow to prevent flash */
.iv-slideshow-active .iv-image {
    transition: none !important;
}

/* Gradient shift animation for loading placeholders */
@keyframes gradient-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.animate-gradient-shift {
    animation: gradient-shift 2s ease infinite;
}

/* Prompt textarea styles */
.prompt-textarea {
    font-family: inherit;
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 92, 246, 0.3) transparent;
}

.prompt-textarea::-webkit-scrollbar {
    width: 6px;
}

.prompt-textarea::-webkit-scrollbar-track {
    background: transparent;
}

.prompt-textarea::-webkit-scrollbar-thumb {
    background-color: rgba(139, 92, 246, 0.3);
    border-radius: 3px;
}

/* Copy button feedback animation */
.copy-prompt-btn.copied {
    color: #22c55e !important;
    background-color: rgba(34, 197, 94, 0.1) !important;
}

.copy-prompt-btn.copied svg {
    animation: checkmark-pop 0.3s ease-out;
}

@keyframes checkmark-pop {
    0% { transform: scale(0.8); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* =====================================================
   Action Bar Styles (below image)
   ===================================================== */

/* Action bar container - centered below image */
.iv-action-bar {
    display: flex;
    justify-content: center;
    padding: 1.25rem 0;
}

/* Inner container with pill shape - enhanced glassmorphism */
.iv-action-bar-inner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 9999px;
    backdrop-filter: blur(20px);
    box-shadow: 
        0 4px 24px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    animation: iv-action-bar-entrance 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Entry animation - bouncy entrance */
@keyframes iv-action-bar-entrance {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* =====================================================
   Vote Button Styles - Enhanced
   ===================================================== */

/* Base vote button styles */
.iv-vote-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 9999px;
    border: none;
    background: transparent;
    cursor: pointer;
    overflow: hidden;
    transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Ripple effect container */
.iv-vote-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 9999px;
    background: radial-gradient(circle at center, currentColor, transparent 70%);
    opacity: 0;
    transform: scale(0);
    transition: transform 300ms ease-out, opacity 200ms ease-out;
}

.iv-vote-btn:hover::before {
    opacity: 0.1;
    transform: scale(1);
}

.iv-vote-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: scale(1.1) translateY(-2px);
}

.iv-vote-btn:active {
    transform: scale(0.92);
    transition: transform 80ms ease-out;
}

/* Focus visible for accessibility */
.iv-vote-btn:focus-visible {
    outline: 2px solid rgba(139, 92, 246, 0.6);
    outline-offset: 2px;
}

/* Emoji sizing - larger and more prominent */
.iv-vote-emoji {
    font-size: 1.75rem;
    line-height: 1;
    transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1), filter 200ms ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    z-index: 1;
}

.iv-vote-btn:hover .iv-vote-emoji {
    transform: scale(1.2);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

/* Active state - glowing background */
.iv-vote-btn.iv-vote-active {
    background: rgba(255, 255, 255, 0.12);
}

.iv-vote-btn.iv-vote-active .iv-vote-emoji {
    transform: scale(1.15);
    animation: iv-emoji-pulse 2s ease-in-out infinite;
}

@keyframes iv-emoji-pulse {
    0%, 100% { transform: scale(1.15); }
    50% { transform: scale(1.2); }
}

/* Heart active state - pink glow with animation */
.iv-vote-btn-heart.iv-vote-active {
    background: radial-gradient(circle at center, rgba(236, 72, 153, 0.25), rgba(236, 72, 153, 0.1));
    box-shadow: 0 0 20px rgba(236, 72, 153, 0.3);
}

.iv-vote-btn-heart.iv-vote-active .iv-vote-emoji {
    animation: iv-heart-beat 1s ease-in-out infinite;
}

@keyframes iv-heart-beat {
    0%, 100% { transform: scale(1.15); }
    15% { transform: scale(1.3); }
    30% { transform: scale(1.15); }
    45% { transform: scale(1.25); }
    60% { transform: scale(1.15); }
}

/* Like active state - green glow */
.iv-vote-btn-like.iv-vote-active {
    background: radial-gradient(circle at center, rgba(16, 185, 129, 0.25), rgba(16, 185, 129, 0.1));
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.iv-vote-btn-like.iv-vote-active .iv-vote-emoji {
    animation: iv-thumb-wiggle 0.6s ease-in-out;
}

@keyframes iv-thumb-wiggle {
    0%, 100% { transform: scale(1.15) rotate(0deg); }
    25% { transform: scale(1.2) rotate(-10deg); }
    75% { transform: scale(1.2) rotate(10deg); }
}

/* Dislike active state - subtle gray */
.iv-vote-btn-dislike.iv-vote-active {
    background: radial-gradient(circle at center, rgba(156, 163, 175, 0.2), rgba(156, 163, 175, 0.05));
    box-shadow: 0 0 15px rgba(156, 163, 175, 0.2);
}

/* =====================================================
   Vote Button Animations - Enhanced
   ===================================================== */

/* Button bounce animation when voting - more satisfying */
.iv-vote-btn.iv-vote-animating {
    animation: iv-vote-pop 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes iv-vote-pop {
    0% {
        transform: scale(1);
    }
    15% {
        transform: scale(0.75);
    }
    30% {
        transform: scale(1.25);
    }
    45% {
        transform: scale(0.9);
    }
    60% {
        transform: scale(1.1);
    }
    75% {
        transform: scale(0.98);
    }
    100% {
        transform: scale(1);
    }
}

/* Success flash animation */
.iv-vote-btn.iv-vote-success::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 9999px;
    background: transparent;
    border: 2px solid currentColor;
    opacity: 0;
    animation: iv-success-ring 600ms ease-out forwards;
}

@keyframes iv-success-ring {
    0% {
        transform: scale(0.8);
        opacity: 0.8;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Color variants for success ring */
.iv-vote-btn-heart.iv-vote-success::after {
    border-color: #ec4899;
}

.iv-vote-btn-like.iv-vote-success::after {
    border-color: #10b981;
}

.iv-vote-btn-dislike.iv-vote-success::after {
    border-color: #9ca3af;
}

/* Divider between heart and like/dislike */
.iv-divider {
    opacity: 0.3;
    transition: opacity 200ms ease;
}

.iv-action-bar-inner:hover .iv-divider {
    opacity: 0.5;
}

/* Particle flying outward animation */
@keyframes iv-particle-fly {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(0);
        opacity: 0;
    }
}

/* Ring expansion animation */
@keyframes iv-ring-expand {
    0% {
        transform: scale(0.5);
        opacity: 0.8;
    }
    100% {
        transform: scale(3);
        opacity: 0;
    }
}

/* Floating emoji animation (for double-tap heart) */
@keyframes iv-emoji-float {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    15% {
        transform: translate(-50%, -50%) scale(1.3);
        opacity: 1;
    }
    30% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -120%) scale(0.8);
        opacity: 0;
    }
}

/* Ensure particle container doesn't interfere with layout */
.iv-particle-container {
    pointer-events: none;
}

.iv-particle {
    will-change: transform, opacity;
}

.iv-floating-emoji {
    will-change: transform, opacity;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Action button press feedback */
.iv-action-bar-actions button:active {
    transform: scale(0.97);
}

/* =====================================================
   Tab Navigation Styles
   ===================================================== */

/* Tab navigation container */
.iv-tab-nav {
    /* Ensure tabs don't wrap on smaller screens */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
}

.iv-tab-nav::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
}

/* Individual tab styles */
.iv-tab {
    /* Prevent text selection on tabs */
    user-select: none;
    -webkit-user-select: none;
    /* Ensure minimum touch target */
    min-height: 44px;
    /* Prevent shrinking */
    flex-shrink: 0;
}

/* Tab focus state for accessibility */
.iv-tab:focus-visible {
    outline: 2px solid rgba(59, 130, 246, 0.5);
    outline-offset: -2px;
    border-radius: 4px;
}

/* Tab indicator animation */
.iv-tab-indicator {
    animation: iv-tab-indicator-grow 0.2s ease-out;
}

@keyframes iv-tab-indicator-grow {
    from {
        transform: scaleX(0);
    }
    to {
        transform: scaleX(1);
    }
}

/* Tab panel transitions */
.iv-tab-panel {
    animation: iv-tab-panel-fade-in 0.15s ease-out;
}

@keyframes iv-tab-panel-fade-in {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hidden panel state */
.iv-tab-panel.hidden {
    display: none;
}

/* =====================================================
   Details Section Styles
   ===================================================== */

/* Ensure content doesn't get hidden behind fixed action bar */
.iv-details-section {
    padding-bottom: 5rem; /* 80px for action bar + safe margin */
}

@media (min-width: 640px) {
    .iv-details-section {
        padding-bottom: 6rem; /* More space on desktop */
    }
}

/* =====================================================
   Accessibility Focus Styles
   ===================================================== */

/* Focus styles for action bar buttons */
.iv-fixed-action-bar button:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

/* Focus styles for action bar vote buttons with active states */
.iv-action-bar-votes button:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

/* Tab content area focus management */
.iv-tab-content:focus-within {
    /* Subtle indication that content area has focus */
    outline: none;
}

/* =====================================================
   Dark Theme Scrollbar Utility
   ===================================================== */

.dark-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 92, 246, 0.3) transparent;
}

.dark-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.dark-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.dark-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.3);
    border-radius: 3px;
}

.dark-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.5);
}
