/* Modern UI Specific Styles */
.main-content {
    margin-left: 320px;
    flex: 1;
    padding: 40px;
    overflow-y: auto;
}

.preview-section {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.btn-primary {
    background: var(--accent-green);
    color: var(--bg-primary);
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(57, 255, 20, 0.3);
}

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

.image-preview {
    max-width: 100%;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.loading {
    display: none;
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
}

.loading.active {
    display: block;
}

/* MAIN CONTENT LAYOUT */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

/* Logo Responsive System - SIMPLIFICADO */
.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;  /* Centrado para mejor estética */
    gap: 0;
    min-height: 60px;
}

/* Logo único para todos los dispositivos */
.logo {
    display: block;
    height: auto;
    max-width: 100%;
    object-fit: contain;
    transition: all 0.3s ease;
}

/* Desktop (993px+) */
@media (min-width: 993px) {
    .logo {
        max-height: 70px;
        width: auto;
    }
}

/* Tablet (768px - 992px) */
@media (min-width: 768px) and (max-width: 992px) {
    .logo {
        max-height: 60px;
        width: auto;
    }
}

/* Mobile (menos de 768px) */
@media (max-width: 767px) {
    .logo {
        max-height: 50px;
        width: auto;
    }
    
    .logo-container {
        min-height: 50px;
    }
}

/* Mobile pequeño (menos de 480px) */
@media (max-width: 480px) {
    .logo {
        max-height: 45px;
        width: auto;
    }
    
    .logo-container {
        min-height: 45px;
    }
}

/* Landscape mode - Logo un poco más grande */
@media (max-height: 500px) and (orientation: landscape) {
    .logo {
        max-height: 40px;
    }
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
}

.header .x {
    color: var(--accent-green);
}

.brand-label {
    font-family: 'Dancing Script', cursive;
    font-size: 24px;
    font-weight: 600;
    color: var(--accent-green);
    text-shadow: 0 0 10px rgba(57, 255, 20, 0.3);
    letter-spacing: 1px;
    margin: 0;
}

.advanced-btn {
    color: var(--text-primary);
    text-decoration: none;
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s;
    background: var(--input-bg);
}

.advanced-btn:hover {
    background: var(--accent-green);
    color: black;
    border-color: var(--accent-green);
}

/* CONTENT GRID */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 30px;
}

.content-panel {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--border-color);
}

