/* ==========================================================================
   JOULE TECHNOLOGIES - GLOBAL STYLESHEET
   Unified Master Stylesheet for Electronics Test Sourcing Platform
   Location: asset/css/style.css
   ========================================================================== */

/* ==========================================================================
   1. CORE DESIGN SYSTEM & VARIABLES
   ========================================================================== */
:root {
    /* Brand Colors */
    --joule-navy: #121316;
    --joule-graphite: #262422;
    --joule-cyan: #FF5C39;
    --joule-orange: #FF5C39;
    --joule-orange-hover: #e04a2a;
    --joule-silver: #94A3B8;
    --joule-bg-dark: #121314;
    --joule-bg-light: #F8FAFC;
    --joule-border: rgba(255, 255, 255, 0.08);

    /* Industrial Accent Tokens */
    --industrial-orange: #FF5100;
    --industrial-orange-hover: #E04700;
    --industrial-cyan: #00A8FF;
    --industrial-dark: #121212;
    --industrial-light-text: #E0E0E0;

    /* Theme Tokens */
    --bg-body: #F8F9FA;
    --dark-header: #121212;
    --text-main: #212529;
    --text-muted: #6C757D;
    --border-color: #DEE2E6;
    --card-bg: #FFFFFF;
    --stock-green: #10b981;
}

/* Base Document Settings */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 88px;
}

[id] {
    scroll-margin-top: 88px;
}

body {
    font-family: 'Montserrat', sans-serif;
    line-height: 1.5;
}

/* Background for Dark Grid Theme */
body.bg-grid-pattern {
    background-color: #121314;
    color: #ffffff;
}

/* Background for Light Theme Pages */
body.bg-slate-50,
body.bg-gray-50 {
    background-color: #F8FAFC;
    color: #111827;
}

/* Universal Focus Ring */
.focus-ring:focus-visible {
    outline: 2px solid #FF5C39;
    outline-offset: 3px;
}

/* General Transition Utility */
.transition-all {
    transition-property: all;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 300ms;
}

/* Accessibility: Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Button & Action Elements Wrapping */
button,
.btn,
.btn-accion,
.btn-importar,
.btn-editar,
.btn-guardar,
.btn-cancelar {
    white-space: nowrap !important;
}

/* ==========================================================================
   2. SCROLLBARS (DARK & LIGHT THEMES)
   ========================================================================== */
/* Dark Scrollbar (Default on dark pages) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #07080c;
}

::-webkit-scrollbar-thumb {
    background: #780606;
    border-radius: 4px;
}

/* Light Scrollbar for Light Pages and Admin Areas */
body.bg-slate-50::-webkit-scrollbar,
body.bg-gray-50::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

body.bg-slate-50::-webkit-scrollbar-track,
body.bg-gray-50::-webkit-scrollbar-track {
    background: #f1f5f9;
}

body.bg-slate-50::-webkit-scrollbar-thumb,
body.bg-gray-50::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

/* Subtle Scrollbar for Sidebars */
.sidebar-scroll::-webkit-scrollbar,
.filters-sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar-scroll::-webkit-scrollbar-track,
.filters-sidebar::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.sidebar-scroll::-webkit-scrollbar-thumb,
.filters-sidebar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

/* ==========================================================================
   3. JOULE DARK THEME & GLASSMORPHISM
   ========================================================================== */
.glass-card {
    background: rgba(12, 12, 12, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.glow-cyan {
    box-shadow: 0 0 25px rgba(6, 182, 212, 0.2);
}

.glow-orange {
    box-shadow: 0 0 25px rgba(249, 115, 22, 0.25);
}

.customer-card {
    min-height: 190px;
}

.status-message {
    min-height: 1.25rem;
}

/* ==========================================================================
   4. ARTICLE CONTENT & HELP CENTER TYPOGRAPHY
   ========================================================================== */
.article-content p {
    margin-bottom: 1.25rem;
    line-height: 1.75;
}

.article-content h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #fff;
}

.article-content ul {
    list-style-type: disc;
    padding-left: 1.5rem;
    margin-bottom: 1.25rem;
}

.article-content li {
    margin-bottom: 0.5rem;
}

/* FAQ Accordion Details */
details > summary {
    list-style: none;
    cursor: pointer;
}

details > summary::-webkit-details-marker {
    display: none;
}

details[open] summary ~ * {
    animation: sweep 0.3s ease-in-out;
}

@keyframes sweep {
    0% {
        opacity: 0;
        margin-top: -10px;
    }
    100% {
        opacity: 1;
        margin-top: 0px;
    }
}

/* Help Main Documentation Prose */
.prose p {
    margin-bottom: 1.25rem;
    line-height: 1.75;
    color: #94A3B8;
}

.prose h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #fff;
}

.prose ul {
    list-style-type: disc;
    padding-left: 1.5rem;
    margin-bottom: 1.25rem;
    color: #94A3B8;
}

.prose li {
    margin-bottom: 0.5rem;
}

.prose strong {
    color: #fff;
    font-weight: 600;
}

