/* QR Code Scanner Page Styles */

/* Scanner Container */
.scanner-container {
    max-width: 640px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 1rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

/* Video Preview */
.scanner-video-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #1a1a2e;
    overflow: hidden;
}

.scanner-video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Camera Placeholder */
.camera-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #1a1a2e;
    z-index: 1;
}

.camera-placeholder.hidden {
    display: none;
}

/* Scanning Overlay */
.scanner-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 2;
}

.scanner-frame {
    width: 65%;
    aspect-ratio: 1 / 1;
    border: 3px solid rgba(124, 58, 237, 0.7);
    border-radius: 1rem;
    position: relative;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.4);
}

.scanner-frame::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, #7c3aed, transparent);
    animation: scanLine 2s ease-in-out infinite;
}

@keyframes scanLine {
    0%, 100% { top: 0; }
    50% { top: calc(100% - 3px); }
}

/* Corner markers */
.scanner-frame .corner {
    position: absolute;
    width: 20px;
    height: 20px;
    border-color: #7c3aed;
    border-style: solid;
    border-width: 0;
}

.scanner-frame .corner.top-left {
    top: -2px;
    left: -2px;
    border-top-width: 4px;
    border-left-width: 4px;
    border-top-left-radius: 8px;
}

.scanner-frame .corner.top-right {
    top: -2px;
    right: -2px;
    border-top-width: 4px;
    border-right-width: 4px;
    border-top-right-radius: 8px;
}

.scanner-frame .corner.bottom-left {
    bottom: -2px;
    left: -2px;
    border-bottom-width: 4px;
    border-left-width: 4px;
    border-bottom-left-radius: 8px;
}

.scanner-frame .corner.bottom-right {
    bottom: -2px;
    right: -2px;
    border-bottom-width: 4px;
    border-right-width: 4px;
    border-bottom-right-radius: 8px;
}

/* Result Box */
.scanner-result {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    word-break: break-all;
    transition: all 0.3s ease;
}

.scanner-result.has-result {
    border-color: #7c3aed;
    background: #f5f3ff;
}

.scanner-result a {
    color: #7c3aed;
    text-decoration: underline;
    font-weight: 500;
}

.scanner-result a:hover {
    color: #6d28d9;
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 0.75rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8fafc;
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: #7c3aed;
    background: #f5f3ff;
}

/* Tab Buttons */
.scanner-tab {
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    cursor: pointer;
    border: 2px solid transparent;
}

.scanner-tab.active {
    background: #7c3aed;
    color: #ffffff;
    border-color: #7c3aed;
}

.scanner-tab:not(.active) {
    background: #f1f5f9;
    color: #475569;
}

.scanner-tab:not(.active):hover {
    background: #e2e8f0;
}

/* Action Buttons */
.scanner-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
}

.scanner-btn-primary {
    background: #7c3aed;
    color: #ffffff;
}

.scanner-btn-primary:hover {
    background: #6d28d9;
}

.scanner-btn-outline {
    background: transparent;
    color: #7c3aed;
    border: 2px solid #7c3aed;
}

.scanner-btn-outline:hover {
    background: #f5f3ff;
}

/* How It Works Steps */
.step-number {
    width: 2.5rem;
    height: 2.5rem;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

/* Toast Notification */
.toast-notification {
    position: fixed;
    top: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(-120%);
    z-index: 9999;
    min-width: 280px;
    max-width: 90vw;
    border-radius: 0.75rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
}

.toast-notification.toast-show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-notification.hidden {
    display: none;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.75rem;
}

.toast-error .toast-content {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.toast-error .toast-content i {
    color: #dc2626;
}

.toast-success .toast-content {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.toast-success .toast-content i {
    color: #16a34a;
}

.toast-info .toast-content {
    background: #f0f9ff;
    color: #075985;
    border: 1px solid #bae6fd;
}

.toast-info .toast-content i {
    color: #0284c7;
}

/* Hidden temp element for upload scanning */
.upload-scan-temp {
    display: none;
}

/* html5-qrcode camera video container */
.scanner-video-inner {
    width: 100%;
    height: 100%;
}

.scanner-video-inner video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Override html5-qrcode default styles */
#scannerVideo img,
#scannerVideo br {
    display: none;
}

/* Result Type Badge */
.result-type-badge {
    font-size: 0.8125rem;
    font-weight: 700;
    color: #7c3aed;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Formatted Result Rows */
.result-formatted {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.result-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: #ffffff;
    border-radius: 0.5rem;
    border: 1px solid #e9e5f5;
}

.result-row-icon {
    color: #7c3aed;
    margin-top: 0.2rem;
    font-size: 0.875rem;
    flex-shrink: 0;
    width: 1rem;
    text-align: center;
}

.result-row-label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.125rem;
}

.result-row-value {
    display: block;
    font-size: 0.875rem;
    color: #1f2937;
    word-break: break-word;
    line-height: 1.4;
}

/* Raw Data Box */
.raw-data-box {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    max-height: 200px;
    overflow-y: auto;
}

.raw-data-box pre {
    margin: 0;
    font-family: 'JetBrains Mono', monospace;
    line-height: 1.5;
}

/* Inline Error Message */
.inline-message {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.inline-message-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.inline-message-error i {
    color: #dc2626;
    flex-shrink: 0;
}

/* Responsive */
@media (max-width: 640px) {
    .scanner-container {
        border-radius: 0.75rem;
    }

    .scanner-video-wrapper {
        aspect-ratio: 4 / 3;
    }

    .scanner-frame {
        width: 70%;
    }

    .upload-zone {
        padding: 1.25rem;
    }

    .scanner-tab {
        padding: 0.5rem 0.875rem;
        font-size: 0.8125rem;
    }

    .scanner-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8125rem;
        gap: 0.375rem;
    }

    .scanner-result {
        padding: 0.875rem 1rem;
    }

    .step-number {
        width: 2rem;
        height: 2rem;
        font-size: 0.875rem;
    }

    .toast-notification {
        top: 1rem;
        min-width: 260px;
    }

    .toast-content {
        padding: 0.75rem 1rem;
        font-size: 0.8125rem;
    }

    .inline-message {
        font-size: 0.8125rem;
        padding: 0.625rem 0.875rem;
    }

    .result-row {
        padding: 0.375rem 0.625rem;
        gap: 0.5rem;
    }

    .result-row-value {
        font-size: 0.8125rem;
    }

    .result-type-badge {
        font-size: 0.75rem;
    }
}

@media (max-width: 380px) {
    .scanner-tab {
        padding: 0.5rem 0.625rem;
        font-size: 0.75rem;
    }

    .scanner-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }
}
