/* Importação da fonte estilo Azonix (Orbitron do Google Fonts) */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;600;700;800;900&display=swap');

/* ===============================================
   TERMINAL DE ESTOQUE CONFLFLEX - ESTILO VISUAL
   Identidade: Laranja CONLFLEX + Fundo Escuro
   =============================================== */

:root {
    --primary-color: #D86600;
    --primary-light: #D08746;
    --primary-dark: #A84D00;
    --secondary-color: #1C1C1C;
    --accent-color: #D86600;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --light-bg: #2a2a2a;
    --dark-text: #ffffff;
    --border-radius: 12px;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    --bg-dark: #121212;
    --bg-card: #1e1e1e;
    --text-muted: #a0a0a0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: linear-gradient(135deg, #0d0d0d 0%, #1a1a1a 50%, #0d0d0d 100%);
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    padding: 20px 0;
    color: #F5F5F5;
}

/* REGRA GLOBAL DE CONTRASTE: Nenhuma letra preta na aplicação */
button, input, select, textarea, .btn, .badge, .historico-item, .alert, .form-control {
    color: #ffffff !important;
}

.main-container {
    width: 100%;
    max-width: 950px;
    margin: 0 auto;
    overflow-x: hidden;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border: 1px solid #333;
}

.header {
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 50%, #0d0d0d 100%);
    color: white;
    padding: 25px 20px;
    text-align: center;
    position: relative;
    border-bottom: 3px solid var(--primary-color);
}

.logo-container {
    margin-bottom: 15px;
    background-color: transparent;
}

.logo-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid var(--primary-color);
    box-shadow: 0 4px 8px rgba(216, 102, 0, 0.3);
    object-fit: cover;
    filter: brightness(1.2) contrast(1.1);
    background-color: transparent;
}

.header h1 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    font-family: 'Orbitron', sans-serif;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    color: var(--primary-color);
}

.header .subtitle {
    margin: 5px 0 0 0;
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: 300;
    font-family: 'Orbitron', sans-serif;
    color: #F5F5F5;
}

.status-indicator {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--success-color);
    box-shadow: 0 0 8px rgba(39, 174, 96, 0.6);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

.content {
    padding: 30px 25px;
}

.form-control {
    border-radius: var(--border-radius);
    border: 2px solid #444;
    padding: 15px;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    background: #2a2a2a;
    color: #fff;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(216, 102, 0, 0.25);
    background: #333;
    transform: translateY(-1px);
    color: #fff;
}

.form-control::placeholder {
    color: #888;
}

