* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #00ff88;
    --secondary: #7000ff;
    --accent: #ff006e;
    --warning: #ffaa00;
    --dark: #0a0a1a;
    --darker: #050510;
    --light: #e0e0ff;
    --glass: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --gradient-1: linear-gradient(135deg, #00ff88, #00cc6a);
    --gradient-2: linear-gradient(135deg, #7000ff, #5a00cc);
    --gradient-3: linear-gradient(135deg, #ff006e, #cc0058);
}

body {
    font-family: 'Space Grotesk', sans-serif;
    background: var(--darker);
    color: var(--light);
    min-height: 100vh;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(0, 255, 136, 0.1), transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(112, 0, 255, 0.1), transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 40px;
    animation: slideDown 0.8s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.logo i {
    font-size: 40px;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo h1 {
    font-size: 36px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo span {
    font-weight: 300;
}

.subtitle {
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    font-weight: 300;
}

/* Scan Methods */
.scan-methods {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    animation: fadeIn 1s ease-out 0.3s both;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.method-btn {
    flex: 1;
    padding: 15px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--light);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    backdrop-filter: blur(10px);
}

.method-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.method-btn.active {
    background: var(--gradient-2);
    border-color: transparent;
    box-shadow: 0 0 30px rgba(112, 0, 255, 0.3);
}

/* Scanner Container */
.scanner-container {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 30px;
    backdrop-filter: blur(20px);
    animation: fadeIn 1s ease-out 0.5s both;
}

/* ============================================
   VIDEO WRAPPER - CONSOLIDADO
   ============================================ */
.video-wrapper {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto 20px;
    border-radius: 15px;
    overflow: visible !important; /* IMPORTANTE: visible para mostrar o vídeo */
    background: #000;
    min-height: 300px;
    box-shadow: 0 0 50px rgba(0, 255, 136, 0.2);
}

#video {
    width: 100%;
    border-radius: 15px;
    display: block;
}

/* ============================================
   SCAN FRAME - CONSOLIDADO
   ============================================ */
.scan-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 250px;
    height: 150px;
    border: 2px solid var(--primary);
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(0, 255, 136, 0.3), inset 0 0 30px rgba(0, 255, 136, 0.1);
    pointer-events: none;
    z-index: 10;
    transition: all 0.3s ease;
}

/* ============================================
   SCAN LINE - CONSOLIDADO
   ============================================ */
.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    animation: scanLine 2s ease-in-out infinite;
}

@keyframes scanLine {
    0%, 100% { top: 0; }
    50% { top: 100%; }
}

.scanner-controls {
    display: flex;
    gap: 15px;
}

.scan-btn {
    flex: 1;
    padding: 15px 30px;
    border: none;
    border-radius: 12px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--gradient-1);
    color: var(--dark);
}

.scan-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(0, 255, 136, 0.4);
}

/* Manual Input */
.manual-input {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 30px;
    backdrop-filter: blur(20px);
    animation: fadeIn 0.5s ease-out;
}

.input-group {
    position: relative;
    margin-bottom: 20px;
}

.input-group i {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    font-size: 20px;
}

.scan-indicator {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    opacity: 0;
    animation: pulse 2s infinite;
}

#barcodeInput:focus ~ .scan-indicator {
    opacity: 1;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 255, 136, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(0, 255, 136, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 255, 136, 0);
    }
}

#barcodeInput {
    width: 100%;
    padding: 20px 20px 20px 60px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--light);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 18px;
    transition: all 0.3s ease;
}

#barcodeInput:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.2), 0 0 40px rgba(0, 255, 136, 0.1);
    animation: inputGlow 2s infinite;
}

@keyframes inputGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(0, 255, 136, 0.2), 0 0 40px rgba(0, 255, 136, 0.1);
    }
    50% {
        box-shadow: 0 0 30px rgba(0, 255, 136, 0.4), 0 0 60px rgba(0, 255, 136, 0.2);
    }
}

#barcodeInput::placeholder {
    color: rgba(255, 255, 255, 0.3);
    transition: color 0.3s;
}

#barcodeInput:focus::placeholder {
    color: rgba(0, 255, 136, 0.3);
}

.search-btn {
    width: 100%;
    padding: 15px;
    background: var(--gradient-2);
    border: none;
    border-radius: 12px;
    color: white;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.search-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 10px 30px rgba(112, 0, 255, 0.4);
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    animation: fadeIn 0.2s ease-out;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* Product Result */
.product-result {
    margin-top: 30px;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    overflow: hidden;
    backdrop-filter: blur(20px);
}

.product-header {
    padding: 30px;
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.1), rgba(112, 0, 255, 0.1));
    border-bottom: 1px solid var(--glass-border);
}

