/* =====================================================================
   FamaÓptica · Cart drawer + cart icon + toast
   Plain CSS, no framework dependency. Works on Tailwind and non-Tailwind pages.
   ===================================================================== */

:root {
    --fo-ink: #0a0a0a;
    --fo-ink-soft: #1a1a1a;
    --fo-mute: #6b6566;
    --fo-mute-2: #9a9294;
    --fo-line: #e8e2e3;
    --fo-line-soft: #f2ecec;
    --fo-paper: #ffffff;
    --fo-bg-tint: #faf8f8;
    --fo-accent: #0a0a0a;
}

/* ---------- Navbar icon buttons (cart + profile) ---------- */
.fo-nav-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0;
    color: var(--fo-ink);
    cursor: pointer;
    border-radius: 50%;
    transition: background-color .15s ease, transform .15s ease;
    font-family: inherit;
}
.fo-nav-btn:hover {
    background: rgba(10, 10, 10, 0.06);
    transform: translateY(-1px);
}
.fo-nav-btn .material-symbols-outlined {
    font-size: 24px;
    line-height: 1;
}
/* Backwards-compat for the original cart class name */
.fo-cart-btn { /* kept for any existing markup */
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0;
    color: var(--fo-ink);
    cursor: pointer;
    border-radius: 50%;
    transition: background-color .15s ease, transform .15s ease;
    font-family: inherit;
}
.fo-cart-btn:hover { background: rgba(10, 10, 10, 0.06); transform: translateY(-1px); }
.fo-cart-btn .material-symbols-outlined { font-size: 24px; line-height: 1; }
.fo-cart-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--fo-ink);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    border-radius: 100px;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0;
    pointer-events: none;
    box-shadow: 0 0 0 2px #fff;
}

/* ---------- Backdrop ----------
   z-index needs to be above the floating "Siga-nos" block (z:999)
   that some pages have at bottom-right. */
.fo-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 10, 0.42);
    opacity: 0;
    visibility: hidden;
    z-index: 1099;
    transition: opacity .12s linear, visibility .12s;
}
.fo-drawer-backdrop.open {
    opacity: 1;
    visibility: visible;
}

/* ---------- Drawer ---------- */
.fo-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 90%;
    max-width: 420px;
    background: var(--fo-paper);
    z-index: 1100;
    transform: translateX(100%);
    transition: transform .14s cubic-bezier(0.2, 0, 0.2, 1);
    will-change: transform;
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 40px -10px rgba(0, 0, 0, 0.18);
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
    color: var(--fo-ink);
}
@supports (padding: env(safe-area-inset-top)) {
    .fo-drawer {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}
.fo-drawer.open {
    transform: translateX(0);
}

.fo-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 22px;
    border-bottom: 1px solid var(--fo-line);
    flex-shrink: 0;
}
.fo-drawer-title {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--fo-ink);
    margin: 0;
}
.fo-drawer-close {
    background: transparent;
    border: 0;
    padding: 6px;
    cursor: pointer;
    border-radius: 50%;
    color: var(--fo-ink);
    display: inline-flex;
    align-items: center;
    transition: background-color .2s ease;
}
.fo-drawer-close:hover {
    background: rgba(10, 10, 10, 0.06);
}
.fo-drawer-close .material-symbols-outlined {
    font-size: 22px;
    line-height: 1;
}

.fo-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 22px;
    -webkit-overflow-scrolling: touch;
}

.fo-cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 24px;
    color: var(--fo-mute);
}
.fo-cart-empty .material-symbols-outlined {
    font-size: 48px;
    color: var(--fo-mute-2);
    margin-bottom: 14px;
}
.fo-cart-empty p {
    font-size: 14px;
    margin: 0 0 18px;
    color: var(--fo-ink);
}
.fo-cart-empty a {
    color: var(--fo-ink);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-decoration: none;
    border-bottom: 1px solid var(--fo-ink);
    padding-bottom: 2px;
}

.fo-cart-item {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 14px;
    padding: 16px 0;
    border-bottom: 1px solid var(--fo-line-soft);
}
.fo-cart-item:last-child {
    border-bottom: 0;
}
.fo-cart-item-img {
    width: 80px;
    height: 80px;
    border-radius: 4px;
    background: var(--fo-bg-tint);
    overflow: hidden;
    flex-shrink: 0;
}
.fo-cart-item-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.fo-cart-item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.fo-cart-item-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--fo-ink);
    line-height: 1.3;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.fo-cart-item-meta {
    font-size: 12px;
    color: var(--fo-mute);
    line-height: 1.4;
}
.fo-cart-item-price {
    font-size: 14px;
    font-weight: 600;
    color: var(--fo-ink);
    margin-top: 2px;
}
.fo-cart-item-price .pvp {
    font-size: 11px;
    text-decoration: line-through;
    color: var(--fo-mute-2);
    font-weight: 400;
    margin-left: 6px;
}
.fo-cart-item-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}
.fo-qty {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--fo-line);
    border-radius: 100px;
    overflow: hidden;
    height: 28px;
}
.fo-qty button {
    width: 28px;
    height: 28px;
    border: 0;
    background: transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--fo-ink);
    font-family: inherit;
    transition: background-color .15s ease;
}
.fo-qty button:hover {
    background: rgba(10, 10, 10, 0.05);
}
.fo-qty button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.fo-qty .material-symbols-outlined {
    font-size: 16px;
    line-height: 1;
}
.fo-qty-value {
    min-width: 26px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
}
.fo-cart-remove {
    background: transparent;
    border: 0;
    cursor: pointer;
    padding: 6px;
    color: var(--fo-mute);
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    transition: color .2s ease, background-color .2s ease;
    font-family: inherit;
}
.fo-cart-remove:hover {
    color: var(--fo-ink);
    background: rgba(10, 10, 10, 0.05);
}
.fo-cart-remove .material-symbols-outlined {
    font-size: 18px;
}

