/**
 * =====================================================
 * Ford-Tuc - Custom Styles
 * Fecha: 2025-12-18 21:25
 * Actualizado: 2025-12-18 23:30 - Estilos para buscador inteligente
 * Actualizado: 2025-12-19 00:30 - Estilo para precio "Consultar"
 * Autor: Alejandro J. Elías -- Director -- DeveloperTeam Software Solutions
 * =====================================================
 */

/* ========== Variables ========== */
:root {
    --primary-color: #1e40af;
    --primary-dark: #1e3a8a;
    --primary-light: #3b82f6;
    --secondary-color: #64748b;
    --success-color: #16a34a;
    --danger-color: #dc2626;
    --warning-color: #f59e0b;
    --dark-color: #1e293b;
    --light-color: #f8fafc;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ========== Base ========== */
body {
    font-family: var(--font-family);
    background-color: #fff;
    color: #334155;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-dark);
}

/* ========== Navbar ========== */
.navbar {
    padding: 0.75rem 0;
}

.navbar-brand {
    font-weight: 700;
}

.nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    color: #475569;
    transition: color 0.2s ease;
}

.nav-link:hover {
    color: var(--primary-color);
}

.dropdown-menu {
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    border-radius: 0.5rem;
}

.dropdown-item {
    padding: 0.5rem 1rem;
    font-weight: 500;
}

.dropdown-item:hover {
    background-color: var(--light-color);
    color: var(--primary-color);
}

/* ========== Hero Section ========== */
.hero-section {
    min-height: 500px;
}

.hero-slide {
    min-height: 500px;
    display: flex;
    align-items: center;
}

.heroSwiper .swiper-button-next,
.heroSwiper .swiper-button-prev {
    color: #fff;
    background: rgba(0, 0, 0, 0.3);
    padding: 2rem;
    border-radius: 50%;
}

.heroSwiper .swiper-button-next:after,
.heroSwiper .swiper-button-prev:after {
    font-size: 1.2rem;
}

.heroSwiper .swiper-pagination-bullet {
    background: #fff;
    opacity: 0.5;
}

.heroSwiper .swiper-pagination-bullet-active {
    opacity: 1;
    background: #fff;
}

/* ========== Product Cards ========== */
.product-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-radius: 0.75rem;
    overflow: hidden;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1) !important;
}

.product-img {
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s ease, opacity 0.3s ease;
    background-color: #f1f5f9;
}

.product-img.lazy-img {
    opacity: 0.6;
}

.product-img.lazy-img.loaded {
    opacity: 1;
}

.product-card:hover .product-img {
    transform: scale(1.05);
}

.product-card .card-body {
    padding: 1.25rem;
}

.product-card .card-title {
    font-size: 0.95rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ========== Category Cards ========== */
.category-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-radius: 0.75rem;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1) !important;
}

.category-card i {
    transition: transform 0.3s ease;
}

.category-card:hover i {
    transform: scale(1.1);
}

/* ========== Swiper Products ========== */
.productosSwiper,
.ofertasSwiper {
    padding: 1rem 0 2rem;
}

.productosSwiper .swiper-slide,
.ofertasSwiper .swiper-slide {
    height: auto;
}