.prose .highlight-box {
    background: rgba(255, 92, 57, 0.1);
    border-left: 4px solid #FF5C39;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 0 0.5rem 0.5rem 0;
    color: #fff;
}

/* ==========================================================================
   5. MODALS & FADE ANIMATIONS
   ========================================================================== */
#errorModal,
#deleteModal {
    transition: opacity 0.3s ease;
}

.fade-in {
    animation: fadeIn 0.3s ease-in-out forwards;
}

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

/* ==========================================================================
   6. E-COMMERCE & FORM CONTROLS
   ========================================================================== */
/* Hide Spin Arrows in Number Inputs */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Loading States for Buttons & Containers */
.is-loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Checkout Payment Details Toggle */
.payment-details {
    display: none;
}

input[type="radio"]:checked ~ .payment-details {
    display: block;
}

/* ==========================================================================
   7. INDUSTRIAL CATALOG ENGINE
   ========================================================================== */
/* Catalog Layout */
.catalog-container {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr);
    gap: 24px;
    max-width: 1400px;
    margin: 30px auto;
    padding: 0 20px;
    flex: 1;
    width: 100%;
}

/* Filters Sidebar */
.filters-sidebar {
    position: sticky;
    top: 100px;
    align-self: start;
    max-height: calc(100vh - 120px);
    overflow: auto;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #ffffff;
    padding: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.filters-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 800;
    font-size: 1.1rem;
    margin-bottom: 5px;
    color: #121316;
}

.filter-status {
    font-size: 0.8rem;
    color: #64748b;
    padding-bottom: 15px;
    font-weight: 500;
}

.filter-group {
    border-top: 1px solid #f1f5f9;
    padding: 14px 0;
}

.accordion-header {
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    font-weight: 700;
    cursor: pointer;
    padding: 6px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Montserrat', sans-serif;
    color: #334155;
    font-size: 0.95rem;
}

.accordion-header:after {
    content: '+';
    color: #94a3b8;
    font-size: 1.2rem;
    line-height: 1;
}

.filter-group.active .accordion-header:after {
    content: '−';
}

.accordion-content {
    display: none;
    padding: 8px 0;
}

.filter-group.active .accordion-content {
    display: block;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 0.85rem;
    color: #475569;
    cursor: pointer;
    font-weight: 500;
    transition: color 0.2s;
}

.checkbox-label:hover {
    color: #121316;
}

.checkbox-label small {
    margin-left: auto;
    color: #64748b;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
}

.checkbox-label input[type="checkbox"],
.checkbox-label input[type="radio"] {
    accent-color: #FF5C39;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.range-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 5px;
}

.range-grid input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
    outline: none;
    transition: all 0.2s;
}

.range-grid input:focus {
    border-color: #FF5C39;
    box-shadow: 0 0 0 2px rgba(255, 92, 57, 0.15);
}

.filter-actions {
    display: flex;
    gap: 10px;
    padding-top: 15px;
}

.filter-actions button,
.filter-actions a {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 700;
    transition: all 0.2s;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
}

.filter-actions button {
    border: 0;
    background: #FF5C39;
    color: #fff;
    box-shadow: 0 4px 10px -2px rgba(255, 92, 57, 0.3);
}

.filter-actions button:hover {
    background: #e04a2a;
}

.filter-actions a {
    border: 1px solid #cbd5e1;
    color: #475569;
    background: #fff;
}

.filter-actions a:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

/* Results Area */
.results-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding: 16px 20px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.results-count {
    font-size: 0.95rem;
    font-weight: 700;
    color: #121316;
}

.sort-select {
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.85rem;
    color: #334155;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    background-color: #fff;
    transition: all 0.2s;
}

.sort-select:focus {
    border-color: #FF5C39;
    box-shadow: 0 0 0 2px rgba(255, 92, 57, 0.15);
}

/* Product Cards (Horizontal Industrial List) */
.product-card-horizontal {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr) 220px;
    gap: 24px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.product-card-horizontal:hover {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
    border-color: #cbd5e1;
}

.product-img-box {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 160px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #f1f5f9;
    padding: 10px;
}

.product-img-box img {
    max-width: 100%;
    max-height: 140px;
    object-fit: contain;
    mix-blend-mode: multiply;
}

.product-technical-title {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.product-pn {
    font-size: 1.4rem;
    font-weight: 800;
    margin: 4px 0 8px;
}

.product-pn a {
    color: #121316;
    text-decoration: none;
    transition: color 0.2s;
}

.product-pn a:hover {
    color: #FF5C39;
}

.product-family {
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 12px;
    font-weight: 600;
}

.specs-table {
    width: 100%;
    border-collapse: collapse;
}

.specs-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.85rem;
}

.specs-table tr:last-child td {
    border-bottom: none;
}

.spec-label {
    width: 45%;
    color: #64748b;
    font-weight: 500;
}

.spec-value {
    font-weight: 700;
    color: #334155;
}

.more-specs {
    display: inline-flex;
    align-items: center;
    margin-top: 12px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #0ea5e9;
    text-decoration: none;
    transition: color 0.2s;
}

