/* ========================================
   WEB PRICE CHECKER - ODOO NATIVE STYLE
   Clean, White, Professional
   ======================================== */

:root {
    /* Odoo Color Palette */
    --odoo-primary: #714B67;
    --odoo-primary-light: #875A7B;
    --odoo-primary-dark: #5E3D57;
    --odoo-success: #28a745;
    --odoo-warning: #ffc107;
    --odoo-danger: #dc3545;
    --odoo-info: #17a2b8;

    /* Neutral Colors */
    --white: #ffffff;
    --gray-50: #f8f9fa;
    --gray-100: #f1f3f4;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
}

/* ========================================
   GLOBAL STYLES
   ======================================== */

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

html {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--gray-100);
    color: var(--gray-900);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   MAIN CONTAINER
   ======================================== */

.price-checker-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
    background: var(--gray-100);
}

.price-checker-container {
    width: 100%;
    max-width: 900px;
}

/* ========================================
   HEADER
   ======================================== */

.price-checker-header {
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.header-icon {
    width: 60px;
    height: 60px;
    background: var(--odoo-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--spacing-md);
    box-shadow: var(--shadow-md);
}

.header-icon i {
    font-size: 1.75rem;
    color: var(--white);
}

.price-checker-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
}

.price-checker-header .subtitle {
    color: var(--gray-600);
    font-size: 0.875rem;
}

/* ========================================
   SEARCH SECTION
   ======================================== */

.search-section {
    margin-bottom: var(--spacing-lg);
}

.search-box {
    display: flex;
    gap: var(--spacing-md);
    align-items: center;
}

.input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: var(--spacing-md);
    font-size: 1.25rem;
    color: var(--gray-500);
    pointer-events: none;
}

.barcode-input {
    width: 100%;
    padding: 0.875rem 3.5rem 0.875rem 3rem;
    font-size: 1rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    background: var(--white);
    color: var(--gray-900);
    transition: all 0.2s;
    outline: none;
}

.barcode-input:focus {
    border-color: var(--odoo-primary);
    box-shadow: 0 0 0 3px rgba(113, 75, 103, 0.1);
}

.barcode-input::placeholder {
    color: var(--gray-500);
}

.camera-btn {
    position: absolute;
    right: 0.5rem;
    width: 2.5rem;
    height: 2.5rem;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--gray-100);
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
}

.camera-btn:hover {
    background: var(--gray-200);
    color: var(--odoo-primary);
}

.search-btn {
    padding: 0.875rem 2rem;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    background: var(--odoo-primary);
    color: var(--white);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
}

.search-btn:hover {
    background: var(--odoo-primary-dark);
    box-shadow: var(--shadow);
}

.search-btn i {
    font-size: 1.125rem;
}

/* ========================================
   LOADER
   ======================================== */

