/* AI Image Editor - Custom Styles */

/* Performance Optimizations for Core Web Vitals */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Base Font - Theme F: Nunito */
body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-weight: 400;
    letter-spacing: -0.015em;
}

/* Reduce CLS (Cumulative Layout Shift) */
img, video, iframe {
    max-width: 100%;
    height: auto;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

.slide-in {
    animation: slideIn 0.6s ease-out;
}

/* Loading Spinner */
.spinner {
    border: 4px solid rgba(99, 102, 241, 0.1);
    border-top: 4px solid #6366f1;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #1e293b;
}

::-webkit-scrollbar-thumb {
    background: #818cf8;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a78bfa;
}

/* Enhanced Card Styles */
.card-enhanced {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-enhanced:hover {
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.15);
    transform: translateY(-2px);
}

/* Mode Button Styles - Theme F */
.mode-btn {
    background: rgba(30, 41, 59, 0.6);
    border: 1.5px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    font-weight: 500;
    font-size: 14px;
    letter-spacing: -0.01em;
    transition: all 0.2s ease;
}

.mode-btn:hover {
    background: rgba(51, 65, 85, 0.8);
    border-color: rgba(129, 140, 248, 0.4);
}

.mode-btn.active {
    background: linear-gradient(135deg, rgba(129, 140, 248, 0.15), rgba(167, 139, 250, 0.15));
    border-color: #818cf8;
    color: white;
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.1);
}

/* Aspect Ratio Button Styles - Theme F */
.aspect-ratio-btn {
    background: rgba(30, 41, 59, 0.6);
    border: 1.5px solid rgba(148, 163, 184, 0.2);
    border-radius: 10px;
    font-weight: 500;
    font-size: 13px;
    transition: all 0.2s ease;
}

.aspect-ratio-btn:hover {
    background: rgba(51, 65, 85, 0.8);
    border-color: rgba(129, 140, 248, 0.4);
}

.aspect-ratio-btn.active {
    background: rgba(129, 140, 248, 0.15);
    border-color: #818cf8;
    color: white;
    box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.1);
}

/* Aspect Ratio Shape Styles */
.aspect-ratio-shape {
    width: 32px;
    height: 32px;
    background: rgba(148, 163, 184, 0.2);
    border: 1.5px solid rgba(148, 163, 184, 0.3);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.aspect-ratio-btn.active .aspect-ratio-shape {
    background: rgba(129, 140, 248, 0.2);
    border-color: #818cf8;
}

/* Different aspect ratio shapes */
.aspect-ratio-shape[data-ratio="1:1"] {
    width: 28px;
    height: 28px;
}

.aspect-ratio-shape[data-ratio="16:9"] {
    width: 36px;
    height: 20px;
}

.aspect-ratio-shape[data-ratio="9:16"] {
    width: 20px;
    height: 36px;
}

.aspect-ratio-shape[data-ratio="4:3"] {
    width: 32px;
    height: 24px;
}

.aspect-ratio-shape[data-ratio="3:4"] {
    width: 24px;
    height: 32px;
}

.aspect-ratio-shape[data-ratio="2:3"] {
    width: 22px;
    height: 33px;
}

.aspect-ratio-shape[data-ratio="3:2"] {
    width: 33px;
    height: 22px;
}

/* Quick Prompt Button Styles */
.quick-prompt-btn {
    transition: all 0.2s ease;
}

.quick-prompt-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(129, 140, 248, 0.2);
}

.quick-prompt-btn:active {
    transform: translateY(0);
}

/* FAQ Toggle */
.faq-question.active i {
    transform: rotate(180deg);
}

/* Image Preview Styles */
#image-preview img {
    object-fit: contain;
    border-radius: 12px;
}

/* Result Area Styles */
#result-area {
    position: relative;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.6);
    border: 1.5px dashed rgba(148, 163, 184, 0.2);
    border-radius: 16px;
    min-height: 500px;
}

#result-image img {
    object-fit: contain;
    max-height: 600px;
    border-radius: 12px;
}

/* Drag and Drop Styles */
#upload-area {
    border: 2px dashed rgba(148, 163, 184, 0.2);
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.4);
    transition: all 0.3s ease;
}