.productosSwiper .swiper-button-next,
.productosSwiper .swiper-button-prev,
.ofertasSwiper .swiper-button-next,
.ofertasSwiper .swiper-button-prev {
    color: var(--primary-color);
    background: #fff;
    padding: 1.5rem;
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.productosSwiper .swiper-button-next:after,
.productosSwiper .swiper-button-prev:after,
.ofertasSwiper .swiper-button-next:after,
.ofertasSwiper .swiper-button-prev:after {
    font-size: 1rem;
}

/* ========== Buttons ========== */
.btn {
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-danger {
    background-color: var(--danger-color);
    border-color: var(--danger-color);
}

.btn-success {
    background-color: var(--success-color);
    border-color: var(--success-color);
}

/* ========== Forms ========== */
.form-control,
.form-select {
    border-radius: 0.5rem;
    padding: 0.625rem 1rem;
    border-color: #e2e8f0;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.input-group-text {
    border-radius: 0.5rem;
    background-color: var(--light-color);
    border-color: #e2e8f0;
}

/* ========== Cards ========== */
.card {
    border-radius: 0.75rem;
}

.card-header {
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem 1.25rem;
}

/* ========== Footer ========== */
.footer {
    background-color: var(--dark-color);
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.6);
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: #fff;
}

.social-links a {
    transition: opacity 0.2s ease;
}

.social-links a:hover {
    opacity: 0.8;
}

/* ========== Back to Top ========== */
.btn-back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-back-to-top.show {
    display: flex;
}

/* ========== Badge Cart ========== */
.cart-badge {
    font-size: 0.65rem;
    padding: 0.25rem 0.4rem;
}

/* ========== Feature Box ========== */
.feature-box {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.feature-box i {
    display: block;
}

/* ========== Product Detail ========== */
.product-image-container {
    position: sticky;
    top: 100px;
}

.thumb-img {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.thumb-img:hover,
.thumb-img.active {
    opacity: 1;
}

.price-box {
    border-left: 4px solid var(--primary-color);
}

/* ========== Avatar ========== */
.avatar-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ========== Min Height ========== */
.min-vh-75 {
    min-height: 75vh;
}

/* ========== Alerts ========== */
.alert {
    border: none;
    border-radius: 0.5rem;
}

/* ========== Tables ========== */
.table {
    margin-bottom: 0;
}

.table th {
    font-weight: 600;
    color: #64748b;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ========== Pagination ========== */
.pagination .page-link {
    border: none;
    margin: 0 0.15rem;
    border-radius: 0.5rem;
    color: var(--primary-color);
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
}

/* ========== List Group ========== */
.list-group-item-action {
    transition: background-color 0.2s ease, color 0.2s ease;
}

.list-group-item.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* ========== Toast / Notifications ========== */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1100;
}

.toast {
    background: #fff;
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border-radius: 0.5rem;
}

/* ========== Responsive ========== */
@media (max-width: 991.98px) {
    .hero-slide {
        min-height: 400px;
    }

    .hero-slide h1 {
        font-size: 2rem;
    }

    .navbar-collapse {
        padding: 1rem 0;
    }

    .navbar-nav {
        margin-bottom: 1rem;
    }

    .navbar .d-flex {
        justify-content: center;
        width: 100%;
        padding-top: 1rem;
        border-top: 1px solid #e2e8f0;
    }
}

@media (max-width: 767.98px) {
    .hero-slide {
        min-height: 350px;
    }

    .product-img {
        height: 160px;
    }

    .btn-back-to-top {
        bottom: 1rem;
        right: 1rem;
    }
}

/* ========== Loading Spinner ========== */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner-overlay.show {
    display: flex;
}

/* ========== Animations ========== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* ========== Smart Search ========== */
.smart-search-container {
    position: relative;
    z-index: 1050;
}

.smart-search-container .form-control {
    border-radius: 0.5rem 0 0 0.5rem;
    border-right: none;
    padding-right: 0.5rem;
}

.smart-search-container .form-control:focus {
    box-shadow: none;
    border-color: var(--primary-color);
}

.smart-search-container .btn {
    border-radius: 0 0.5rem 0.5rem 0;
}

.smart-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 0 0 0.75rem 0.75rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    max-height: 450px;
    overflow-y: auto;
    z-index: 1051;
}

.smart-search-dropdown.show {
    display: block;
    animation: slideDown 0.2s ease;
}

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

.search-loading {
    padding: 1rem;
    text-align: center;
    color: #64748b;
}

.search-results {
    padding: 0;
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: background-color 0.15s ease;
    text-decoration: none;
    color: inherit;
}

.search-result-item:hover {
    background-color: #f8fafc;
}

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

.search-result-img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 0.5rem;
    margin-right: 0.75rem;
    background-color: #f1f5f9;
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-name {
    font-weight: 500;
    font-size: 0.9rem;
    color: #1e293b;
    margin-bottom: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-meta {
    font-size: 0.8rem;
    color: #64748b;
}

.search-result-meta .codigo {
    font-family: monospace;
    background: #f1f5f9;
    padding: 0.1rem 0.3rem;
    border-radius: 0.25rem;
    margin-right: 0.5rem;
}

.search-result-price {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.95rem;
    text-align: right;
    white-space: nowrap;
}

.search-result-price.oferta {
    color: var(--danger-color);
}

.search-result-price.consultar {
    color: var(--warning-color);
    font-style: italic;
}

.search-result-price .original {
    font-size: 0.75rem;
    color: #94a3b8;
    text-decoration: line-through;
    display: block;
}

.search-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid #e2e8f0;
    text-align: center;
    background: #f8fafc;
    border-radius: 0 0 0.75rem 0.75rem;
}

.search-footer a {
    font-weight: 500;
    font-size: 0.9rem;
}

.search-no-results {
    padding: 2rem 1rem;
    text-align: center;
    color: #64748b;
}

.search-no-results i {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    display: block;
    color: #cbd5e1;
}

/* Highlight matched text */
.search-result-name mark {
    background-color: #fef08a;
    padding: 0;
    border-radius: 0.15rem;
}

/* Stock indicator */
.search-result-stock {
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border-radius: 0.25rem;
    margin-left: 0.5rem;
}

.search-result-stock.in-stock {
    background-color: #dcfce7;
    color: #166534;
}

.search-result-stock.low-stock {
    background-color: #fef3c7;
    color: #92400e;
}

.search-result-stock.no-stock {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Mobile responsive */
@media (max-width: 991.98px) {
    .smart-search-container {
        width: 100%;
        margin-bottom: 1rem;
    }

    .smart-search-container .form-control {
        min-width: 100% !important;
    }

    .smart-search-dropdown {
        position: fixed;
        left: 0.5rem;
        right: 0.5rem;
        top: auto;
        max-height: 60vh;
    }
}
