/* Estilos propios que complementan a Tailwind. */
:root {
    --fy-green: #69E86B;
    --fy-blue: #35BEF2;
    --fy-blue-deep: #139FD4;
    --fy-blue-soft: #E8F8FE;
    --fy-green-soft: #EAFDEA;
    --fy-ink: #0F172A;
    --fy-muted: #64748B;
    --fy-canvas: #F6F8FB;
    --fy-surface: #FFFFFF;
    --fy-border: #DDE3EA;
    --fy-success: #18A957;
    --fy-warning: #D97706;
    --fy-danger: #DC3545;
    --fy-radius-sm: 6px;
    --fy-radius: 8px;
    --fy-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --fy-shadow-md: 0 10px 28px rgba(15, 23, 42, 0.09);
}

html {
    font-family: "Sora", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
    color: var(--fy-ink);
    background: var(--fy-canvas);
    line-height: 1.5;
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

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

thead {
    background: #F8FAFC;
    color: #475569;
}

tbody tr {
    border-top: 1px solid #EEF2F7;
}

dialog,
[role="dialog"] {
    color: var(--fy-ink);
}

fieldset {
    min-width: 0;
}

/* Componentes compartidos: una sola escala visual para las superficies. */
.rounded-2xl,
.rounded-3xl { border-radius: var(--fy-radius) !important; }

.shadow-2xl { box-shadow: var(--fy-shadow-md) !important; }

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
    min-height: 42px;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
    outline: 3px solid rgba(53, 190, 242, 0.25);
    outline-offset: 2px;
}

.saved-address-option:has(input:checked),
.delivery-timing-option:has(input:checked) {
    border-color: var(--fy-blue) !important;
    background: var(--fy-blue-soft) !important;
    box-shadow: inset 0 0 0 1px rgba(53, 190, 242, 0.2);
}

.fy-nav-inner { min-height: 56px; }
.fy-mobile-nav-actions {
    display: none;
    align-items: center;
    gap: 8px;
}
.fy-mobile-cart-link {
    position: relative;
    display: inline-flex;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--fy-border);
    border-radius: var(--fy-radius);
    color: var(--fy-blue-deep);
    background: #fff;
}
.fy-mobile-cart-link span {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border: 2px solid #fff;
    border-radius: 999px;
    color: #fff;
    background: var(--fy-blue-deep);
    font-size: 10px;
    font-weight: 700;
    line-height: 14px;
    text-align: center;
}
.fy-mobile-nav-toggle {
    display: none;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--fy-border);
    border-radius: var(--fy-radius);
    color: #475569;
    background: #fff;
}
.fy-mobile-nav-panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    padding: 8px 16px 14px;
    background: #fff;
    border-top: 1px solid #eef2f7;
    border-bottom: 1px solid var(--fy-border);
    box-shadow: var(--fy-shadow-md);
}
.fy-mobile-nav-panel a {
    display: block;
    padding: 10px 4px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    font-size: 14px;
}
.fy-home-hero { height: clamp(300px, 36vw, 390px); }

#cart-main-wrapper { transition: none; }
#cart-sidebar { max-width: 100%; }

.fy-global-search:focus-within {
    border-color: var(--fy-blue);
    box-shadow: 0 0 0 3px rgba(53, 190, 242, 0.14);
}

.catalog-product-card { border-radius: var(--fy-radius); }

.catalog-filter-drawer { display: block; }

/* Los paneles operativos conservan navegación útil en pantallas angostas. */
@media (max-width: 1023px) {
    main nav > a {
        min-width: max-content;
    }
}

@media (max-width: 767px) {
    .catalog-filter-drawer {
        position: fixed;
        z-index: 70;
        top: 0;
        bottom: 0;
        left: 0;
        display: block;
        overflow-y: auto;
        padding: 16px 12px;
        background: var(--fy-canvas);
        transform: translateX(-105%);
        transition: transform 220ms ease;
        box-shadow: var(--fy-shadow-md);
    }
    .catalog-filter-drawer.is-open { transform: translateX(0); }
    .catalog-filter-drawer form { position: static !important; }
}

