/**
 * Prompt Canvas - Custom Styles
 * 
 * Additional CSS that extends Tailwind CSS for custom animations
 * and styling effects.
 */

/* ============================================
   Base Styles
   ============================================ */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   Scrollbar Styling
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.5);
}

::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.7);
}

/* ============================================
   Textarea Styling
   ============================================ */

textarea {
    scrollbar-width: thin;
    scrollbar-color: rgba(100, 116, 139, 0.5) transparent;
}

textarea::placeholder {
    color: rgba(148, 163, 184, 0.6);
}

textarea:focus::placeholder {
    color: rgba(148, 163, 184, 0.4);
}

/* ============================================
   Button Hover Effects
   ============================================ */

button {
    cursor: pointer;
    user-select: none;
}

button:focus {
    outline: none;
}

button:focus-visible {
    outline: 2px solid rgba(168, 85, 247, 0.5);
    outline-offset: 2px;
}

/* ============================================
   Loading Spinner Enhancements
   ============================================ */

@keyframes gradient-spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.loading-gradient {
    background: conic-gradient(
        from 0deg,
        transparent 0deg,
        rgb(168, 85, 247) 90deg,
        rgb(236, 72, 153) 180deg,
        rgb(59, 130, 246) 270deg,
        transparent 360deg
    );
    animation: gradient-spin 1.5s linear infinite;
}

/* ============================================
   Image Container Effects
   ============================================ */

#generatedImage {
    transition: opacity 0.5s ease, transform 0.3s ease;
}

#generatedImage:hover {
    transform: scale(1.01);
}

/* Shimmer loading effect */
.shimmer {
    background: linear-gradient(
        90deg,
        rgba(30, 41, 59, 0.5) 0%,
        rgba(51, 65, 85, 0.5) 50%,
        rgba(30, 41, 59, 0.5) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ============================================
   Glass Morphism Effects
   ============================================ */

.glass {
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(51, 65, 85, 0.5);
}

.glass-light {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ============================================
   Gradient Text
   ============================================ */

.gradient-text {
    background: linear-gradient(135deg, #a855f7 0%, #ec4899 50%, #3b82f6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================
   Glow Effects
   ============================================ */

.glow-purple {
    box-shadow: 0 0 30px rgba(168, 85, 247, 0.3);
}

.glow-pink {
    box-shadow: 0 0 30px rgba(236, 72, 153, 0.3);
}

.glow-blue {
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.3);
}

/* ============================================
   Pulse Animation
   ============================================ */

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(168, 85, 247, 0.2);
    }
    50% {
        box-shadow: 0 0 40px rgba(168, 85, 247, 0.4);
    }
}

.animate-pulse-glow {
    animation: pulse-glow 2s ease-in-out infinite;
}

/* ============================================
   Error Container Animation
   ============================================ */

#errorContainer {
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ============================================
   Success Animation
   ============================================ */

@keyframes pop-in {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-pop-in {
    animation: pop-in 0.4s ease-out;
}

/* ============================================
   Mobile Responsive Adjustments
   ============================================ */

@media (max-width: 640px) {
    /* Smaller padding on mobile */
    .card-padding {
        padding: 1rem;
    }
    
    /* Adjust textarea height */
    #promptInput {
        min-height: 100px;
    }
    
    /* Stack example prompts */
    .example-prompt {
        padding: 0.375rem 0.625rem;
        font-size: 0.75rem;
    }
}

/* ============================================
   High Contrast Mode Support
   ============================================ */

@media (prefers-contrast: high) {
    body {
        background-color: #000;
    }
    
    button {
        border: 2px solid currentColor;
    }
    
    input, textarea {
        border: 2px solid #fff;
    }
}

/* ============================================
   Reduced Motion Support
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    body {
        background: white;
        color: black;
    }
    
    #generatedImage {
        max-width: 100%;
        page-break-inside: avoid;
    }
    
    button,
    .no-print {
        display: none !important;
    }
}
