/* Círculo rojo de eliminar foto (remove-btn) más pequeño en móvil */
@media (max-width: 600px) {
    .remove-btn {
        width: 28px !important;
        height: 28px !important;
        min-width: 28px !important;
        min-height: 28px !important;
        padding: 0 !important;
    }
    .remove-btn span {
        width: 18px !important;
        height: 18px !important;
        font-size: 1.1rem !important;
    }
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --accent: #ec4899;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1e293b;
    --light: #f8fafc;
    --gray: #64748b;
    --border: #e2e8f0;
    --shadow: rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    min-height: 100vh;
    color: var(--dark);
    line-height: 1.6;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: url(./img/fondo.mov);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.emoji {
    font-size: 3rem;
    animation: bounce 2s infinite;
}

.header h1 {
    color: white;
    font-size: 2.5rem;
    font-weight: 800;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

/* Main Content */
.main-content {
    display: grid;
    gap: 2rem;
}

.card {
    /* background: white; */
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    animation: fadeInUp 0.8s ease;
}

.card h2 {
    color: var(--dark);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 700;
}

/* Upload Area */
.upload-area {
    position: relative;
    border: 3px dashed var(--border);
    border-radius: 1rem;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    /* background: var(--light); */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-top: 275px;
}

.upload-area:hover {
    border-color: var(--primary);
    background: #f0f0ff;
}

.upload-area.drag-over {
    border-color: var(--primary);
    background: #e0e7ff;
    transform: scale(1.02);
}

.upload-placeholder {
    color: var(--gray);
}

.upload-placeholder svg {
    margin-bottom: 1rem;
    color: var(--primary);
}

.upload-placeholder p {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--dark);
}

.file-info {
    font-size: 0.9rem;
    color: var(--gray);
}

.preview-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.preview-container img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.remove-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

.remove-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* Prompt Input */
#promptInput {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: all 0.3s ease;
}

#promptInput:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.prompt-examples {
    margin-top: 1.5rem;
}

.prompt-examples p {
    margin-bottom: 0.75rem;
    color: var(--gray);
    font-size: 0.9rem;
}

.example-btn {
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    margin: 0.25rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    display: inline-block;
}

.example-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* Generate Button */
.generate-btn {
    width: 100%;
    padding: 1.25rem 2rem;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.8), rgba(16, 185, 129, 0.8));
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 25px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.generate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.9), rgba(16, 185, 129, 0.9));
    box-shadow: 0 12px 40px rgba(31, 38, 135, 0.5);
    border-color: rgba(255, 255, 255, 0.5);
}

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

.generate-btn:disabled {
    background: rgba(108, 117, 125, 0.6);
    cursor: not-allowed;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
    transform: none;
}



.btn-icon {
    font-size: 1.5rem;
}

/* Result Section */
.result-card {
    animation: fadeInUp 0.8s ease;
}

.result-image-container {
    margin: 1.5rem 0;
    text-align: center;
}

.result-image-container img {
    max-width: 100%;
    border-radius: 0.75rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.result-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.action-btn {
    flex: 1;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.download-btn {
    background: var(--success);
    color: white;
}

.download-btn:hover {
    background: #059669;
    transform: translateY(-2px);
}

.action-btn.secondary {
    background: var(--light);
    color: var(--dark);
    border: 2px solid var(--border);
}

.action-btn.secondary:hover {
    background: var(--border);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-content p {
    margin-top: 1.5rem;
    font-size: 1.2rem;
    font-weight: 600;
}

.loading-content small {
    display: block;
    margin-top: 0.5rem;
    opacity: 0.8;
}

/* Loader original */
.loader {
    width: 50px;
    height: 50px;
    position: relative;
    transform: translateX(-25px);
    margin: 0 auto;
}

.loader::before,
.loader::after {
    content: '';
    position: absolute;
    width: inherit;
    height: inherit;
    border-radius: 50%;
    mix-blend-mode: multiply;
    animation: rotate9 1s infinite cubic-bezier(0.77, 0, 0.175, 1);
}

.loader::before {
    background-color: #e55319;
}

.loader::after {
    background-color: #194875;
    animation-delay: .5s;
}

@keyframes rotate9 {
    0%,100% {
        left: 50px;
    }
    25% {
        transform: scale(.3);
    }
    50% {
        left: 0;
    }
    75% {
        transform: scale(1);
    }
}

/* Spinner alternativo (mantener por compatibilidad) */
.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

@keyframes fadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--dark);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1001;
    max-width: 400px;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

/* Camera Modal */
.camera-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.camera-content {
    background: #fff;
    padding: 32px 24px;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#cameraVideo {
    width: 320px;
    height: 240px;
    background: #222;
    border-radius: 8px;
    margin-bottom: 16px;
    object-fit: cover;
    display: block;
}

#captureBtn,
#closeCameraBtn {
    margin: 8px 4px;
    padding: 8px 16px;
    font-size: 1rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
}

#captureBtn {
    background: #ffd600;
    color: #222;
    font-weight: bold;
}

#closeCameraBtn {
    background: #eee;
    color: #222;
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 3rem;
    color: rgba(255, 255, 255, 0.9);
    animation: fadeIn 1s ease;
}

.footer .small {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-top: 0.5rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes bounce {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

#imagePreview.required {
    box-shadow: 0 0 0 4px var(--danger);
    border: 2px solid var(--danger);
    animation: shake 0.3s;
}

@keyframes shake {
    0% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-8px);
    }
    50% {
        transform: translateX(8px);
    }
    75% {
        transform: translateX(-8px);
    }
    100% {
        transform: translateX(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .header h1 {
        font-size: 2rem;
    }

    .card {
        padding: 1.5rem;
    }

    .result-actions {
        flex-direction: column;
    }

    .toast {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
    }

    .upload-area {
        margin-top: 40px;
        padding: 2rem 1.5rem;
    }
}

@media (max-width: 480px) {
    .upload-area {
        margin-top: 20px;
        padding: 1.5rem 1rem;
    }
}