@media (max-width: 639px) {
    .fy-desktop-nav { display: none !important; }
    .fy-mobile-nav-actions { display: inline-flex; }
    .fy-mobile-nav-toggle { display: inline-flex; }
    .brand-logo-img { width: 124px; }
    .fy-home-hero { height: 300px; }
    .fy-hero-title { font-size: 1.85rem !important; line-height: 1.12 !important; }
    .fy-hero-copy { font-size: 0.95rem !important; line-height: 1.55 !important; margin-bottom: 1.25rem !important; }
    #global-search-bar { top: 57px; }
    .fy-global-search { min-height: 44px; }
    .fy-search-submit { width: 36px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
    .catalog-grid { gap: 10px; }
    .catalog-product-card {
        min-height: 0 !important;
        display: grid !important;
        grid-template-columns: minmax(112px, 34%) 1fr;
        grid-template-rows: auto;
    }
    .catalog-product-card > div:first-child {
        aspect-ratio: auto !important;
        min-height: 190px;
        height: 100%;
        border-right: 1px solid #eef2f7;
        border-bottom: 0 !important;
    }
    .catalog-product-card > div:last-child { min-width: 0; padding: 14px !important; }
    .fy-product-gallery {
        aspect-ratio: 4 / 3 !important;
        max-height: 250px;
    }

    [role="dialog"] > div,
    dialog > div {
        max-width: calc(100vw - 24px);
    }

    table {
        font-size: 0.8125rem;
    }
}

.brand-logo-link {
    display: inline-flex;
    align-items: center;
    min-width: 0;
}

.brand-logo-img {
    display: block;
    width: 142px;
    height: auto;
}

@media (max-width: 420px) {
    .brand-logo-img {
        width: 116px;
    }
}

.brand-hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--fy-blue) 0%, #32B9EA 68%, #60DFA0 100%);
}

.brand-hero > * {
    position: relative;
    z-index: 1;
}

.brand-hero-logo {
    height: 58px;
    width: auto;
}

.brand-gradient-card {
    background:
        linear-gradient(135deg, rgba(53, 190, 242, 0.98), rgba(19, 159, 212, 0.98));
}

/* Recolorea el sistema azul existente a la identidad FarmaYa sin reescribir cada template. */
.text-blue-400,
.text-blue-500,
.text-blue-600,
.text-blue-700,
.text-blue-800 {
    color: var(--fy-blue-deep) !important;
}

.bg-blue-50 {
    background-color: var(--fy-blue-soft) !important;
}

.bg-blue-100 {
    background-color: #D8F5FD !important;
}

.bg-blue-600,
.bg-blue-700,
.bg-blue-800 {
    background-color: var(--fy-blue) !important;
}

.hover\:bg-blue-50:hover {
    background-color: var(--fy-blue-soft) !important;
}

.hover\:bg-blue-100:hover {
    background-color: #D8F5FD !important;
}

.hover\:bg-blue-600:hover,
.hover\:bg-blue-700:hover,
.hover\:bg-blue-800:hover {
    background-color: var(--fy-blue-deep) !important;
}

.border-blue-100,
.border-blue-200,
.border-blue-300,
.border-blue-400,
.border-blue-500 {
    border-color: rgba(53, 190, 242, 0.42) !important;
}

.focus\:ring-blue-500:focus,
.focus\:ring-blue-600:focus {
    --tw-ring-color: rgba(53, 190, 242, 0.45) !important;
}

.from-blue-600,
.from-blue-700,
.from-blue-800 {
    --tw-gradient-from: var(--fy-blue) var(--tw-gradient-from-position) !important;
    --tw-gradient-to: rgba(53, 190, 242, 0) var(--tw-gradient-to-position) !important;
    --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important;
}

.to-blue-600,
.to-blue-700,
.to-blue-800 {
    --tw-gradient-to: var(--fy-blue-deep) var(--tw-gradient-to-position) !important;
}

.via-blue-600,
.via-blue-700 {
    --tw-gradient-to: rgba(53, 190, 242, 0) var(--tw-gradient-to-position) !important;
    --tw-gradient-stops: var(--tw-gradient-from), var(--fy-blue), var(--tw-gradient-to) !important;
}

.text-green-600,
.text-green-700,
.text-green-800 {
    color: #24B84F !important;
}

.bg-green-50,
.bg-green-100 {
    background-color: var(--fy-green-soft) !important;
}

.bg-green-600,
.bg-green-700 {
    background-color: var(--fy-green) !important;
}

.border-green-100,
.border-green-200,
.border-green-300 {
    border-color: rgba(105, 232, 107, 0.50) !important;
}
