/* Aurora Modal */
#aurora-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    justify-content: center;
    align-items: center;
}

#aurora-modal.show {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

.aurora-modal-content {
    background: var(--bg-secondary);
    border-radius: 4px;
    padding: 24px;
    width: 90%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    border: 1px solid var(--border-color);
}

.dark-mode .aurora-modal-content {
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

/* Header & Instructions */
#aurora-modal .modal-close-bar {
    position: absolute;
    top: 18px;
    right: 18px;
    padding: 0;
    z-index: 100;
}

.aurora-header {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.aurora-header-top {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.aurora-header-top .aurora-icon {
    width: 18px;
    height: 18px;
    color: #6a11cb;
    flex-shrink: 0;
}

.aurora-header h2 {
    margin: 0;
    font-size: var(--font-size-modal-title);
    font-family: var(--font-family-modal-title);
    font-weight: 700;
    text-transform: var(--modal-title-transform);
    background: linear-gradient(90deg, #6a11cb 0%, #2575fc 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: var(--smart-spacing);
}

/* Thread Instructions */
.aurora-thread-instructions {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.step-circle {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--main-purple);
    color: var(--text-inverse);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(0.65rem, 2vw, 0.75rem);
    font-weight: 700;
    flex-shrink: 0;
}

.step-text {
    font-size: clamp(0.75rem, 2vw, 0.85rem);
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

.step-line {
    flex: 1;
    min-width: 15px;
    height: 3px;
    background: var(--border-color);
    margin: 0 4px;
    border-radius: 2px;
}

.camera-viewport {
    width: 100%;
    aspect-ratio: 4/3;
    background: var(--bg-main);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
    /* Evita que se comprima al aparecer resultados */
}

#aurora-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#aurora-canvas {
    display: none;
}

.camera-tooltip {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: clamp(0.65rem, 2vw, 0.75rem);
    font-weight: 500;
    pointer-events: all;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    border: 1px solid var(--border-color);
    z-index: 5;
    transition: opacity 0.3s ease;
}

.camera-tooltip.hidden {
    opacity: 0;
    pointer-events: none;
}

.camera-tooltip-close {
    background: none;
    border: none;
    color: white;
    opacity: 0.7;
    cursor: pointer;
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.camera-tooltip-close:hover {
    color: white;
}

/* Scanning Overlay */
.scan-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
}

.scan-line {
    position: absolute;
    width: 100%;
    left: 0;
    height: 80px;
    background: linear-gradient(90deg,
            transparent,
            rgba(0, 255, 128, 0.4),
            rgba(0, 242, 254, 0.5),
            rgba(106, 17, 203, 0.3),
            rgba(0, 255, 128, 0.4),
            transparent);
    background-size: 200% 100%;
    filter: blur(20px);
    z-index: 2;
    animation:
        auroraScan 4s ease-in-out infinite,
        auroraFlow 3s linear infinite;
    pointer-events: none;
}

.scan-guide {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70%;
    height: 40%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    z-index: 3;
    pointer-events: none;
    box-shadow: 0 0 0 4000px rgba(0, 0, 0, 0.3);
}

.scan-guide::before,
.scan-guide::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-color: #00ff80;
    border-style: solid;
    pointer-events: none;
}

.scan-guide::before {
    top: -2px;
    left: -2px;
    border-width: 3px 0 0 3px;
    border-top-left-radius: 12px;
}

.scan-guide::after {
    bottom: -2px;
    right: -2px;
    border-width: 0 3px 3px 0;
    border-bottom-right-radius: 12px;
}

.scan-guide-top-right,
.scan-guide-bottom-left {
    position: absolute;
    width: 20px;
    height: 20px;
    border-color: #00ff80;
    border-style: solid;
    pointer-events: none;
}

.scan-guide-top-right {
    top: -2px;
    right: -2px;
    border-width: 3px 3px 0 0;
    border-top-right-radius: 12px;
}

.scan-guide-bottom-left {
    bottom: -2px;
    left: -2px;
    border-width: 0 0 3px 3px;
    border-bottom-left-radius: 12px;
}


@keyframes auroraScan {

    0%,
    100% {
        top: 0%;
        opacity: 0;
    }

    20%,
    80% {
        opacity: 0.6;
    }

    50% {
        top: 80%;
        opacity: 0.8;
    }
}

@keyframes auroraFlow {
    0% {
        background-position: 0% 50%;
    }

    100% {
        background-position: 200% 50%;
    }
}

.aurora-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.aurora-loading-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.aurora-wave {
    width: 8px;
    height: 8px;
    background: linear-gradient(135deg, #1e88e5, #ab47bc);
    border-radius: 50%;
    animation: auroraWave 1.5s ease-in-out infinite;
}

.aurora-wave:nth-child(2) {
    animation-delay: 0.2s;
}

.aurora-wave:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes auroraWave {

    0%,
    100% {
        transform: translateY(0);
        opacity: 0.5;
    }

    50% {
        transform: translateY(-10px) scale(1.2);
        opacity: 1;
    }
}

/* Status Help Text */
.aurora-status-bubble {
    background: transparent;
    padding: 0;
    border-radius: 20px;
    font-size: clamp(0.7rem, 2vw, 0.8rem);
    color: var(--text-muted);
    box-shadow: none;
    margin-top: -4px;
    margin-bottom: -8px;
    transition: all 0.3s ease;
    text-align: center;
    max-width: 90%;
    z-index: 5;
    font-weight: 500;
    letter-spacing: var(--smart-spacing);
}

.aurora-status-bubble.active {
    background: linear-gradient(90deg, var(--main-purple), #2575fc, var(--main-purple));
    background-size: 200% auto;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: auroraGradient 2s linear infinite;
    font-weight: 700;
}

@keyframes auroraGradient {
    0% {
        background-position: 0% center;
    }

    100% {
        background-position: 200% center;
    }
}

.aurora-status-bubble.error {
    color: var(--status-alert);
}

/* Capture Button */
#capture-btn {
    background: var(--main-purple);
    color: var(--text-inverse);
    border: none;
    padding: 10px 32px;
    border-radius: 30px;
    font-weight: 600;
    font-size: clamp(0.95rem, 2.5vw, 1.1rem);
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s;
    width: auto;
    letter-spacing: 0.5px;
}

#capture-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(106, 17, 203, 0.4);
}

#capture-btn:active {
    transform: translateY(0);
}

/* Results Area - Chips Layout */
.aurora-results {
    width: 100%;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Scroll Fade Container Wrapper */
.aurora-result-wrapper {
    position: relative;
    border-radius: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.aurora-scroll-content {
    max-height: 200px;
    overflow-y: auto;
    width: 100%;
    padding: 16px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    scrollbar-color: var(--text-muted) transparent;
}

.aurora-fade-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40px;
    background: linear-gradient(to bottom, transparent, var(--bg-secondary));
    pointer-events: none;
    z-index: 5;
}

.aurora-product-header {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    position: sticky;
    top: -16px;
    z-index: 10;
    background: var(--bg-secondary);
    padding-top: 16px;
    padding-bottom: 8px;
    margin-bottom: 4px;
}

.aurora-product-img-small {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    object-fit: contain;
    background: var(--bg-secondary);
    padding: 2px;
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.aurora-product-name {
    font-weight: 700;
    font-size: clamp(0.85rem, 2.5vw, 0.95rem);
    color: var(--text-main);
    margin: 0;
    line-height: 1.2;
}

.aurora-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    padding-bottom: 20px;
}

.aurora-price-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    font-size: clamp(0.7rem, 2vw, 0.8rem);
    color: var(--text-main);
    transition: all 0.2s ease;
}

.aurora-price-chip:hover {
    border-color: var(--main-purple);
    transform: translateY(-1px);
}

.aurora-chip-price {
    font-weight: 700;
    color: var(--main-purple);
}

.aurora-no-price {
    font-size: clamp(0.7rem, 2vw, 0.8rem);
    color: var(--text-muted);
}

.aurora-error-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 8px 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    margin-top: 0px;
    opacity: 0.7;
}

.aurora-error-container.critical {
    background: rgba(243, 58, 106, 0.1);
    border-color: var(--status-alert);
}

.aurora-error-text {
    color: var(--text-muted);
    font-weight: 500;
    font-size: clamp(0.65rem, 2.2vw, 0.75rem);
    margin: 0;
    line-height: 1.2;
}

.critical .aurora-error-text {
    color: var(--status-alert);
    font-weight: 600;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}