.panel-header {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.info-message {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 20px;
    font-style: italic;
    background: rgba(70, 72, 83, 0.1);
    border-radius: 8px;
    border: 1px dashed var(--border-color);
}

/* STEP IMAGES */
.step-image {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
}

.step-caption {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    text-align: center;
}

/* DOWNLOAD BUTTONS */
.download-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.download-buttons {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.download-btn {
    flex: 1;
    padding: 10px 16px;
    background: var(--accent-green);
    color: var(--bg-primary);
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.step-download-btn {
    width: 100%;
    padding: 8px 12px;
    background: var(--accent-green);
    color: var(--bg-primary);
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
}

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

.step-download-btn:active {
    transform: translateY(0);
}

/* SUBSCRIPTION STATUS */
.subscription-status {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.subscription-status.trial {
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 0.3);
    color: #ffc107;
}

.subscription-status.active {
    background: rgba(57, 255, 20, 0.1);
    border: 1px solid rgba(57, 255, 20, 0.3);
    color: var(--accent-green);
}

.subscription-status.expired {
    background: rgba(255, 75, 75, 0.1);
    border: 1px solid rgba(255, 75, 75, 0.3);
    color: var(--accent-red);
}

.upgrade-btn {
    background: var(--accent-green);
    color: var(--bg-primary);
    padding: 6px 12px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.upgrade-btn:hover {
    background: #2dd10f;
    transform: translateY(-1px);
}

/* SUBSCRIPTION MODAL */
.subscription-modal {
    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;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 32px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    border: 1px solid var(--border-color);
}

.modal-content h3 {
    color: var(--accent-red);
    margin-bottom: 16px;
    font-size: 20px;
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.5;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.renew-btn {
    background: var(--accent-green);
    color: var(--bg-primary);
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.renew-btn:hover {
    background: #2dd10f;
}

.close-btn {
    background: transparent;
    color: var(--text-secondary);
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

/* STEP SECTIONS */
#stepsSection {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    width: 100%;
    grid-auto-flow: dense;
}

.step-section {
    margin-bottom: 0;
    display: none;
}

.step-section.active {
    display: block;
}

/* Responsive para step sections */
@media (max-width: 1200px) {
    #stepsSection {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    #stepsSection {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* HAMBURGER MENU */
.hamburger-btn {
    display: none;
    position: fixed;
    top: 20px;  /* Posición original - no solapa con logo centrado */
    left: 20px;
    z-index: 1001;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.hamburger-btn:hover {
    background: var(--hover-bg);
    border-color: var(--accent-green);
    transform: scale(1.05);
}

.hamburger-btn .hamburger-icon {
    width: 24px;
    height: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hamburger-btn .hamburger-icon span {
    display: block;
    height: 3px;
    width: 100%;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger-btn.active .hamburger-icon span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.hamburger-btn.active .hamburger-icon span:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active .hamburger-icon span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* SIDEBAR OVERLAY */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
}

/* RESPONSIVE DESIGN */

/* Large Tablets & Small Desktops (1024px - 1200px) */
@media (max-width: 1200px) {
    .content-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .sidebar {
        width: 300px;
    }
    
    .main-content {
        margin-left: 300px;
    }
}

/* Tablets (768px - 1024px) */
@media (max-width: 1024px) {
    .sidebar {
        width: 280px;
    }
    
    .main-content {
        margin-left: 280px;
        padding: 16px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .content-panel {
        padding: 20px;
    }
}

/* Mobile Devices (menos de 768px) */
@media (max-width: 768px) {
    /* Mostrar botón hamburguesa */
    .hamburger-btn {
        display: block;
    }
    
    /* Sidebar como overlay en móvil */
    .sidebar {
        width: 85%;
        max-width: 320px;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 12px rgba(0, 0, 0, 0.5);
        z-index: 100;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    /* Main content ocupa todo el ancho en móvil */
    .main-content {
        margin-left: 0;
        padding: 70px 12px 12px 12px;
        width: 100%;
    }
    
    /* Header ajustado para móvil */
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        margin-bottom: 16px;
        padding-top: 20px;  /* Espacio superior para mejor visualización en iPhone */
    }
    
    .header h1 {
        font-size: 1.75rem;
    }
    
    .brand-label {
        font-size: 11px;
    }
    
    /* Content panels */
    .content-panel {
        padding: 16px;
    }
    
    .panel-header {
        font-size: 16px;
    }
    
    /* Content grid - MUCHA separación para que NO se superponga sobre logo */
    .content-grid {
        margin-top: 60px;
    }
}

/* Small Mobile (menos de 480px) */
@media (max-width: 480px) {
    .main-content {
        padding: 65px 8px 8px 8px;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .content-panel {
        padding: 12px;
    }
    
    .panel-header {
        font-size: 15px;
    }
    
    /* Reducir gaps en grids y MUCHA separación del header */
    .content-grid {
        gap: 12px;
        margin-top: 55px;
    }
    
    .sidebar {
        width: 90%;
    }
}

/* Landscape Mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .main-content {
        padding: 75px 12px 12px 12px;
    }
    
    .header {
        margin-bottom: 16px;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    /* Content grid - separación para landscape */
    .content-grid {
        margin-top: 16px;
    }
}

/* MODAL DE GESTIÓN DE PRESETS */
.manage-presets-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.manage-presets-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.manage-presets-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.manage-presets-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s ease;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close-btn:hover {
    color: var(--accent-red);
}

.presets-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.preset-item {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--input-bg);
    transition: all 0.2s ease;
}

.preset-item:hover {
    border-color: var(--accent-green);
    background: var(--hover-bg);
}

.preset-item-info {
    flex: 1;
}

.preset-item-name {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.preset-item-description {
    font-size: 12px;
    color: var(--text-secondary);
}

.preset-item-actions {
    display: flex;
    gap: 8px;
}

.preset-action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.preset-edit-btn {
    background: #2196F3;
    color: white;
}

.preset-edit-btn:hover {
    background: #1976D2;
    transform: translateY(-1px);
}

.preset-delete-btn {
    background: var(--accent-red);
    color: white;
}

.preset-delete-btn:hover {
    background: #cc3333;
    transform: translateY(-1px);
}

.preset-params-btn {
    background: var(--accent-green);
    color: var(--bg-primary);
}

.preset-params-btn:hover {
    background: #2dd10f;
    transform: translateY(-1px);
}

.no-presets-message {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 20px;
    font-style: italic;
}

/* IMAGE ZOOM MODAL */
.image-zoom-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.image-zoom-container {
    max-width: 95vw;
    max-height: 95vh;
    position: relative;
    animation: zoomIn 0.3s ease;
}

.image-zoom-container img {
    max-width: 100%;
    max-height: 95vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.image-zoom-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: var(--accent-red);
    border: none;
    color: white;
    font-size: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-weight: bold;
}

.image-zoom-close:hover {
    background: #ff4444;
    transform: scale(1.1);
}

/* Image Container with Zoom Icon */
.step-img-container {
    position: relative;
    display: inline-block;
    cursor: pointer;
    width: 100%;
}

.step-img-container::before {
    content: '🔍';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 2;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
}

.step-img-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1;
    border-radius: 8px;
}

.step-img-container:hover::before,
.step-img-container:hover::after {
    opacity: 1;
}

.step-img-container .step-image {
    display: block;
    border-radius: 8px;
    transition: transform 0.3s ease;
    width: 100%;
}

.step-img-container:hover .step-image {
    transform: scale(1.02);
}

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

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .image-zoom-close {
        top: 10px;
        right: 10px;
    }
}

/* OPACITY CONTROL FOR STENCIL OVERLAY */
.opacity-control {
    margin: 16px 0;
    padding: 16px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.opacity-control:hover {
    border-color: var(--accent-green);
    background: var(--hover-bg);
}

.opacity-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.opacity-icon {
    font-size: 20px;
}

.opacity-text {
    flex: 1;
}

.opacity-value {
    color: var(--accent-green);
    font-weight: 700;
    font-size: 15px;
    min-width: 50px;
    text-align: right;
}

.opacity-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, var(--border-color) 0%, var(--accent-green) 100%);
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.opacity-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-green);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(57, 255, 20, 0.3);
}

.opacity-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-green);
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(57, 255, 20, 0.3);
}

.opacity-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 8px rgba(57, 255, 20, 0.5);
}

.opacity-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 3px 8px rgba(57, 255, 20, 0.5);
}

.opacity-slider:active::-webkit-slider-thumb {
    transform: scale(1.1);
}

.opacity-slider:active::-moz-range-thumb {
    transform: scale(1.1);
}

/* ============================
   PROGRESS BAR STYLES (SSE) - Floating Centered Minimalist
   ============================ */

.progress-container {
    /* Floating overlay - centered on screen */
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    
    /* Backdrop blur for modern effect */
    background: rgba(20, 21, 35, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    
    /* Card styling */
    padding: 32px 40px;
    border-radius: 16px;
    border: 1px solid rgba(57, 255, 20, 0.2);
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(57, 255, 20, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    
    /* Min width for content */
    min-width: 320px;
    max-width: 90vw;
    
    /* Smooth entrance animation */
    animation: progressFadeIn 0.3s ease-out;
}

@keyframes progressFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.progress-wrapper {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, 
        var(--accent-green) 0%, 
        rgba(57, 255, 20, 0.8) 50%,
        var(--accent-green) 100%
    );
    background-size: 200% 100%;
    animation: progress-shimmer 2s ease-in-out infinite;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 3px;
    box-shadow: 0 0 12px rgba(57, 255, 20, 0.6);
}

@keyframes progress-shimmer {
    0% { background-position: 0% center; }
    50% { background-position: 100% center; }
    100% { background-position: 0% center; }
}

.progress-text {
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.3px;
    margin: 0;
}

/* Progress bar animation on complete */
.progress-bar.complete {
    animation: progressComplete 0.6s ease-out;
}

@keyframes progressComplete {
    0% { 
        transform: scaleY(1);
        box-shadow: 0 0 12px rgba(57, 255, 20, 0.6);
    }
    50% { 
        transform: scaleY(1.5);
        box-shadow: 0 0 24px rgba(57, 255, 20, 0.9);
    }
    100% { 
        transform: scaleY(1);
        box-shadow: 0 0 12px rgba(57, 255, 20, 0.6);
    }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .progress-container {
        min-width: 280px;
        padding: 24px 28px;
    }
    
    .progress-text {
        font-size: 13px;
    }
}

/* ========================================
   TABLET/IPAD OPTIMIZED CONTROLS
   Enterprise-grade touch interactions
   ======================================== */

/* AI Overlay Controls - Touch-optimized sliders */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    outline: none;
    transition: all 0.15s ease;
}

/* Webkit (Safari/Chrome) slider thumb */
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    border: 2px solid #4ade80;
    transition: all 0.15s ease;
    touch-action: manipulation;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 12px rgba(0,0,0,0.3);
}

input[type="range"]::-webkit-slider-thumb:active {
    transform: scale(1.15);
    box-shadow: 0 4px 16px rgba(74, 222, 128, 0.4);
}

/* Firefox slider thumb */
input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    border: 2px solid #4ade80;
    transition: all 0.15s ease;
}