.loader-container {
    text-align: center;
    padding: var(--spacing-xl);
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.loader-spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto var(--spacing-md);
    border: 4px solid var(--gray-200);
    border-top-color: var(--odoo-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loader-container p {
    color: var(--gray-600);
    font-size: 0.9375rem;
}

/* ========================================
   RESULT CONTAINER
   ======================================== */

.result-container {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.product-card-inner {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 0;
}

.product-image-section {
    background: var(--gray-50);
    padding: var(--spacing-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid var(--gray-200);
}

.product-image {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
}

.product-no-image {
    width: 120px;
    height: 120px;
    background: var(--gray-100);
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-no-image i {
    font-size: 3rem;
    color: var(--gray-400);
}

.product-info-section {
    padding: var(--spacing-xl);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.product-category {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    background: var(--odoo-primary);
    color: var(--white);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    align-self: flex-start;
}

.product-name {
    color: var(--gray-900);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
    line-height: 1.3;
}

.product-code {
    color: var(--gray-600);
    font-size: 0.875rem;
    margin-bottom: var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-family: 'Courier New', monospace;
}

.product-code i {
    color: var(--gray-500);
}

.product-price-box {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.price-label {
    color: var(--gray-600);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--spacing-xs);
    font-weight: 600;
}

.price-value {
    color: var(--odoo-success);
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
}

.product-stock {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.stock-indicator {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.875rem;
}

.stock-indicator.in-stock {
    background: rgba(40, 167, 69, 0.1);
    color: var(--odoo-success);
    border: 1px solid rgba(40, 167, 69, 0.2);
}

.stock-indicator.out-of-stock {
    background: rgba(220, 53, 69, 0.1);
    color: var(--odoo-danger);
    border: 1px solid rgba(220, 53, 69, 0.2);
}

.stock-indicator.low-stock {
    background: rgba(255, 193, 7, 0.1);
    color: var(--odoo-warning);
    border: 1px solid rgba(255, 193, 7, 0.2);
}

.retry-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 0.625rem 1.25rem;
    background: var(--odoo-primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: var(--spacing-md);
}

.retry-btn:hover {
    background: var(--odoo-primary-dark);
}

/* ========================================
   ERROR CONTAINER
   ======================================== */

.error-container {
    text-align: center;
    padding: var(--spacing-xl);
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow);
}

.error-icon {
    width: 80px;
    height: 80px;
    background: rgba(220, 53, 69, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--spacing-lg);
}

.error-icon i {
    font-size: 2.5rem;
    color: var(--odoo-danger);
}

.error-container h3 {
    color: var(--gray-900);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
}

.error-container p {
    color: var(--gray-600);
    font-size: 0.9375rem;
    margin-bottom: var(--spacing-lg);
}

/* ========================================
   INSTRUCTIONS (Hidden by default)
   ======================================== */

.instructions-section {
    display: none;
}

/* ========================================
   SCANNER MODAL
   ======================================== */

.scanner-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
}

.scanner-modal-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.scanner-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.scanner-header h3 {
    color: var(--gray-900);
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.scanner-header h3 i {
    color: var(--odoo-primary);
}

.close-scanner-btn {
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.close-scanner-btn:hover {
    background: var(--gray-200);
    color: var(--gray-900);
}

.scanner-body {
    padding: var(--spacing-lg);
}

.video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
}

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

.scan-region-highlight {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 40%;
    border: 2px solid var(--odoo-primary);
    border-radius: var(--radius);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
}

.scan-line {
    position: absolute;
    top: 0;
    left: 5%;
    width: 90%;
    height: 2px;
    background: var(--odoo-primary);
    box-shadow: 0 0 10px var(--odoo-primary);
    animation: scanLine 2s ease-in-out infinite;
}

@keyframes scanLine {

    0%,
    100% {
        top: 10%;
    }

    50% {
        top: 85%;
    }
}

.scanner-instruction {
    text-align: center;
    color: var(--gray-600);
    margin-top: var(--spacing-md);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
}

.scanner-footer {
    padding: var(--spacing-md) var(--spacing-lg) var(--spacing-lg);
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
}

.torch-btn {
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid var(--gray-400) !important;
    border-radius: var(--radius-sm);
    background: var(--gray-800) !important;
    color: var(--white) !important;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
}

.torch-btn:hover:not(:disabled) {
    background: var(--gray-700) !important;
    /* Un poco más claro */
    border-color: var(--gray-300) !important;
    color: var(--white) !important;
}

.torch-btn.active {
    background: var(--odoo-warning) !important;
    border-color: var(--odoo-warning) !important;
    color: var(--gray-900) !important;
}

.torch-btn:disabled {
    opacity: 1 !important;
    cursor: not-allowed;
    background: var(--gray-800) !important;
    color: var(--gray-500) !important;
    /* Un poco más oscuro que white para diferenciar */
}

.switch-camera-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 0.625rem 1.25rem;
    border: 1px solid var(--gray-400) !important;
    border-radius: var(--radius);
    background: var(--gray-800) !important;
    color: var(--white) !important;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
    font-weight: 500;
}

.switch-camera-btn:hover {
    background: var(--gray-900) !important;
    border-color: var(--odoo-primary) !important;
    color: var(--white) !important;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    .price-checker-wrap {
        padding: var(--spacing-sm);
        align-items: flex-start;
        padding-top: var(--spacing-md);
    }

    .price-checker-header {
        margin-bottom: var(--spacing-md);
    }

    .header-icon {
        width: 50px;
        height: 50px;
        margin-bottom: var(--spacing-sm);
    }

    .header-icon i {
        font-size: 1.5rem;
    }

    .price-checker-header h1 {
        font-size: 1.25rem;
    }

    .price-checker-header .subtitle {
        font-size: 0.8125rem;
    }

    .search-section {
        margin-bottom: var(--spacing-md);
    }

    .search-box {
        flex-direction: column;
    }

    .search-btn {
        width: 100%;
        justify-content: center;
    }

    .product-card-inner {
        grid-template-columns: 1fr;
    }

    .product-image-section {
        border-right: none;
        border-bottom: 1px solid var(--gray-200);
        padding: var(--spacing-lg);
    }

    .product-image {
        max-height: 150px;
    }

    .product-info-section {
        padding: var(--spacing-md);
    }

    .product-name {
        font-size: 1.25rem;
    }

    .product-price-box {
        padding: var(--spacing-md);
        margin-bottom: var(--spacing-md);
    }

    .price-value {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .header-icon {
        width: 60px;
        height: 60px;
    }

    .header-icon i {
        font-size: 2rem;
    }

    .price-checker-header h1 {
        font-size: 1.5rem;
    }

    .switch-camera-btn span {
        display: none;
    }
}