/* ============================================================
   MEPOL PUBLIC — Minimalist Material Design
   Paleta: Azul #0B5B9D | Naranja #F49221
   Tipografía: Roboto (Google Fonts)
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

/* ─── Variables ─────────────────────────────────────────── */
:root {
    --blue:        #0B5B9D;
    --blue-dark:   #084980;
    --blue-light:  #E8F1F9;
    --orange:      #F49221;
    --orange-dark: #D47B10;
    --white:       #FFFFFF;
    --bg:          #F4F6F8;
    --surface:     #FFFFFF;
    --border:      #DDE2E8;
    --text:        #1A1A2E;
    --text-muted:  #6B7280;
    --text-light:  #9CA3AF;
    --danger:      #DC2626;
    --success:     #16A34A;
    --font:        'Roboto', sans-serif;
    --radius:      6px;
    --shadow:      0 1px 4px rgba(0,0,0,0.08);
    --shadow-md:   0 4px 16px rgba(0,0,0,0.10);
}

/* ─── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    padding-bottom: 100px;
}
img { display: block; max-width: 100%; }
a   { color: inherit; text-decoration: none; }

/* ─── Main Header ────────────────────────────────────────── */
.main-header {
    background: var(--blue);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.header-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: 56px;
}
.header-brand {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.3px;
}
.header-badge {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.85);
    background: rgba(255,255,255,0.15);
    padding: 4px 10px;
    border-radius: 20px;
}

/* Barra de búsqueda */
.header-search-row {
    background: var(--bg);
    padding: 10px 16px;
}
.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0 12px;
    height: 42px;
}
.search-box svg { width: 18px; height: 18px; fill: var(--text-light); flex-shrink: 0; }
.search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--font);
    font-size: 0.9rem;
    font-style: italic;
    color: var(--text-muted);
}
.search-input::placeholder { color: var(--text-light); font-style: italic; }

/* Tabs de categorías */
.category-nav {
    display: flex;
    background: var(--blue);
    border-top: 4px solid var(--orange);
}
.nav-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 46px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.75);
    cursor: pointer;
    transition: background .2s, color .2s;
}
.nav-tab:hover { color: #fff; background: rgba(255,255,255,0.08); }
.nav-tab.active {
    background: var(--orange);
    color: #fff;
}

/* ─── Container ────────────────────────────────────────── */
.container {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    padding: 24px 20px;
}

/* ─── Landing simple header (product page compat.) ────────── */
.landing-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    margin-bottom: 16px;
}
.brand {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--blue);
}

/* ─── Product Card ───────────────────────────────────────── */
.product-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.product-image-container {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: var(--bg);
    overflow: hidden;
}
.product-image-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.product-body { padding: 24px 22px 28px; }

.product-code {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.product-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
    line-height: 1.25;
}

.product-description {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    line-height: 1.65;
}

.section-title {
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    padding-bottom: 8px;
    border-bottom: 2px solid var(--orange);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ─── Botón acción principal ─────────────────────────────── */
.btn-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background: var(--orange);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 14px 20px;
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    transition: background .2s;
}
.btn-action:hover  { background: var(--orange-dark); }
.btn-action:active { transform: scale(0.98); }

/* ─── Floating Cart Button ───────────────────────────────── */
.floating-cart-btn {
    position: fixed;
    bottom: 24px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: var(--orange);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 16px rgba(244,146,33,0.5);
    cursor: pointer;
    z-index: 100;
    border: none;
    transition: transform .2s, background .2s;
}
.floating-cart-btn:hover  { background: var(--orange-dark); transform: scale(1.05); }
.floating-cart-btn:active { transform: scale(0.95); }
.floating-cart-btn svg    { width: 24px; height: 24px; fill: #fff; }

.cart-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--blue);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--white);
}
.cart-count.bounce { animation: badgeBounce .4s ease; }

/* ─── Cart Overlay + Bottom Sheet ───────────────────────── */
.cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease;
}
.cart-overlay.active { opacity: 1; pointer-events: auto; }

.cart-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--white);
    border-top: 3px solid var(--orange);
    border-radius: 12px 12px 0 0;
    z-index: 1000;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform .35s cubic-bezier(.4,0,.2,1);
}
.cart-sheet.active { transform: translateY(0); }

.cart-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--blue);
    border-radius: 12px 12px 0 0;
}
.cart-title {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
}
.close-sheet {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    transition: color .2s;
}
.close-sheet:hover { color: #fff; }

.cart-body {
    padding: 20px 20px 28px;
    overflow-y: auto;
    flex: 1;
}

/* ─── Cart Items ─────────────────────────────────────────── */
.cart-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
}
.cart-item-img {
    width: 56px;
    height: 56px;
    border-radius: var(--radius);
    object-fit: contain;
    background: var(--white);
    flex-shrink: 0;
    border: 1px solid var(--border);
}
.cart-item-details { flex: 1; min-width: 0; }
.cart-item-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cart-item-qty-control {
    display: flex;
    align-items: center;
    gap: 10px;
}
.qty-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--text);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 600;
    transition: background .2s, border-color .2s;
}
.qty-btn:hover { background: var(--blue); border-color: var(--blue); color: #fff; }
.cart-item-qty-control span { font-size: 0.9rem; font-weight: 600; min-width: 16px; text-align: center; }

.cart-item-remove {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 4px;
    flex-shrink: 0;
    transition: color .2s;
}
.cart-item-remove:hover { color: var(--danger); }

.cart-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}
.cart-empty svg  { width: 48px; height: 48px; fill: var(--border); margin: 0 auto 12px; }
.cart-empty p    { font-size: 0.9rem; }

/* ─── Checkout Form ──────────────────────────────────────── */
.checkout-section {
    border-top: 1px solid var(--border);
    padding-top: 16px;
}
.checkout-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.checkout-form { display: flex; flex-direction: column; gap: 12px; }

.form-group  { display: flex; flex-direction: column; gap: 5px; }
.form-group label {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-muted);
}
.form-control {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    font-family: var(--font);
    font-size: 0.9375rem;
    color: var(--text);
    background: var(--white);
    box-sizing: border-box;
    transition: border-color .2s, box-shadow .2s;
    -webkit-appearance: none;
}
.form-control:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(11,91,157,.15);
}
.form-control::placeholder { color: var(--text-light); }

/* ─── Animations ─────────────────────────────────────────── */
@keyframes badgeBounce {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.4); }
    100% { transform: scale(1); }
}

/* ─── Material Catalog Homepage ──────────────────────────── */
.material-catalog { padding-bottom: 100px; }
.catalog-content  { padding: 20px 0; }

/* ─── Responsive ─────────────────────────────────────────── */
@media (min-width: 640px) {
    .container { padding: 24px; }
    .product-title { font-size: 1.75rem; }
    .cart-sheet { max-width: 480px; left: 50%; right: auto; transform: translateX(-50%) translateY(100%); border-radius: 12px 12px 0 0; }
    .cart-sheet.active { transform: translateX(-50%) translateY(0); }
}

/* ─── Combined Search-Category Dropdown ──────────────────── */
.search-wrapper {
    position: relative;
    width: 100%;
}
.search-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    z-index: 1000;
    max-height: 250px;
    overflow-y: auto;
}
.search-dropdown.active {
    display: block;
}
.dropdown-item {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text);
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border);
}
.dropdown-item:last-child {
    border-bottom: none;
}
.dropdown-item:hover {
    background: var(--bg);
}