.more-specs:hover {
    color: #0284c7;
    text-decoration: underline;
}

/* Actions Box */
.product-actions-box {
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-left: 1px solid #f1f5f9;
    padding-left: 24px;
}

.stock-indicator {
    display: inline-flex;
    align-items: center;
    font-size: 0.8rem;
    color: #10b981;
    background: #d1fae5;
    padding: 6px 12px;
    border-radius: 999px;
    font-weight: 700;
    margin-bottom: 12px;
    width: fit-content;
}

.stock-indicator.backorder {
    color: #d97706;
    background: #fef3c7;
}

.price-line {
    font-size: 1.25rem;
    color: #121316;
    font-weight: 800;
    margin-bottom: 15px;
}

.purchase-controls {
    display: flex;
    gap: 8px;
}

.qty-input {
    width: 70px;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
}

.qty-input:focus {
    border-color: #FF5C39;
    box-shadow: 0 0 0 2px rgba(255, 92, 57, 0.15);
}

.btn-add-quote {
    flex: 1;
    border: 0;
    background: #121316;
    color: #fff;
    border-radius: 8px;
    padding: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.85rem;
}

.btn-add-quote:hover {
    background: #FF5C39;
}

/* Empty State */
.empty-state {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-top: 20px;
}

.empty-state h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: #121316;
    margin-bottom: 10px;
}

.empty-state p {
    color: #64748b;
    margin-bottom: 24px;
    font-weight: 500;
}

.empty-state a {
    display: inline-block;
    background: #FF5C39;
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    transition: background 0.2s;
}

.empty-state a:hover {
    background: #e04a2a;
}

/* Active Filter Badges */
.active-filter {
    display: inline-flex;
    align-items: center;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #ea580c;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
}

/* Catalog Pagination */
.pagination {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 40px 0;
}

.pagination a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    text-decoration: none;
    color: #475569;
    font-weight: 700;
    background: #fff;
    transition: all 0.2s;
}

.pagination a:hover {
    border-color: #94a3b8;
    background: #f8fafc;
    color: #121316;
}

.pagination a.active {
    background: #121316;
    color: #fff;
    border-color: #121316;
}

/* Demo Banner */
.demo-banner {
    max-width: 1400px;
    margin: 20px auto 0;
    padding: 14px 20px;
    font-size: 0.85rem;
    color: #0284c7;
    background: #e0f2fe;
    border: 1px solid #bae6fd;
    border-radius: 12px;
    text-align: center;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.demo-banner a {
    color: #0369a1;
    font-weight: 800;
    text-decoration: underline;
    transition: color 0.2s;
}

.demo-banner a:hover {
    color: #FF5C39;
}

/* Loading States & Spinners */
.filter-loading {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
}

.filter-loading.active {
    display: flex;
}

.filter-loading-box {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    padding: 20px 30px;
    font-size: 0.95rem;
    font-weight: 700;
    color: #121316;
    display: flex;
    align-items: center;
}

.results-area {
    position: relative;
    min-width: 0;
}

.results-loading {
    position: absolute;
    inset: 0;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 100px;
    background: rgba(248, 250, 252, 0.7);
    z-index: 10;
    border-radius: 12px;
    backdrop-filter: blur(2px);
}

.results-loading.active {
    display: flex;
}

.results-spinner {
    display: inline-block;
    width: 34px;
    height: 34px;
    border: 4px solid #e2e8f0;
    border-top-color: #FF5C39;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

#resultsContent {
    transition: opacity 0.2s ease;
}

#resultsContent.is-loading {
    opacity: 0.3;
    pointer-events: none;
}

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

/* Responsive Catalog Overrides */
@media (max-width: 1050px) {
    .catalog-container {
        grid-template-columns: 1fr;
    }
    .filters-sidebar {
        position: relative;
        top: 0;
        max-height: none;
        margin-bottom: 20px;
    }
    .product-card-horizontal {
        grid-template-columns: 140px minmax(0, 1fr);
    }
    .product-actions-box {
        grid-column: 2;
        border-left: none;
        border-top: 1px solid #f1f5f9;
        padding-left: 0;
        padding-top: 16px;
        margin-top: 16px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    .results-header-bar {
        flex-wrap: wrap;
    }
}

@media (max-width: 650px) {
    .product-card-horizontal {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .product-actions-box {
        grid-column: 1;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .product-img-box {
        min-height: 200px;
    }
    .purchase-controls {
        display: flex;
    }
}

/* ==========================================================================
   8. B2B PRODUCT DETAIL, CART & SECURE CHECKOUT MODULES
   ========================================================================== */
.b2b-header {
    background-color: var(--industrial-dark);
    color: var(--industrial-light-text);
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid #1F2937;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background-color: var(--industrial-orange);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: 1px;
}

.ssl-badge {
    background-color: #111827;
    border: 1px solid #1F2937;
    padding: 0.375rem 0.75rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: #D1D5DB;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.b2b-footer {
    background: var(--industrial-dark);
    color: var(--industrial-light-text);
    border-top: 1px solid #1F2937;
    padding: 2rem 0;
    margin-top: 4rem;
}