/* ---------- Drawer footer (totals + CTA) ---------- */
.fo-drawer-footer {
    border-top: 1px solid var(--fo-line);
    padding: 18px 22px 22px;
    flex-shrink: 0;
    background: var(--fo-paper);
}
.fo-totals {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--fo-ink);
    margin-bottom: 14px;
}
.fo-totals-row {
    display: flex;
    justify-content: space-between;
}
.fo-totals-row.muted {
    color: var(--fo-mute);
    font-size: 12px;
}
.fo-totals-row.discount {
    color: #1a7a3a;
    font-weight: 600;
}
.fo-totals-row.total {
    border-top: 1px solid var(--fo-line-soft);
    padding-top: 10px;
    margin-top: 4px;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.01em;
}
.fo-totals-row.total .value {
    font-size: 18px;
}

.fo-checkout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 16px 20px;
    background: var(--fo-ink);
    color: #fff;
    border: 0;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 2px;
    transition: transform .2s ease, background-color .2s ease;
    text-decoration: none;
    text-align: center;
}
.fo-checkout-btn:hover {
    transform: translateY(-1px);
    background: #2a2424;
}
.fo-checkout-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}
.fo-checkout-btn .material-symbols-outlined {
    font-size: 18px;
}

.fo-promo-hint {
    margin-top: 14px;
    padding: 12px 14px;
    background: var(--fo-bg-tint);
    border-radius: 4px;
    font-size: 12px;
    color: var(--fo-mute);
    line-height: 1.5;
}
.fo-promo-hint strong {
    color: var(--fo-ink);
    font-weight: 600;
}

/* ---------- Toast ---------- */
.fo-toast-wrap {
    position: fixed;
    z-index: 1110;
    top: 20px;
    right: 20px;
    left: 20px;
    max-width: 380px;
    margin-left: auto;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
@supports (padding: env(safe-area-inset-top)) {
    .fo-toast-wrap {
        top: calc(20px + env(safe-area-inset-top));
    }
}
.fo-toast {
    background: var(--fo-ink);
    color: #fff;
    padding: 14px 18px;
    border-radius: 6px;
    box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.35);
    font-size: 13px;
    line-height: 1.4;
    font-weight: 500;
    letter-spacing: 0.01em;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(-12px);
    transition: opacity .25s ease, transform .25s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Inter', sans-serif;
}
.fo-toast.show {
    opacity: 1;
    transform: translateY(0);
}
.fo-toast.error {
    background: #b03030;
}
.fo-toast .material-symbols-outlined {
    font-size: 20px;
    flex-shrink: 0;
}

/* ---------- Modal (demo payments) ---------- */
.fo-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 10, 0.55);
    z-index: 1200;
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.fo-modal-backdrop.open {
    opacity: 1;
    visibility: visible;
}
.fo-modal {
    background: #fff;
    border-radius: 8px;
    max-width: 420px;
    width: 100%;
    padding: 36px 28px 28px;
    text-align: center;
    box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.4);
    transform: scale(0.95);
    transition: transform .25s ease;
    font-family: 'Inter', sans-serif;
}
.fo-modal-backdrop.open .fo-modal {
    transform: scale(1);
}
.fo-modal-icon {
    font-size: 48px !important;
    color: var(--fo-ink);
    display: block;
    margin: 0 auto 14px;
}
.fo-modal h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px;
    letter-spacing: -0.01em;
    color: var(--fo-ink);
}
.fo-modal p {
    font-size: 14px;
    color: var(--fo-mute);
    line-height: 1.55;
    margin: 0 0 20px;
}
.fo-modal-btn {
    background: var(--fo-ink);
    color: #fff;
    border: 0;
    padding: 12px 26px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    border-radius: 2px;
    cursor: pointer;
    font-family: inherit;
}

/* ---------- Mobile ---------- */
@media (max-width: 480px) {
    .fo-drawer {
        width: 100%;
        max-width: none;
    }
    .fo-toast-wrap {
        max-width: none;
    }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .fo-drawer, .fo-drawer-backdrop, .fo-toast, .fo-modal, .fo-modal-backdrop {
        transition: none !important;
    }
}