input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 12px rgba(0,0,0,0.3);
}

input[type="range"]::-moz-range-thumb:active {
    transform: scale(1.15);
    box-shadow: 0 4px 16px rgba(74, 222, 128, 0.4);
}

/* Color picker touch optimization */
input[type="color"] {
    -webkit-appearance: none;
    appearance: none;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    touch-action: manipulation;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

input[type="color"]:hover {
    border-color: #4ade80;
    transform: scale(1.05);
}

input[type="color"]:active {
    transform: scale(0.98);
}

/* Tablet-specific optimizations */
@media (min-width: 768px) and (max-width: 1024px) {
    /* iPad and tablet sizes */
    input[type="range"]::-webkit-slider-thumb {
        width: 28px;
        height: 28px;
    }
    
    input[type="range"]::-moz-range-thumb {
        width: 28px;
        height: 28px;
    }
    
    input[type="color"] {
        width: 48px;
        height: 48px;
    }
}

/* Prevent text selection during slider drag */
.ai-overlay-controls {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Smooth scrolling for touch devices */
@media (hover: none) and (pointer: coarse) {
    * {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* AI PRO MODE - PREMIUM STYLES                                                */
/* ═══════════════════════════════════════════════════════════════════════════ */

/* AI Pro Section (Sidebar) */
.ai-pro-section {
    background: rgba(57, 255, 20, 0.03);
    border: 1px solid rgba(57, 255, 20, 0.15);
    position: relative;
}

.ai-pro-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid rgba(57, 255, 20, 0.2);
    color: var(--text-primary) !important;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pro-badge {
    background: rgba(57, 255, 20, 0.15);
    color: var(--accent-green);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
}

.ai-pro-description {
    padding: 16px;
    background: rgba(57, 255, 20, 0.02);
    border-radius: 8px;
    margin-bottom: 16px;
}

.ai-pro-text {
    margin: 0 0 12px 0;
    color: var(--text-primary);
    font-size: 14px;
}

.ai-pro-features {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ai-pro-features li {
    padding: 6px 0;
    color: var(--text-secondary);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* AI Pro Button */
.ai-pro-button {
    width: 100%;
    padding: 16px 24px;
    background: var(--accent-green);
    color: var(--bg-primary);
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 4px 15px rgba(57, 255, 20, 0.3);
    position: relative;
    overflow: hidden;
}

.ai-pro-button::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;
}

.ai-pro-button:hover::before {
    left: 100%;
}

.ai-pro-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(57, 255, 20, 0.5);
    background: #2dd10f;
}

.ai-pro-button:active {
    transform: translateY(0);
}

.ai-pro-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.ai-button-icon {
    font-size: 20px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.ai-button-text {
    font-size: 15px;
    letter-spacing: 0.3px;
}

/* AI Status Info */
.ai-status-info {
    margin-top: 12px;
    padding: 10px;
    background: rgba(57, 255, 20, 0.05);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

.ai-status-icon {
    font-size: 16px;
}

.ai-status-text {
    flex: 1;
}

/* AI Result Panel */
.ai-result-panel {
    background: var(--bg-secondary);
    border: 1px solid rgba(57, 255, 20, 0.15);
}

.ai-result-header {
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--accent-green);
    color: var(--text-primary) !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
}

.ai-result-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--accent-green);
}

.ai-result-badge {
    background: rgba(57, 255, 20, 0.15);
    color: var(--accent-green);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    backdrop-filter: blur(10px);
}

/* AI Loading State */
.ai-result-loading {
    padding: 60px 20px;
    text-align: center;
}

.ai-loading-spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 24px;
    border: 4px solid rgba(102, 126, 234, 0.1);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.ai-loading-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.ai-loading-hint {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

/* AI Image Container with Zoom */
.ai-image-container {
    position: relative;
    background: var(--bg-primary);
    border-radius: 12px;
    overflow: auto;
    margin: 20px 0;
    border: 1px solid rgba(57, 255, 20, 0.1);
    /* Responsive: sin max-height fijo, se ajusta al contenido como modo técnico */
}

.ai-result-image {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: zoom-in;
    border-radius: 8px;
    /* Coherente con .step-image del modo técnico */
}

.ai-result-image.zoomed {
    cursor: zoom-out;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* AI LAYERED SYSTEM - Ajuste instantáneo con Canvas                           */
/* ═══════════════════════════════════════════════════════════════════════════ */

/* Contenedor para capas superpuestas */
.ai-image-container.layered-mode {
    position: relative;
    overflow: hidden;
    background: white; /* Fondo blanco base */
}

/* Capas base */
.ai-layer {
    width: 100%;
    height: auto;
    border-radius: 8px;
    transition: opacity 0.03s linear; /* Transición ultra-rápida */
}

/* Fondo blanco (para efecto de imagen opacity) */
.ai-image-container.layered-mode #aiWhiteBackground {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background: white;
}

/* Capa 1: Imagen original */
.ai-original-layer {
    position: relative; /* Relative para dar altura al contenedor */
    z-index: 1;
}

/* Capa 2: Canvas del stencil coloreado */
.ai-stencil-layer {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    pointer-events: none; /* No interferir con interacciones */
}

/* Cuando está en modo layered, ocultar la imagen combinada */
.ai-image-container.layered-mode .ai-result-image {
    display: none !important;
}

/* Asegurar que las capas visibles se muestren */
.ai-image-container.layered-mode .ai-original-layer,
.ai-image-container.layered-mode .ai-stencil-layer {
    display: block;
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* TECHNICAL LAYERED SYSTEM - Sistema de capas para Stencil Overlay técnico    */
/* ═══════════════════════════════════════════════════════════════════════════ */

/* Contenedor de capas técnico */
.tech-overlay-container {
    position: relative;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

/* Capa poster (fondo) - define altura del contenedor */
#techPosterLayer {
    display: block;
    width: 100%;
    height: auto;
    position: relative;
    z-index: 1;
    transition: opacity 0.03s linear;
}

/* Capa canvas stencil - superpuesta exactamente */
#techStencilCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

/* Zoom Controls */
.ai-zoom-controls {
    position: absolute;
    bottom: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.zoom-btn {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: white;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zoom-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.zoom-level {
    color: white;
    font-size: 13px;
    font-weight: 600;
    min-width: 50px;
    text-align: center;
}

/* AI Controls Section */
.ai-controls-section {
    padding: 20px;
    background: rgba(57, 255, 20, 0.02);
    margin: 20px;
    border-radius: 12px;
    border: 1px solid rgba(57, 255, 20, 0.1);
}

.ai-control-group {
    margin-bottom: 20px;
}

.ai-control-group:last-child {
    margin-bottom: 0;
}

.ai-control-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.ai-control-value {
    color: var(--accent-green);
    font-weight: 600;
}

.ai-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, rgba(57, 255, 20, 0.2), var(--accent-green));
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.ai-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-green);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(57, 255, 20, 0.4);
    transition: transform 0.2s;
}

.ai-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.ai-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-green);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(57, 255, 20, 0.4);
}

/* AI Color Picker */
.ai-color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-color-picker {
    width: 60px;
    height: 40px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.ai-color-picker:hover {
    transform: scale(1.05);
}

.ai-color-value {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* AI Download Section */
.ai-download-section {
    padding: 20px;
    margin: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid rgba(57, 255, 20, 0.1);
}

.ai-download-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.ai-download-btn {
    padding: 14px 20px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.ai-download-btn.primary {
    background: var(--accent-green);
    color: var(--bg-primary);
    box-shadow: 0 4px 12px rgba(57, 255, 20, 0.3);
}

.ai-download-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(57, 255, 20, 0.5);
    background: #2dd10f;
}

.ai-download-btn.secondary {
    background: transparent;
    color: var(--accent-green);
    border: 2px solid var(--accent-green);
}

.ai-download-btn.secondary:hover {
    background: rgba(57, 255, 20, 0.1);
    transform: translateY(-1px);
}

.btn-icon {
    font-size: 18px;
}

.btn-text {
    font-size: 14px;
}

/* AI Quota Badge */
.ai-quota-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(59, 130, 246, 0.1));
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 12px;
    font-size: 14px;
}

.ai-quota-badge .quota-icon {
    font-size: 18px;
}

.ai-quota-badge .quota-text {
    color: var(--text-primary);
    font-weight: 600;
}

.ai-quota-badge .quota-remaining {
    color: #10b981;
    font-weight: 700;
    padding: 4px 10px;
    background: rgba(16, 185, 129, 0.15);
    border-radius: 20px;
    font-size: 13px;
}

.ai-quota-badge.quota-low .quota-remaining {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.15);
}

.ai-quota-badge.quota-critical .quota-remaining {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
}

/* AI Metadata */
.ai-metadata {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.ai-meta-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 13px;
    margin: 0;
}

.meta-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.meta-value {
    color: var(--text-primary);
    font-weight: 600;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .ai-pro-button {
        padding: 14px 20px;
        font-size: 15px;
    }
    
    .ai-button-icon {
        font-size: 18px;
    }
    
    .ai-zoom-controls {
        bottom: 12px;
        right: 12px;
        padding: 6px 10px;
    }
    
    .zoom-btn {
        width: 28px;
        height: 28px;
        font-size: 16px;
    }
    
    .ai-download-btn {
        padding: 12px 16px;
        font-size: 14px;
    }
}
