:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.4);
    --bg-base: #020617;
    --bg-surface: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.65);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.1);
    --border-hover: rgba(255, 255, 255, 0.2);
    --danger: #ef4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', system-ui, -apple-system, sans-serif;
    background: radial-gradient(circle at top right, #1e1b4b, var(--bg-surface), var(--bg-base));
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    overflow-x: hidden;
}

.app-container {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 28px;
    padding: 3rem;
    width: 100%;
    max-width: 1000px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.app-main {
    display: flex;
    flex-direction: column;
    gap: 3.5rem; /* Separación entre tarjetas de subida y el comparador */
}

header {
    position: relative;
    text-align: center;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

header h1 {
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
    background: linear-gradient(135deg, #fff, #94a3b8);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 600px;
    font-weight: 300;
}

.lang-selector {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    gap: 4px;
    background: rgba(15, 23, 42, 0.4);
    padding: 4px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.lang-btn {
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: 6px 10px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.lang-btn:hover {
    color: white;
}

.lang-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.controls-panel {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
}

.swap-controls {
    display: flex;
    align-items: center;
    justify-content: center;
}

.swap-btn {
    background: var(--card-bg);
    color: var(--primary);
    border: 1px solid var(--border-color);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.swap-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: rotate(180deg) scale(1.1);
    box-shadow: 0 0 15px var(--primary-glow);
}

.swap-btn svg {
    transition: transform 0.3s ease;
}

.upload-card {
    flex: 1;
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.4);
    transition: all 0.3s ease;
    overflow: hidden;
}

.upload-card:hover {
    border-color: var(--primary);
    background: rgba(15, 23, 42, 0.6);
    box-shadow: 0 0 20px var(--primary-glow);
}

.upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem;
    cursor: pointer;
    text-align: center;
    height: 100%;
}

.upload-icon {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
    padding: 1rem;
    border-radius: 50%;
    margin-bottom: 1rem;
    transition: transform 0.3s ease;
}

.upload-card:hover .upload-icon {
    transform: translateY(-5px);
    background: var(--primary);
    color: white;
}

.upload-title {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.upload-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.preview-mini {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-mini img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.8;
}

.remove-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--danger);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s, background 0.2s;
}

.remove-btn:hover {
    transform: scale(1.1);
    background: #dc2626;
}

.viewer-wrapper {
    width: 100%;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-color);
    overflow: hidden;
    position: relative;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 4rem 2rem;
}

.empty-icon {
    margin-bottom: 1rem;
    opacity: 0.5;
}

.comparison-container {
    position: relative;
    width: 100%;
    /* The height will be set dynamically based on image aspect ratio, but we set a max */
    max-height: 70vh;
    display: flex;
    cursor: ew-resize; /* Default vertical separator */
    user-select: none;
    -webkit-user-select: none;
}

.image-wrapper {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    overflow: hidden;
}

#comparison-container {
    position: relative;
    width: 100%;
    height: auto;
    aspect-ratio: 16/9;
    /* Default, will be updated by JS */
}

.img-base {
    z-index: 1;
}

.img-overlay {
    z-index: 2;
    /* Show right half by default so base image is on the left */
    clip-path: polygon(50% 0, 100% 0, 100% 100%, 50% 100%);
}

.image-wrapper img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

/* Slider Controls */
.slider-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 4;
    opacity: 0;
    /* Hidden but interactive - we keep it for accessibility */
    pointer-events: none; 
    margin: 0;
}

.slider-visual {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 4px;
    background: white;
    z-index: 3;
    transform: translateX(-50%);
    pointer-events: none;
    /* Let clicks pass through to input */
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.slider-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6px;
    color: var(--bg-surface);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(0, 0, 0, 0.1);
}

.slider-button svg {
    width: 16px;
    height: 16px;
}

/* Viewer Actions (Buttons) */
.viewer-actions {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
    display: flex;
    gap: 8px;
}

.viewer-btn {
    background: var(--card-bg);
    color: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all 0.2s ease;
    opacity: 0.7;
}

.viewer-btn:hover {
    opacity: 1;
    background: var(--primary);
    border-color: var(--primary);
    transform: scale(1.05);
}

/* Horizontal Mode Adjustments */
.comparison-container.horizontal-mode .slider-visual {
    width: 100%;
    height: 4px;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}

.comparison-container.horizontal-mode .slider-button {
    transform: translate(-50%, -50%) rotate(90deg);
}

.comparison-container.horizontal-mode .img-overlay {
    /* Top half by default in horizontal mode */
    clip-path: polygon(0 50%, 100% 50%, 100% 100%, 0 100%);
}

.comparison-container.horizontal-mode .slider-input {
    cursor: ns-resize;
}

.comparison-container.horizontal-mode {
    cursor: ns-resize;
}

.comparison-container.dragging {
    cursor: grabbing !important;
}

/* Fullscreen adjustments */
.comparison-container:fullscreen {
    background: var(--bg-base);
    max-height: none;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comparison-container:-webkit-full-screen {
    background: var(--bg-base);
    max-height: none;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .controls-panel {
        flex-direction: column;
    }

    .app-main {
        gap: 2rem;
    }

    .app-container {
        padding: 1.5rem;
    }
}

/* --- Cookie Consent Banner --- */
.consent-banner {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 48px);
    max-width: 600px;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.5rem;
    z-index: 9999;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from { transform: translate(-50%, 100%) scale(0.9); opacity: 0; }
    to { transform: translate(-50%, 0) scale(1); opacity: 1; }
}

.consent-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: white;
}

.consent-content p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.consent-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.btn-consent {
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.btn-accept {
    background: var(--primary);
    color: white;
}

.btn-accept:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-reject {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-main);
}

.btn-reject:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-hover);
}

@media (max-width: 640px) {
    .consent-banner {
        bottom: 12px;
        left: 12px;
        right: 12px;
        padding: 1.2rem;
    }
    
    .consent-actions {
        flex-direction: column-reverse;
    }
    
    .btn-consent {
        width: 100%;
    }
}