.form-control:disabled {
    background-color: #333;
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: var(--border-radius);
    padding: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    width: 100%;
    transition: all 0.3s ease;
    color: white;
    box-shadow: 0 4px 8px rgba(216, 102, 0, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(216, 102, 0, 0.5);
    background: linear-gradient(135deg, #e67300 0%, #bf5500 100%);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #229954 100%);
    border: none;
    border-radius: var(--border-radius);
    padding: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    color: white;
    box-shadow: 0 4px 8px rgba(39, 174, 96, 0.3);
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(39, 174, 96, 0.4);
    background: linear-gradient(135deg, #229954 0%, #1e8449 100%);
}

.btn-camera {
    background: linear-gradient(135deg, var(--warning-color) 0%, #d68910 100%);
    border: none;
    border-radius: var(--border-radius);
    padding: 12px;
    font-weight: 600;
    color: white;
    width: 100%;
    margin-top: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(243, 156, 18, 0.3);
}

.btn-camera:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(243, 156, 18, 0.4);
    background: linear-gradient(135deg, #d68910 0%, #b9770e 100%);
}

.btn-outline-danger, .btn-outline-secondary {
    border-radius: var(--border-radius);
    padding: 10px 20px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-outline-secondary {
    color: #ccc;
    border-color: #555;
}

.btn-outline-secondary:hover {
    background: #333;
    color: #fff;
}

.product-card {
    background: linear-gradient(135deg, #2a2a2a 0%, #222 100%);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-top: 20px;
    border-left: 4px solid var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    color: #F5F5F5;
}

.product-info {
    margin-bottom: 15px;
}

.product-info strong {
    color: var(--primary-light);
    font-weight: 600;
}

.produto-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.produto-actions .btn {
    flex: 1;
    padding: 12px;
    font-weight: 600;
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
}

.produto-actions .btn-warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, #d68910 100%);
    border: none;
    color: white;
    box-shadow: 0 4px 8px rgba(243, 156, 18, 0.3);
}

.produto-actions .btn-warning:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(243, 156, 18, 0.4);
    background: linear-gradient(135deg, #d68910 0%, #b9770e 100%);
}

.alert {
    border-radius: var(--border-radius);
    border: none;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.alert-custom {
    background: linear-gradient(135deg, #1e3a2a 0%, #1a3325 100%) !important;
    color: #ffffff !important;
    border: 1px solid #2e7d32 !important;
    border-radius: var(--border-radius);
    padding: 15px 20px;
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
    font-weight: 500;
}

.loading {
    display: none;
    text-align: center;
    padding: 30px;
    background: linear-gradient(135deg, #2a2a2a 0%, #222 100%);
    border-radius: var(--border-radius);
    margin: 20px 0;
    color: var(--primary-color);
}

.loading i {
    font-size: 2.5rem;
    color: var(--primary-color);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.success-message {
    background: linear-gradient(135deg, #1e3a2a 0%, #1a3325 100%);
    color: #4caf50;
    border: 1px solid #2e7d32;
    border-radius: var(--border-radius);
    padding: 15px;
    margin-top: 15px;
    display: none;
    box-shadow: 0 2px 8px rgba(39, 174, 96, 0.2);
}

.error-message {
    background: linear-gradient(135deg, #3a1a1a 0%, #331818 100%);
    color: #ef5350;
    border: 1px solid #b71c1c;
    border-radius: var(--border-radius);
    padding: 15px;
    margin-top: 15px;
    display: none;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.2);
}

.historico-container {
    margin-top: 25px;
    padding: 18px;
    background: linear-gradient(135deg, #2a2a2a 0%, #222 100%);
    border-radius: var(--border-radius);
    border: 1px solid #444;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.historico-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary-light);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.historico-item {
    padding: 10px 15px;
    background: #333;
    border-radius: 8px;
    margin-bottom: 8px;
    border-left: 3px solid var(--primary-color);
    font-size: 0.9rem;
    color: #F5F5F5;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.4s ease-out;
    transition: all 0.3s ease;
}

.historico-item:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 6px rgba(216, 102, 0, 0.2);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.historico-item:last-child {
    margin-bottom: 0;
}

.btn-undo {
    background: linear-gradient(135deg, var(--warning-color) 0%, #d68910 100%);
    color: #ffffff !important;
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(243, 156, 18, 0.4);
    float: right;
}

.btn-undo:hover {
    background: linear-gradient(135deg, #d68910 0%, #b9770e 100%);
    transform: translateY(-1px);
    color: #ffffff !important;
    box-shadow: 0 4px 8px rgba(243, 156, 18, 0.6);
}

/* ===============================================
   LEITOR DE CÂMERA - CORREÇÕES DEFINITIVAS
   =============================================== */
#qr-reader {
    width: 100% !important;
    max-width: 400px;
    min-height: 300px;
    margin: 20px auto;
    background: #000;
    color: #fff;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

/* Garantir que o elemento video ocupe todo o espaço */
#qr-reader video {
    width: 100% !important;
    height: auto !important;
    min-height: 300px;
    object-fit: cover;
    background: #000;
    display: block;
}

/* Estilo para o elemento de scan region */
#qr-reader__scan_region {
    background: #000 !important;
}

#qr-reader__dashboard {
    background: #1a1a1a;
    border-top: 1px solid var(--primary-color);
    padding: 10px;
}

#qr-reader__dashboard button {
    background: var(--primary-color) !important;
    border: none !important;
    border-radius: 6px !important;
    padding: 8px 15px !important;
    color: white !important;
    font-weight: 600 !important;
    cursor: pointer;
}

.camera-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.97);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.camera-container {
    background: #1a1a1a;
    padding: 20px;
    border-radius: 15px;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    max-height: 90%;
    overflow: auto;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
    border: 1px solid #333;
}

.close-camera {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    font-size: 1.3rem;
    cursor: pointer;
    z-index: 1001;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.close-camera:hover {
    background: white;
    transform: scale(1.1);
}

.form-label {
    font-weight: 600;
    color: var(--primary-light);
    margin-bottom: 8px;
}

.logout-section {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #444;
}

/* ===============================================
   RESPONSIVIDADE
   =============================================== */
@media (max-width: 480px) {
    .main-container {
        margin: 20px 15px;
    }
    
    .content {
        padding: 25px 20px;
    }
    
    .header {
        padding: 20px 15px;
    }
    
    .logo-img {
        width: 70px;
        height: 70px;
    }
    
    #qr-reader {
        min-height: 250px;
    }
    
    #qr-reader video {
        min-height: 250px;
    }
}

/* ===============================================
   ESTILOS DE IMPRESSÃO (@media print)
   =============================================== */
@media print {
    body, .main-container {
        background: #ffffff !important;
        color: #000000 !important;
        box-shadow: none !important;
        border: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    .no-print, .nav-buttons, .logout-section, .status-indicator, button, form, #cameraBtn, .alert {
        display: none !important;
    }
    .header {
        background: #ffffff !important;
        color: #000000 !important;
        border-bottom: 2px solid #000000 !important;
        padding: 15px 0 !important;
    }
    .header h1 {
        color: #000000 !important;
        text-shadow: none !important;
    }
    .header .subtitle {
        color: #555555 !important;
    }
    .summary-card {
        background: #f8f9fa !important;
        border: 1px solid #dddddd !important;
        color: #000000 !important;
        box-shadow: none !important;
    }
    .summary-card h3 {
        color: #000000 !important;
    }
    .summary-card p {
        color: #333333 !important;
    }
    table {
        width: 100% !important;
        border-collapse: collapse !important;
        margin-top: 20px !important;
    }
    table, th, td {
        border: 1px solid #cccccc !important;
        color: #000000 !important;
        background: #ffffff !important;
    }
    th {
        background-color: #eeeeee !important;
        color: #000000 !important;
        font-weight: bold !important;
        padding: 10px !important;
    }
    td {
        padding: 8px !important;
    }
    .badge {
        border: 1px solid #000000 !important;
        color: #000000 !important;
        background: transparent !important;
        font-weight: bold !important;
    }
}