/**
 * Reusable Component Styles
 * Buttons, Inputs, Cards, Toast, Top Bar
 */

/* Top Bar */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 12px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.settings-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 10px 16px;
    color: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.settings-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(0, 212, 255, 0.3);
}

.settings-btn svg {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(16, 185, 129, 0.95);
    color: white;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
    pointer-events: none;
}

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

.toast.error {
    background: rgba(239, 68, 68, 0.95);
}

/* Toast Progress Bar */
.toast::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 0 0 10px 10px;
    animation: toastProgress 3s linear forwards;
}

.toast.error::after {
    background: rgba(255, 255, 255, 0.4);
}

/* Form Fields */
.field-label {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.field-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 8px 10px;
    color: white;
    font-size: 13px;
    font-family: inherit;
    transition: all 0.2s ease;
    resize: none;
    overflow: hidden;
}

.field-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.field-input:focus {
    outline: none;
    border-color: rgba(0, 212, 255, 0.4);
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.1);
}

.field-input.loading {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.05) 100%);
    background-size: 200% 100%;
    animation: fieldLoading 1.5s ease-in-out infinite;
}

textarea.field-input {
    min-height: 36px;
    max-height: 120px;
}

/* Section Labels */
.section-label {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

/* Remove margin when section-label is inline with other elements */
.section-label-row .section-label {
    margin-bottom: 0;
}

.section-sublabel {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.3);
    margin-top: -8px;
    margin-bottom: 12px;
}

/* Image Card */
.image-card {
    position: relative;
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: cardEntrance 0.4s ease-out forwards;
    opacity: 0;
}

/* Staggered entrance for image cards */
.image-card:nth-child(1) { animation-delay: 0ms; }
.image-card:nth-child(2) { animation-delay: 50ms; }
.image-card:nth-child(3) { animation-delay: 100ms; }
.image-card:nth-child(4) { animation-delay: 150ms; }
.image-card:nth-child(5) { animation-delay: 200ms; }
.image-card:nth-child(6) { animation-delay: 250ms; }
.image-card:nth-child(7) { animation-delay: 300ms; }
.image-card:nth-child(8) { animation-delay: 350ms; }

.image-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 212, 255, 0.15),
                0 0 40px rgba(0, 212, 255, 0.2),
                0 0 60px rgba(255, 0, 170, 0.1),
                0 0 0 1px rgba(0, 212, 255, 0.2);
    border-color: rgba(0, 212, 255, 0.3);
}

.image-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    filter: blur(8px);
    transform: scale(0.96);
}

.image-card img.loaded {
    animation: imageReveal 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Image Placeholder */
.image-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.placeholder-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
}

.placeholder-icon svg {
    width: 22px;
    height: 22px;
    color: rgba(255, 255, 255, 0.2);
}

.placeholder-number {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.25);
}

.image-card.loading .placeholder-icon {
    animation: shimmer 1.5s ease-in-out infinite;
}

.image-card.error {
    border-color: rgba(239, 68, 68, 0.3);
}

.image-card.error .placeholder-icon {
    background: rgba(239, 68, 68, 0.1);
}

.image-card.error .placeholder-icon svg {
    color: rgba(239, 68, 68, 0.5);
}

.error-text {
    font-size: 10px;
    color: rgba(239, 68, 68, 0.7);
    text-align: center;
    padding: 0 8px;
}

/* Download Button */
.download-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.download-btn svg {
    width: 16px;
    height: 16px;
    color: white;
}

.download-btn:hover {
    background: rgba(0, 212, 255, 0.8);
    border-color: rgba(0, 212, 255, 0.5);
    transform: scale(1.1);
}

.image-card:hover .download-btn {
    opacity: 1;
}

/* Generate Button */
.generate-btn {
    background: linear-gradient(135deg, #00d4ff 0%, #ff00aa 50%, #ffaa00 100%);
    border: none;
    border-radius: 12px;
    width: 48px;
    height: 48px;
    min-width: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

/* Shimmer sweep effect */
.generate-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.generate-btn:hover::before {
    left: 100%;
}

.generate-btn:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 212, 255, 0.4),
                0 0 0 2px rgba(255, 255, 255, 0.1);
}

.generate-btn:active {
    transform: scale(0.95);
}

.generate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.generate-btn:disabled::before {
    display: none;
}

.generate-btn svg {
    width: 22px;
    height: 22px;
    color: white;
    position: relative;
    z-index: 1;
}

.generate-btn .spinner {
    display: none;
    width: 22px;
    height: 22px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    position: relative;
    z-index: 1;
    box-sizing: border-box;
    flex-shrink: 0;
    transform-origin: center;
}

.generate-btn.loading svg {
    display: none;
}

.generate-btn.loading .spinner {
    display: block;
}

/* Disable hover/active transforms during loading to prevent spinner drift */
.generate-btn.loading,
.generate-btn.loading:hover,
.generate-btn.loading:active {
    transform: none;
}

/* Status Text */
.status-text {
    text-align: center;
    margin-top: 10px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.4);
    min-height: 20px;
}

.status-text.error {
    color: rgba(239, 68, 68, 0.8);
}

/* Responsive */
@media (max-width: 768px) {
    .top-bar {
        display: none;
    }
}