.product-header h2 {
    font-size: 28px;
    margin-bottom: 10px;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.product-barcode {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 15px;
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-radius: 20px;
    font-size: 14px;
    color: var(--primary);
}

.product-body {
    padding: 30px;
}

/* Galeria de Produtos */
.product-gallery {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.02);
    position: relative;
}

.gallery-item {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 15px;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.gallery-item.main {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    max-height: 600px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
}

.gallery-item.main:hover {
    transform: scale(1.01);
    box-shadow: 0 10px 40px rgba(0, 255, 136, 0.2);
}

.gallery-item.main::after {
    content: '\f00e';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    bottom: 15px;
    right: 15px;
    color: white;
    background: rgba(0, 0, 0, 0.6);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.gallery-item.main:hover::after {
    opacity: 1;
}

.image-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auto-fit-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    transition: transform 0.3s ease;
    border-radius: 10px;
}

.gallery-item:hover .auto-fit-image {
    transform: scale(1.02);
}

.gallery-item:not(.main) {
    max-height: 100px;
    aspect-ratio: 1;
}

.gallery-item:not(.main) .image-container {
    padding: 5px;
}

.product-gallery:has(.gallery-item:nth-child(2)) {
    grid-template-columns: 1fr;
    gap: 10px;
}

.product-gallery:has(.gallery-item:nth-child(2)) .gallery-item.main {
    margin-bottom: 0;
}

.gallery-thumbnails {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 10px 0;
}

.gallery-thumbnails .gallery-item {
    min-width: 80px;
    max-width: 100px;
    height: 80px;
    flex-shrink: 0;
    border: 2px solid transparent;
    transition: all 0.3s;
}

.gallery-thumbnails .gallery-item:hover {
    border-color: var(--primary);
    transform: scale(1.05);
}

.gallery-thumbnails .gallery-item.active {
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.3);
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    animation: fadeIn 0.3s ease-out;
}

.lightbox.active {
    display: flex;
}

.lightbox img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 0 50px rgba(0, 255, 136, 0.3);
    transition: opacity 0.2s ease;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 30px;
    cursor: pointer;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transition: all 0.3s;
}

.lightbox-close:hover {
    background: rgba(255, 0, 110, 0.3);
    transform: rotate(90deg);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 24px;
    cursor: pointer;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transition: all 0.3s;
}

.lightbox-nav:hover {
    background: rgba(0, 255, 136, 0.3);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

/* Product Tags */
.product-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.alert-tag {
    display: inline-block;
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 14px;
}

.alert-tag.danger {
    background: rgba(255, 0, 110, 0.1);
    border: 1px solid rgba(255, 0, 110, 0.3);
    color: var(--accent);
}

.alert-tag.warning {
    background: rgba(255, 170, 0, 0.1);
    border: 1px solid rgba(255, 170, 0, 0.3);
    color: var(--warning);
}

/* Info Sections */
.info-section {
    margin-bottom: 25px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 15px;
    border: 1px solid var(--glass-border);
}

.info-section h3 {
    font-size: 18px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary);
}

.info-grid {
    display: grid;
    gap: 15px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.info-item:last-child {
    border-bottom: none;
}

.info-item.full-width {
    grid-column: 1 / -1;
    flex-direction: column;
    align-items: flex-start;
}

.info-item.full-width .info-value {
    max-width: 100%;
    margin-top: 8px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    width: 100%;
}

.info-label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
}

.info-value {
    font-weight: 500;
    text-align: right;
    max-width: 60%;
}

/* Nutritional Table */
.nutritional-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 12px 15px;
    background: rgba(0, 255, 136, 0.05);
    border-radius: 10px;
    font-size: 14px;
    color: var(--primary);
}

.nutritional-table-display {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    margin-bottom: 15px;
}

.nt-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    background: rgba(0, 255, 136, 0.1);
    padding: 12px 15px;
    font-weight: 600;
    font-size: 12px;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nt-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    padding: 10px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 13px;
}

.nt-row:last-child {
    border-bottom: none;
}

.nt-nutrient {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.nt-100, .nt-serving, .nt-vd {
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
}

.nt-vd {
    color: var(--primary);
    font-weight: 500;
}

.vd-note {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    display: block;
    margin-top: 10px;
    font-style: italic;
}

/* Ingredients */
.ingredients-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.ingredient-tag {
    padding: 8px 15px;
    background: rgba(112, 0, 255, 0.1);
    border: 1px solid rgba(112, 0, 255, 0.3);
    border-radius: 20px;
    font-size: 13px;
    color: #c0a0ff;
}

/* Storage */
.storage-text {
    line-height: 1.8;
    color: rgba(255, 255, 255, 0.8);
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    border-left: 3px solid var(--primary);
}

/* Health Alert */
.health-alert {
    border-left: 4px solid var(--warning);
}

.health-alert p {
    color: var(--warning);
    line-height: 1.6;
    font-weight: 700;
}

/* Emergency Contacts */
.emergency-contacts .contact-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    margin-bottom: 10px;
}

