/* ============================================
   COMPARAMERCADO - Estilos Principais
   Sistema de Comparação de Preços
   ============================================ */

/* ===== VARIÁVEIS CSS ===== */
:root {
    --primary-color: #2c5aa0;
    --secondary-color: #f8f9fa;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-radius: 12px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* ===== RESET E BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--dark-color);
}

/* ===== CONTAINER PRINCIPAL ===== */
.main-container {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin: 20px auto;
    max-width: 1400px;
    overflow: hidden;
}

/* ===== HEADER ===== */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #4a90e2 100%);
    color: white;
    padding: 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(180deg); }
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

/* ===== BOTÕES DE AÇÃO ===== */
.action-buttons {
    padding: 2rem;
    background: var(--secondary-color);
    border-bottom: 1px solid #dee2e6;
}

.btn-custom {
    border-radius: var(--border-radius);
    padding: 12px 24px;
    font-weight: 500;
    transition: var(--transition);
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn-custom:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-primary-custom {
    background: linear-gradient(135deg, var(--primary-color), #4a90e2);
    color: white;
}

.btn-success-custom {
    background: linear-gradient(135deg, var(--success-color), #20c997);
    color: white;
}

.btn-warning-custom {
    background: linear-gradient(135deg, var(--warning-color), #fd7e14);
    color: white;
}

/* ===== TABELA ===== */
.table-container {
    padding: 2rem;
    background: white;
}

.table-custom {
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    border: none;
}

.table-custom thead {
    background: linear-gradient(135deg, var(--dark-color), #495057);
    color: white;
}

.table-custom thead th {
    border: none;
    padding: 1rem;
    font-weight: 600;
    text-align: center;
}

.table-custom tbody tr {
    transition: var(--transition);
    border-bottom: 1px solid #f1f3f4;
}

.table-custom tbody tr:hover {
    background: #f8f9fa;
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.table-custom tbody td {
    padding: 1rem;
    vertical-align: middle;
    text-align: center;
    border: none;
}

/* ===== CÉLULAS DE PREÇO ===== */
.price-cell {
    cursor: pointer;
    transition: var(--transition);
    border-radius: 8px;
    padding: 0.75rem;
    font-weight: 500;
    position: relative;
}

.price-cell:hover {
    background: #e3f2fd;
    transform: scale(1.05);
}

.price-cell.editing {
    background: #fff3cd !important;
    border: 2px solid #ffc107;
    transform: scale(1.02);
}

.price-display {
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.price-edit {
    position: relative;
}

.price-edit input {
    text-align: center;
    font-weight: 600;
}

.price-edit .btn-group {
    width: 100%;
}

.price-edit .btn {
    flex: 1;
}

.price-cell .text-muted {
    font-style: italic;
    font-size: 0.9em;
}

/* ===== ELEMENTOS DE TEXTO ===== */
kbd {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    box-shadow: inset 0 -1px 0 #dee2e6;
    color: #495057;
    font-size: 0.875em;
    padding: 0.2rem 0.4rem;
}

.mais-barato {
    background: linear-gradient(135deg, #d4edda, #c3e6cb) !important;
    color: var(--success-color) !important;
    font-weight: 600;
    border-radius: 8px;
    position: relative;
}

.mais-barato::before {
    content: '🏆';
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
}

.destaque {
    font-weight: 600;
    color: var(--success-color);
}

.economia-badge {
    background: linear-gradient(135deg, var(--success-color), #20c997);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    display: inline-block;
}

/* ===== BOTÕES DE AÇÃO ===== */
.action-btn {
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.action-btn:hover {
    transform: scale(1.1);
}

/* ===== CARDS DE ESTATÍSTICAS ===== */
.stats-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--box-shadow);
    text-align: center;
    transition: var(--transition);
}

.stats-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.stats-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.stats-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stats-label {
    color: #6c757d;
    font-weight: 500;
}

/* ===== ESTADOS VAZIOS ===== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    color: #dee2e6;
}

/* ===== LOADING ===== */
.loading {
    display: none;
    text-align: center;
    padding: 2rem;
}

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

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== CAMPO DE PESQUISA ===== */
.search-container {
    margin: 30px 0;
}

.search-box {
    position: relative;
}

.search-box .input-group-text {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border: none;
    border-radius: 10px 0 0 10px;
}

.search-box .form-control {
    border: 2px solid #e9ecef;
    border-radius: 0 10px 10px 0;
    font-size: 16px;
    padding: 15px 20px;
    transition: all 0.3s ease;
}

.search-box .form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.search-box .btn-outline-secondary {
    border: 2px solid #e9ecef;
    border-left: none;
    border-radius: 0 10px 10px 0;
    padding: 15px 20px;
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #e9ecef;
    border-top: none;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
}

.suggestion-header {
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    font-weight: bold;
    color: #495057;
}

.suggestion-item {
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 1px solid #f8f9fa;
    transition: background-color 0.2s ease;
}

.suggestion-item:hover {
    background-color: #f8f9fa;
}

.suggestion-item i {
    margin-right: 10px;
    color: #007bff;
}

.suggestion-more {
    padding: 10px 20px;
    text-align: center;
    color: #6c757d;
    font-style: italic;
    background: #f8f9fa;
}

.search-info {
    text-align: center;
}

.search-info i {
    margin-right: 5px;
    color: #007bff;
}

/* ===== ANIMAÇÕES ===== */
@keyframes highlightProduct {
    0% { 
        background-color: #e3f2fd; 
        transform: scale(1);
    }
    50% { 
        background-color: #bbdefb; 
        transform: scale(1.02);
    }
    100% { 
        background-color: #e3f2fd; 
        transform: scale(1);
    }
}

.product-highlight {
    animation: highlightProduct 1.5s ease-in-out;
    border-left: 4px solid #2196f3 !important;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

/* ===== MODAL DE CONFIRMAÇÃO ===== */
.barcode-display h3 {
    font-family: 'Courier New', monospace;
    font-size: 2em;
    font-weight: bold;
    color: #007bff;
    margin: 20px 0;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.barcode-display p {
    font-size: 1.1em;
    color: #6c757d;
    margin-bottom: 0;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 1.1em;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.btn-lg:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* ===== CONTADOR DE LEITURA ===== */
.counter-display {
    padding: 20px;
}

.counter-display h3 {
    font-size: 1.5em;
    font-weight: bold;
    margin: 10px 0;
}

.progress {
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    transition: width 0.3s ease;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.counter-display i {
    animation: pulse 1s infinite;
}

/* ===== RESPONSIVIDADE ===== */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }
    
    .header p {
        font-size: 1rem;
    }
    
    .table-container {
        padding: 1rem;
    }
    
    .table-custom {
        font-size: 0.9rem;
    }
    
    .table-custom thead th,
    .table-custom tbody td {
        padding: 0.75rem 0.5rem;
    }
    
    .btn-custom {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
    
    .search-box .form-control {
        font-size: 14px;
        padding: 12px 15px;
    }
    
    .search-box .input-group-text {
        padding: 12px 15px;
    }
    
    .search-box .btn-outline-secondary {
        padding: 12px 15px;
    }
}

@media (max-width: 576px) {
    .main-container {
        margin: 10px;
    }
    
    .header {
        padding: 1.5rem;
    }
    
    .action-buttons {
        padding: 1rem;
    }
    
    .table-custom {
        font-size: 0.8rem;
    }
    
    .table-custom thead th,
    .table-custom tbody td {
        padding: 0.5rem 0.25rem;
    }
    
    .barcode-display h3 {
        font-size: 1.5em;
    }
    
    .btn-lg {
        padding: 10px 20px;
        font-size: 1em;
        margin: 5px;
    }
}

/* ===== ESTILOS PARA VALIDAÇÃO DE FORMULÁRIOS ===== */
.form-control.is-invalid,
.form-select.is-invalid,
input.is-invalid,
select.is-invalid,
textarea.is-invalid {
    border-color: var(--danger-color) !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.8 3.6 .4.4.4-.4m0 4.8-.4-.4-.4.4'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
    padding-right: calc(1.5em + 0.75rem);
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus,
input.is-invalid:focus,
select.is-invalid:focus,
textarea.is-invalid:focus {
    border-color: var(--danger-color) !important;
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25) !important;
}

.invalid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: var(--danger-color);
    font-weight: 500;
}

.invalid-feedback::before {
    content: "⚠️ ";
    margin-right: 5px;
}

/* Animação para campos com erro */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.form-control.is-invalid,
.form-select.is-invalid {
    animation: shake 0.5s ease-in-out;
}

