/* Scan Page Styles */
.scan-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.scan-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 3rem;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
    text-align: center;
    width: 100%;
    max-width: 600px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.scan-title {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.scan-subtitle {
    color: #6b7280;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.scan-privacy {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 2rem;
    text-align: center;
    font-size: 0.95rem;
    color: #1e40af;
    line-height: 1.5;
}

.camera-container {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    background: #000;
    /* Mantener ratio 5:7 (600x840) - más alto que ancho */
    aspect-ratio: 5/7;
    max-width: 600px;
    width: 100%;
}

#v {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    /* Debug: ensure video is visible */
    background: #000;
    min-height: 300px;
}

.captured-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;
    background: #000;
    border-radius: 20px;
}

.camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    pointer-events: none;
    animation: scan-line 2s ease-in-out infinite;
}

/* Removed overlay borders to clean up camera display */

@keyframes scan-line {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.card-guide {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 85%;
    height: 85%;
    border: 3px dashed rgba(255, 255, 255, 0.8);
    border-radius: 16px;
    pointer-events: none;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.4);
    z-index: 5;
}

.scan-button {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
    margin: 1rem 0;
    min-width: 200px;
}

.scan-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.4);
}

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

.scan-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    background: linear-gradient(135deg, #9ca3af, #6b7280) !important;
}

.scan-button.loading {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8) !important;
    cursor: wait;
}



/* No results indicator */
.no-results {
    background: rgba(156, 163, 175, 0.1);
    border: 1px solid rgba(156, 163, 175, 0.3);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    text-align: center;
    color: #6b7280;
}

.no-results p {
    margin: 0;
    font-size: 1rem;
    font-style: italic;
}

/* Dark mode for no results */
@media (prefers-color-scheme: dark) {
    .no-results {
        background: rgba(156, 163, 175, 0.15);
        border-color: rgba(156, 163, 175, 0.4);
        color: #d1d5db;
    }
}

/* Scan results area - Flash Message Style */
.scan-results {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    backdrop-filter: blur(8px);
    z-index: 20;
    width: auto;
    max-width: 90%;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
}

.results-title {
    display: none;
    /* Hide the title for flash message to be concise */
}

.card-info {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    color: white;
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Estilos para los detalles de la carta */
.card-details {
    text-align: center;
}

.card-name {
    color: #065f46;
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 1rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.card-meta {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.card-meta p {
    margin: 0;
    font-size: 1.1rem;
    color: #374151;
}

.card-set {
    color: #059669 !important;
    font-weight: 600;
}

.card-rarity {
    color: #7c3aed !important;
    font-weight: 600;
}

.card-score {
    color: #dc2626 !important;
    font-weight: 600;
}

.card-confidence {
    color: #2563eb !important;
    font-weight: 600;
}

.scan-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.feature-item {
    text-align: center;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    cursor: pointer;
}

.feature-item:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: #667eea;
}

.feature-title {
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.feature-desc {
    color: #6b7280;
    font-size: 0.9rem;
    line-height: 1.4;
}

.scan-instructions {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 16px;
    padding: 1.5rem;
    margin-top: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.instructions-title {
    font-weight: 600;
    color: #374151;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.instructions-list {
    list-style: none;
    padding: 0;
}

.instructions-list li {
    padding: 0.5rem 0;
    color: #6b7280;
    position: relative;
    padding-left: 1.5rem;
}

.instructions-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #10b981;
    font-weight: bold;
}

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

    .scan-card {
        padding: 2rem 1.5rem;
    }

    .scan-title {
        font-size: 2rem;
    }

    .scan-features {
        grid-template-columns: 1fr;
    }

    .camera-container {
        max-width: 650px;
        margin-left: auto;
        margin-right: auto;
    }



    .scan-button {
        padding: 1.25rem 2rem;
        font-size: 1rem;
        min-width: 180px;
    }
}

@media (max-width: 480px) {
    .scan-container {
        padding: 0.5rem;
    }

    .scan-card {
        padding: 1.5rem 1rem;
        border-radius: 16px;
    }

    .scan-title {
        font-size: 1.75rem;
    }

    .scan-subtitle {
        font-size: 1rem;
    }

    .camera-container {
        max-width: 350px;
    }



    .scan-button {
        padding: 1rem 1.5rem;
        font-size: 0.95rem;
        min-width: 160px;
    }

    .scan-instructions {
        padding: 1.25rem;
        margin-top: 1.5rem;
    }

    .instructions-title {
        font-size: 1rem;
    }

    .instructions-list li {
        font-size: 0.9rem;
        padding: 0.4rem 0;
        padding-left: 1.25rem;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .scan-card {
        background: rgba(31, 41, 55, 0.95);
        color: #f9fafb;
    }

    .scan-subtitle {
        color: #d1d5db;
    }

    .scan-privacy {
        background: rgba(59, 130, 246, 0.15);
        border-color: rgba(59, 130, 246, 0.3);
        color: #93c5fd;
    }

    .feature-item {
        background: rgba(31, 41, 55, 0.7);
        border-color: rgba(75, 85, 99, 0.3);
    }

    .feature-title {
        color: #f9fafb;
    }

    .feature-desc {
        color: #d1d5db;
    }

    .scan-instructions {
        background: rgba(31, 41, 55, 0.8);
        border-color: rgba(75, 85, 99, 0.3);
    }

    .instructions-title {
        color: #f9fafb;
    }

    .instructions-list li {
        color: #d1d5db;
    }

    /* Modo oscuro para resultados */
    .scan-results {
        background: rgba(16, 185, 129, 0.15);
        border-color: #10b981;
    }

    .results-title {
        color: #6ee7b7;
    }

    .card-info {
        background: rgba(31, 41, 55, 0.9);
        border-color: rgba(16, 185, 129, 0.4);
    }

    .card-name {
        color: #6ee7b7;
    }

    .card-meta p {
        color: #d1d5db;
    }
}

/* Loading animation */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-right: 0.5rem;
}

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

/* Hidden canvas */
.hidden {
    display: none;
}

/* Scan tips */
.scan-tips {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 12px;
    padding: 1rem;
    margin-top: 1.5rem;
    text-align: center;
}

.scan-tips p {
    color: #1e40af;
    font-size: 0.95rem;
    margin: 0;
}

/* Dark mode for tips */
@media (prefers-color-scheme: dark) {
    .scan-tips {
        background: rgba(59, 130, 246, 0.15);
        border-color: rgba(59, 130, 246, 0.3);
    }

    .scan-tips p {
        color: #93c5fd;
    }
}

/* Mobile-specific loading states */
@media (max-width: 768px) {
    .scan-button:disabled {
        opacity: 0.7;
        background: linear-gradient(135deg, #9ca3af, #6b7280) !important;
    }

    .scan-button.loading {
        background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    }

    /* Enhanced loading animation for mobile */
    .loading-spinner {
        width: 18px;
        height: 18px;
        border-width: 2px;
    }
}



/* Mobile camera optimization */
@media (max-width: 768px) {
    .camera-container {
        aspect-ratio: 5/7;
        /* Same ratio as cards (600x840) */
        max-width: 400px;
    }

    #v {
        object-fit: cover;
        /* Fill container with card proportions */
    }

    .captured-image {
        object-fit: contain;
        /* Maintain original proportions */
    }
}

/* Zoom button */
.zoom-button {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(4px);
    z-index: 10;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.zoom-button:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: scale(1.1);
}

.zoom-button:active {
    transform: scale(0.95);
}