.contact-item i {
    font-size: 24px;
    color: var(--primary);
}

/* Error Message */
.error-message {
    background: rgba(255, 0, 110, 0.1);
    border: 1px solid rgba(255, 0, 110, 0.3);
    color: var(--accent);
    padding: 20px;
    border-radius: 12px;
    margin-top: 20px;
    text-align: center;
    animation: shake 0.5s ease-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* Swipe hint para mobile */
@media (hover: none) and (pointer: coarse) {
    .gallery-item.main::after {
        content: '\f047';
        font-family: 'Font Awesome 6 Free';
        font-weight: 900;
        opacity: 0.7;
        animation: swipeHint 2s infinite;
    }
    
    @keyframes swipeHint {
        0%, 100% { transform: translateX(0); }
        50% { transform: translateX(10px); }
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .logo h1 {
        font-size: 28px;
    }
    
    .scanner-container,
    .manual-input {
        padding: 20px;
    }
    
    .product-header {
        padding: 20px;
    }
    
    .product-body {
        padding: 20px;
    }
    
    .product-header h2 {
        font-size: 22px;
    }
    
    .gallery-item.main {
        min-height: 250px;
        max-height: 400px;
    }
    
    .nt-header {
        grid-template-columns: 1.5fr 1fr 1fr 0.8fr;
        font-size: 10px;
        padding: 10px;
    }
    
    .nt-row {
        grid-template-columns: 1.5fr 1fr 1fr 0.8fr;
        font-size: 11px;
        padding: 8px 10px;
    }
    
    .nutritional-header {
        flex-direction: column;
        gap: 5px;
        font-size: 13px;
    }
    
    .info-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .info-value {
        text-align: left;
        max-width: 100%;
    }
    
    .lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    .lightbox-prev {
        left: 10px;
    }
    
    .lightbox-next {
        right: 10px;
    }
}

@media (max-width: 480px) {
    .scan-methods {
        flex-direction: column;
    }
    
    .scanner-controls {
        flex-direction: column;
    }
    
    .gallery-item.main {
        min-height: 200px;
        max-height: 300px;
    }
    
    .gallery-item.main::after {
        width: 30px;
        height: 30px;
        font-size: 12px;
        bottom: 10px;
        right: 10px;
    }
    
    .nt-header {
        grid-template-columns: 1.5fr 0.8fr 0.8fr 0.6fr;
        font-size: 9px;
        letter-spacing: 0;
    }
    
    .nt-row {
        grid-template-columns: 1.5fr 0.8fr 0.8fr 0.6fr;
        font-size: 10px;
    }
    
    .product-tags {
        flex-direction: column;
    }
}

/* Upload Label */
.upload-label {
    display: inline-block;
    padding: 12px 25px;
    background: var(--glass);
    border: 1px dashed var(--primary);
    border-radius: 10px;
    color: var(--primary);
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 16px;
}

.upload-label:hover {
    background: rgba(0, 255, 136, 0.1);
    border-style: solid;
}

#imageUpload {
    display: none;
}

.search-options {
    display: flex;
    gap: 10px;
}

.search-options .search-btn {
    flex: 1;
}

@media (max-width: 480px) {
    .search-options {
        flex-direction: column;
    }
}

/* Produtos alternativos */
.alternatives-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.alt-item {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.alt-item:hover {
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.2);
}

.alt-item .alt-name {
    font-size: 13px;
    color: var(--light);
    margin-bottom: 5px;
}

.alt-item .alt-weight {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
}

/* Theme Toggle Button */
.theme-toggle {
    margin-top: 15px;
    padding: 10px 20px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 25px;
    color: var(--light);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.theme-toggle i {
    font-size: 16px;
    color: var(--warning);
}

/* ============================================
   CORREÇÃO SCANNER - HTML5-QRCODE
   ============================================ */

/* Viewport do scanner */
#quagga-viewport {
    width: 100% !important;
    border: none !important;
    background: #000;
    border-radius: 15px;
    overflow: hidden;
}

/* Vídeo da câmera */
#quagga-viewport video {
    width: 100% !important;
    height: auto !important;
    display: block !important;
    border-radius: 15px;
    object-fit: cover;
}

/* Região de scan */
#quagga-viewport__scan_region {
    min-height: 300px;
    background: #000;
    border-radius: 15px;
}

#quagga-viewport__scan_region img {
    display: none !important;
}