#upload-area:hover {
    border-color: rgba(99, 102, 241, 0.4);
    background: rgba(99, 102, 241, 0.05);
}

#upload-area.drag-over {
    border-color: #6366f1;
    background-color: rgba(99, 102, 241, 0.1);
    border-style: solid;
}

/* Enhanced Button Styles */
button {
    font-weight: 500;
    letter-spacing: -0.01em;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.4;
}

/* Primary Button - Theme F: Violet Gradient */
.btn-primary {
    background: linear-gradient(135deg, #818cf8 0%, #a78bfa 50%, #ec4899 100%);
    border: none;
    box-shadow: 0 4px 12px rgba(129, 140, 248, 0.35);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(167, 139, 250, 0.45);
    transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

/* Gradient Text - Theme F */
.gradient-text {
    background: linear-gradient(to right, #818cf8, #a78bfa, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Card Hover Effects */
.card-hover {
    transition: all 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
}

/* Mobile Menu Animation */
#mobile-menu {
    transition: max-height 0.3s ease-in-out;
}

/* Focus Styles for Accessibility */
button:focus,
input:focus,
textarea:focus,
a:focus {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    header, footer, .no-print {
        display: none;
    }
}

/* Enhanced Typography - Theme F: Friendly & Rounded */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.25;
}

h1 {
    font-size: 3.5rem;
    font-weight: 800;
}

h2 {
    font-size: 2.5rem;
    font-weight: 700;
}

h3 {
    font-size: 1.75rem;
    font-weight: 600;
}

/* Responsive Typography */
@media (max-width: 640px) {
    h1 {
        font-size: 2rem;
    }
    h2 {
        font-size: 1.5rem;
    }
    h3 {
        font-size: 1.25rem;
    }
}

/* Performance: Reduce animations on low-end devices */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Loading State */
.loading {
    pointer-events: none;
    opacity: 0.6;
}

/* Success/Error Messages */
.message {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.message-success {
    background-color: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

.message-error {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Image Lazy Loading Placeholder */
img[loading="lazy"] {
    background: #1e293b;
}

/* Tooltip */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 1rem;
    background-color: #1e293b;
    color: white;
    border-radius: 0.5rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.tooltip:hover::after {
    opacity: 1;
}

/* Responsive Container */
.container-responsive {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 640px) {
    .container-responsive {
        padding: 0 1.5rem;
    }
}

@media (min-width: 1024px) {
    .container-responsive {
        padding: 0 2rem;
    }
}

/* Input & Textarea Styles */
input[type="text"],
input[type="email"],
input[type="file"],
textarea,
select {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    letter-spacing: -0.01em;
}

textarea {
    resize: none;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #6366f1 !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1) !important;
}

/* Label Styles */
label {
    font-weight: 500;
    font-size: 14px;
    letter-spacing: -0.01em;
}

/* Badge Styles */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: -0.01em;
}

/* Icon Styles */
i.fas, i.far, i.fab {
    line-height: 1;
}

/* Glassmorphism Effect */
.glass-effect {
    background: rgba(30, 41, 59, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(148, 163, 184, 0.1);
}

/* Subtle Glow Effect */
.glow-effect {
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.15);
}

/* Feature Card Hover */
.feature-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(99, 102, 241, 0.2);
}

/* Step Number Badge - Theme F */
.step-badge {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    background: linear-gradient(135deg, #818cf8, #a78bfa, #ec4899);
    box-shadow: 0 4px 12px rgba(129, 140, 248, 0.35);
}

/* Improved Spacing */
.section-spacing {
    padding-top: 5rem;
    padding-bottom: 5rem;
}

@media (min-width: 768px) {
    .section-spacing {
        padding-top: 6rem;
        padding-bottom: 6rem;
    }
}

/* Text Gradient - Theme F: Violet to Pink */
.text-gradient {
    background: linear-gradient(135deg, #818cf8 0%, #a78bfa 50%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Improved Paragraph Spacing */
p {
    line-height: 1.7;
}

/* Link Hover Effect */
a {
    transition: all 0.2s ease;
}

a:hover {
    opacity: 0.8;
}
