/* ========== SHARED COMPONENTS CSS (Buscador, Carrito, Login) ========== */

/* ========== HEADER ICONS (Search, User, Cart) ========== */
.header-actions {
    display: flex;
    gap: 20px;
    align-items: center;
}

.header-actions button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: var(--text-dark, #0f172a);
    transition: color 0.3s ease;
    padding: 0;
    margin: 0;
}

.header-actions button:hover {
    color: var(--teal-primary, #1e8789);
}

.cart-badge {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-badge .cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--teal-primary, #45828F);
    color: white;
    font-size: 11px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

/* ================== GLOBAL SEARCH MODAL (PREMIUM) ================== */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.search-overlay.active {
    opacity: 1;
    visibility: visible;
}

.search-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    max-height: 80vh;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 9999;
    transform: translateY(-100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.search-modal.active {
    top: 0 !important;
    transform: none !important;
    transition: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    display: flex !important;
}

.search-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px;
    width: 100%;
}

.search-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.search-input-wrapper {
    flex: 1;
    position: relative;
    min-width: 0;
}

.search-icon-input {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
}

.search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 20px 24px 20px 64px;
    border: 2px solid #f1f5f9;
    border-radius: 20px;
    font-size: 20px;
    font-weight: 500;
    font-family: inherit;
    outline: none;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    background: #f8fafc;
    color: #0f172a;
}

.search-input:focus {
    border-color: #1e8789;
    background: white;
    box-shadow: 0 0 0 5px rgba(30, 135, 137, 0.12);
    transform: translateY(-1px);
}

.search-close {
    position: relative;
    z-index: 2;
    flex: 0 0 56px;
    width: 56px;
    height: 56px;
    border: 1px solid #f1f5f9;
    background: #f8fafc;
    border-radius: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    transition: all 0.3s ease;
}

.search-close:hover {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.search-shortcuts {
    display: flex;
    gap: 10px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.search-shortcut {
    padding: 8px 16px;
    background: #e6f4f4;
    border: none;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: #166668;
    cursor: pointer;
    transition: all 0.2s;
}

.search-shortcut:hover {
    background: var(--teal-primary, #1e8789);
    color: white;
}

.search-results {
    max-height: 50vh;
    overflow-y: auto;
    padding-right: 8px;
}

.search-no-results {
    text-align: center;
    padding: 48px 24px;
    color: #64748b;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    color: #000;
    background: rgba(16, 185, 129, 0.06);
    border: 1px solid rgba(16, 185, 129, 0.1);
    margin-bottom: 12px;
}

.search-result-item:hover {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.3);
    transform: scale(1.01);
}

.search-result-image {
    width: 56px;
    height: 56px;
    background: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid #f1f5f9;
}

.search-result-image img {
    max-width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 6px;
}

.search-result-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.search-result-title {
    font-size: 15px;
    font-weight: 700;
    color: #000;
}

.search-result-price-badge {
    background: #e2e8f0;
    padding: 2px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    color: #000;
    width: fit-content;
}

.btn-search-add {
    background: white;
    border: 1px solid #e2e8f0;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-search-add:hover {
    background: var(--teal-primary, #1e8789);
    color: white;
}

.btn-search-add.added {
    background: #10b981;
    color: white;
    border-color: #10b981;
}

/* ================== CART OVERLAY ================== */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: 0.4s;
}

.cart-overlay.active {
    opacity: 1;
    visibility: visible;
}

.cart-sidebar {
    position: fixed;
    box-sizing: border-box;
    top: 0;
    right: -450px;
    width: 100%;
    max-width: 450px;
    height: 100%;
    background: white;
    z-index: 3000;
    transition: 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
}

.cart-sidebar.active {
    right: 0 !important;
    transform: none !important;
    transition: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    display: flex !important;
}

/* ================== LOGIN MODAL ================== */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: 0.4s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-overlay.active {
    opacity: 1;
    visibility: visible;
}

.login-card {
    background: #ffffff;
    border: 1px solid #f1f5f9;
    padding: 40px;
    border-radius: 24px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s, opacity 0.3s;
    z-index: 2001;
    opacity: 0;
    visibility: hidden;
    margin: 0;
}

.login-overlay.active .login-card {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.login-header h2 {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--text, #1e293b);
    text-align: center;
}

.login-header p {
    font-size: 14px;
    color: var(--text-light, #64748b);
    text-align: center;
    margin-bottom: 30px;
}

.login-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-light, #64748b);
    transition: color 0.3s;
}

.login-close:hover {
    color: var(--text, #1e293b);
}

.login-btn {
    width: 100%;
    background: var(--primary, #1e8789);
    color: white;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
}

.login-btn:hover {
    background: var(--primary-dark, #166668);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(30, 135, 137, 0.3);
}

/* ================== GLOBAL MOBILE RESPONSIVE FIXES ================== */
@media (max-width: 768px) {
    .search-modal {
        background: white;
        /* Make background fully white on mobile instead of floating */
    }

    .search-container {
        margin: 0;
        border-radius: 0;
        height: 100vh;
        max-width: 100%;
        box-shadow: none;
    }

    .search-input {
        font-size: 16px;
        padding: 14px 14px 14px 44px;
    }

    .search-header {
        padding: 16px;
    }

    .search-shortcuts {
        padding: 0 16px 12px;
    }

    .search-results {
        padding: 16px;
        max-height: calc(100vh - 140px);
        /* Adjust based on header & shortcuts height */
    }

    .cart-sidebar {
        max-width: 100%;
        /* Toma el 100% de la pantalla */
    }
}

/* ================== AUTH TRANSITION OVERLAY ================== */
.auth-transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-transition-overlay.active {
    opacity: 1;
    visibility: visible;
}

.auth-transition-content {
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-transition-overlay.active .auth-transition-content {
    transform: scale(1);
}

.auth-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(30, 135, 137, 0.1);
    border-top: 4px solid #1e8789;
    border-radius: 50%;
    margin: 0 auto 24px;
    animation: auth-spin 1s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

@keyframes auth-spin {
    to {
        transform: rotate(360deg);
    }
}

.auth-transition-text {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.5px;
}

.auth-transition-subtext {
    font-size: 15px;
    color: #64748b;
    margin-top: 8px;
    opacity: 0.8;
}

/* ========== GLOBAL NAVIGATION ========== */
.nav {
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav .nav-link {
    color: var(--text-dark);
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.5px;
    padding: 10px 0;
    text-decoration: none;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
}

.nav .nav-link i {
    font-size: 11px;
    opacity: 0.7;
    transition: transform 0.3s ease;
}

.nav .nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--teal-primary);
    transition: width 0.3s ease;
}

.nav .nav-link:hover,
.nav .nav-link.active {
    color: var(--teal-primary);
}

.nav .nav-link:hover::after,
.nav .nav-link.active::after {
    width: 100%;
}

.nav-dropdown {
    position: relative;
}

.nav-dropdown:hover .nav-link i {
    transform: rotate(180deg);
}

.nav-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    padding: 12px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1000;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.dropdown-menu a {
    display: block;
    padding: 10px 24px;
    color: var(--text-dark);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.dropdown-menu a:hover {
    background: #f8fafc;
    color: var(--teal-primary);
    padding-left: 28px;
}

/* ========== PRODUCT CARD (GLOBAL) ========== */
.product-card {
    background: white;
    border-radius: 16px;
    /* standard var(--radius) essentially */
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.06);
    position: relative;
}

.product-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 30px rgba(30, 135, 137, 0.15);
    /* var(--shadow-hover) */
}

.product-image-container {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1;
    background: #f8f9fa;
    border-radius: 14px;
}

.product-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-card:hover .product-image-container img {
    transform: scale(1.1);
}

.add-to-cart-overlay {
    position: absolute;
    /* Expand beyond edges to fix browser backdrop-filter edge blurring bug */
    top: -15px;
    left: -15px;
    right: -15px;
    bottom: -15px;
    width: auto;
    height: auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: all 0.4s ease;
    z-index: 3;
    pointer-events: none;
    /* Let clicks pass through the overlay itself */
}

.product-card:hover .add-to-cart-overlay {
    opacity: 1;
}

.add-to-cart-overlay .btn-add-mini,
.add-to-cart-overlay .product-wishlist {
    pointer-events: auto;
    /* Re-enable clicks just for the buttons */
}

.btn-add-mini {
    padding: 14px 28px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    color: #0f172a !important;
    /* Force dark text so it doesn't blend in */
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transform: translateY(20px);
}

.product-card:hover .btn-add-mini {
    transform: translateY(0);
}

.btn-add-mini:hover {
    background: #ef4444 !important;
    /* Red as requested */
    color: #ffffff !important;
    border-color: #ef4444 !important;
    transform: scale(1.05);
}

.product-wishlist {
    width: 44px;
    height: 44px;
    background: #ffffff;
    /* Solid white so it never washes out */
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #94a3b8;
    z-index: 20;
    /* High z-index */
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transform: translateY(20px);
}

.product-card:hover .product-wishlist {
    transform: translateY(0);
}

.product-wishlist:hover,
.product-wishlist.active {
    color: #ef4444;
    background: white;
    transform: scale(1.1);
}

.product-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    padding: 2px 10px !important;
    /* Slightly smaller for more premium feel */
    border-radius: 6px !important;
    /* Less rounded, more modern */
    font-size: 11px !important;
    font-weight: 800 !important;
    z-index: 10 !important;
    height: 22px !important;
    min-height: 22px !important;
    max-height: 22px !important;
    width: max-content !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-transform: uppercase !important;
    bottom: auto !important;
    /* CRITICAL: Prevent stretching from top-bottom conflicts */
}

.product-badge.sale {
    background: #b91c1c !important;
    color: white !important;
}

.product-badge.new {
    background: var(--teal-primary) !important;
    color: white !important;
}

.product-badge.oos-badge {
    background: #1e293b !important;
    /* Darker slate for premium Feel */
    color: #ffffff !important;
    letter-spacing: 0.5px !important;
}

/* Out of Stock Premium Design */
.product-card.out-of-stock {
    opacity: 1;
}

.product-card.out-of-stock .product-image-container img {
    filter: grayscale(100%);
    opacity: 0.6;
    transition: all 0.5s ease;
}

.product-card.out-of-stock:hover .product-image-container img {
    filter: grayscale(80%);
    opacity: 0.8;
}

.product-card.out-of-stock .add-to-cart-overlay {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    display: none !important;
    /* Hide overlay button area for OOS */
}

/* Redundant OOS button styles removed as handled via badges */


.product-info {
    padding: 20px 16px;
    text-align: center;
}

.info-left {
    width: 100%;
}

.product-category {
    font-size: 11px;
    color: var(--teal-dark, #186a6b);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 8px;
}

.product-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1.3;
    letter-spacing: -0.2px;
}

.original-price {
    font-size: 12px;
    color: var(--text-gray);
    text-decoration: line-through;
}

/* ========== FOOTER ========== */
.footer {
    background: var(--text-dark);
    color: white;
    padding: 60px 20px;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 48px;
}

.footer-brand .logo {
    color: white;
    display: block;
    margin-bottom: 16px;
    font-size: 24px;
    font-weight: bold;
    text-decoration: none;
}

.footer-brand p {
    color: #94A3B8;
    font-size: 14px;
    line-height: 1.7;
    margin-bottom: 24px;
}

.footer-social {
    display: flex;
    gap: 12px;
}

.footer-social a {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.3s;
    text-decoration: none;
}

.footer-social a:hover {
    background: var(--teal-primary);
}

.footer-column h4,
.footer-column h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    color: white;
}

.footer-column ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-column ul li {
    margin-bottom: 12px;
}

.footer-column ul a {
    color: #B8C3D1;
    font-size: 14px;
    transition: color 0.3s;
    text-decoration: none;
}

.footer-column ul a:hover {
    color: var(--teal-primary);
}

.footer-bottom {
    max-width: 1400px;
    margin: 40px auto 0;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #B8C3D1;
    font-size: 14px;
    gap: 20px;
}

@media (max-width: 900px) {
    .footer-container {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 600px) {
    .footer-container {
        grid-template-columns: 1fr;
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }
}