/* Dashboard do scanner */
#quagga-viewport__dashboard {
    padding: 10px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    backdrop-filter: blur(10px);
    border-radius: 0 0 15px 15px;
}

#quagga-viewport__dashboard_section {
    padding: 10px !important;
}

/* Botões internos do scanner */
#quagga-viewport__dashboard_section_csr button {
    background: var(--gradient-1) !important;
    color: white !important;
    border: none !important;
    padding: 10px 20px !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    margin: 5px !important;
    transition: all 0.3s ease !important;
    font-family: 'Space Grotesk', sans-serif !important;
}

#quagga-viewport__dashboard_section_csr button:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 15px rgba(0, 247, 255, 0.3) !important;
}

/* Link de trocar câmera */
#quagga-viewport__dashboard_section_swaplink {
    color: var(--primary) !important;
    text-decoration: none !important;
    font-weight: 600 !important;
    font-family: 'Space Grotesk', sans-serif !important;
}

/* Esconder elementos desnecessários */
#quagga-viewport__status_span,
#quagga-viewport__header_message,
#quagga-viewport img[alt="Info icon"] {
    display: none !important;
}

/* Overlay de scan */
#quagga-viewport__scanner_region {
    border: 2px solid var(--primary) !important;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5) !important;
}

/* Tema claro - ajustes */
body.light-theme #quagga-viewport__dashboard {
    background: rgba(0, 0, 0, 0.05) !important;
}

body.light-theme #quagga-viewport__dashboard_section_csr button {
    background: var(--gradient-1) !important;
}

/* ============================================
   CORREÇÃO FINAL - GARANTIR VISIBILIDADE
   ============================================ */

/* Garantir que o video-wrapper tenha altura */
.video-wrapper {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto 20px;
    border-radius: 15px;
    overflow: visible !important;
    background: #000;
    min-height: 400px !important; /* ← Altura mínima garantida */
    box-shadow: 0 0 50px rgba(0, 255, 136, 0.2);
}

/* Viewport do scanner com altura */
#quagga-viewport {
    width: 100% !important;
    min-height: 400px !important; /* ← Altura mínima */
    height: 400px !important; /* ← Altura fixa */
    border: none !important;
    background: #000;
    border-radius: 15px;
    overflow: hidden;
    position: relative;
}

/* Região de scan com altura */
#quagga-viewport__scan_region {
    width: 100% !important;
    min-height: 400px !important;
    background: #000;
    border-radius: 15px;
}

/* Vídeo da câmera - FORÇAR VISIBILIDADE */
#quagga-viewport video {
    width: 100% !important;
    height: 100% !important;
    min-height: 400px !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    border-radius: 15px;
    object-fit: cover;
    position: relative;
    z-index: 1;
}

/* Dashboard do scanner */
#quagga-viewport__dashboard {
    padding: 10px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    backdrop-filter: blur(10px);
    border-radius: 0 0 15px 15px;
    position: relative;
    z-index: 2;
}

/* Scan frame visível */
.scan-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 250px;
    height: 250px;
    border: 2px solid var(--primary);
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(0, 255, 136, 0.3), inset 0 0 30px rgba(0, 255, 136, 0.1);
    pointer-events: none;
    z-index: 10;
    transition: all 0.3s ease;
}

/* Botão de copiar */
.copy-btn {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--primary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
    white-space: nowrap;
}

.copy-btn:hover {
    background: rgba(var(--primary-rgb), 0.1);
    border-color: var(--primary);
}

.copy-btn.copied {
    background: #4ade80;
    color: white;
    border-color: #4ade80;
}

/* Container do código de barras com botão */
.barcode-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Container de alérgenos com botão */
.allergen-item {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Miniaturas na galeria */
.gallery-item.thumbnail {
    max-height: 100px;
    aspect-ratio: 1;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.gallery-item.thumbnail:hover {
    border-color: var(--primary);
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0, 255, 136, 0.2);
}

.gallery-item.thumbnail .image-container {
    padding: 5px;
}

/* Ajuste para quando tem mais de uma foto */
.product-gallery:has(.thumbnail) {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.product-gallery:has(.thumbnail) .gallery-item.main {
    margin-bottom: 0;
}

/* Container das miniaturas */
.product-gallery:has(.thumbnail)::after {
    content: '';
    display: block;
}

/* Grade de miniaturas */
.product-gallery .thumbnail {
    display: inline-block;
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}

/* Wrapper para miniaturas */
.product-gallery:has(.thumbnail) {
    position: relative;
}

/* Miniaturas em linha */
.product-gallery .gallery-item.thumbnail {
    display: inline-flex;
    margin-right: 10px;
    margin-top: 10px;
}