/* Estilos visuales extraídos de index.html */
html, body {
    width: 100%; height: 100dvh; margin: 0; padding: 0; overflow: hidden; overscroll-behavior-y: none;
}
body { position: relative; background-color: #f5f0e8; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
@media (prefers-color-scheme: dark) { body { background-color: #0d0718; } }

/* FIX DE COMPATIBILIDAD DE CSS */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
    -webkit-appearance: none; 
    appearance: none; 
    margin: 0; 
}
input[type=number], input[type=text], input[type=tel], input[type=email], input[type=password], input[type=date] { 
    -moz-appearance: textfield; 
    appearance: textfield; 
}

#prezi-canvas { position: absolute; inset: 0; perspective: 1500px; z-index: 2; }

/* FIX DE SCROLL PARA MÓVILES */
.view {
    position: absolute; inset: 0; display: block;
    overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; 
    transition: transform 0.55s cubic-bezier(0.25, 1, 0.3, 1), opacity 0.38s ease; opacity: 0; pointer-events: none;
    backface-visibility: hidden; transform: translateZ(0);
}
.view-wrapper {
    width: 100%; min-height: 100%; display: flex; flex-direction: column; align-items: center; padding: 80px 24px 160px;
}
.view.active { opacity: 1; transform: translate3d(0, 0, 0) scale(1); pointer-events: auto; z-index: 10; will-change: transform, opacity; }
.view.next { opacity: 0; transform: translate3d(36%, 0, -120px) rotateY(-7deg) scale(0.96); z-index: 5; }
.view.prev { opacity: 0; transform: translate3d(-28%, 0, 120px) rotateY(7deg) scale(1.04); z-index: 15; }
.view::-webkit-scrollbar { width: 4px; }
.view::-webkit-scrollbar-track { background: transparent; }
.view::-webkit-scrollbar-thumb { background: rgba(185, 203, 37, 0.5); border-radius: 99px; }

/* Scroll customizado para forms internos */
.custom-scroll::-webkit-scrollbar { width: 4px; }
.custom-scroll::-webkit-scrollbar-track { background: transparent; }
.custom-scroll::-webkit-scrollbar-thumb { background: rgba(66, 29, 142, 0.2); border-radius: 99px; }

.btn-opt {
    padding: 12px 16px; border-radius: 14px; border: 2px solid #e8e0f0; cursor: pointer;
    font-family: 'Montserrat', sans-serif; font-size: 12px; font-weight: 700; opacity: 0.6; transition: all 0.2s ease; transform: translateZ(0);
}
.btn-opt.active { background-color: #421d8e !important; border-color: #421d8e !important; color: #ffffff !important; opacity: 1 !important; box-shadow: 0 4px 12px rgba(66,29,142,0.3) !important; }
@media (prefers-color-scheme: dark) {
    .btn-opt.active { background-color: #b9cb25 !important; border-color: #b9cb25 !important; color: #2e1060 !important; box-shadow: 0 4px 12px rgba(185,203,37,0.2) !important; }
}


.weight-size-btn {
    transition: all 0.2s ease;
    box-shadow: none;
}
.weight-size-btn.weight-active {
    opacity: 1 !important;
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(66, 29, 142, 0.18);
}
.nutrition-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    border-radius: 16px;
}
.nutrition-table th,
.nutrition-table td {
    padding: 10px 12px;
    vertical-align: top;
}
.nutrition-table th {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}
.nutrition-table td {
    font-size: 10px;
    line-height: 1.45;
    font-weight: 600;
}
@media (max-width: 480px) {
    .nutrition-table th,
    .nutrition-table td { padding: 8px 9px; }
    .nutrition-table td { font-size: 9px; }
}

.result {
    display: none; opacity: 0; margin-top: 0; width: 100%;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}
.result.show { display: block; }
.result.visible { opacity: 1; transform: translateY(0); margin-top: 20px; pointer-events: auto; }

.error-msg {
    background: #fff0f5; border-left: 3px solid #d72b8f; border-radius: 0 10px 10px 0;
    font-size: 11px; font-weight: 700; color: #d72b8f; max-height: 0; overflow: hidden; opacity: 0;
    transition: max-height 0.25s ease, opacity 0.2s ease, padding 0.25s ease; width: 100%;
}
.error-msg.visible { max-height: 80px; opacity: 1; padding: 10px 14px; margin-top: 10px; }

@keyframes fabPop { 0% { transform: scale(1) translateZ(0); } 40% { transform: scale(1.25) translateZ(0); } 70% { transform: scale(0.92) translateZ(0); } 100% { transform: scale(1) translateZ(0); } }
#cart-fab.pop { animation: fabPop 0.45s cubic-bezier(0.34,1.56,0.64,1); }
#cart-badge { transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1); }
#cart-fab.pop #cart-badge { transform: scale(1.3) translateZ(0); }

.milkarf-input-focus:focus {
    border-color: #421d8e !important;
    box-shadow: 0 0 0 4px rgba(66, 29, 142, 0.08);
}

#delivery-note-capture-wrap {
    position: fixed;
    left: -99999px;
    top: 0;
    width: 1080px;
    background: #f5f0e8;
    z-index: -1;
    pointer-events: none;
}

.delivery-capture-card {
    width: 800px;
    background: #f5f0e8;
    font-family: 'Montserrat', sans-serif;
    color: #421d8e;
    padding: 40px;
    box-sizing: border-box;
}
.delivery-capture-inner {
    background: #ffffff;
    border-radius: 32px;
    overflow: hidden;
    box-shadow: 0 16px 40px rgba(66,29,142,0.12);
    border: 1px solid rgba(66,29,142,0.10);
}
.delivery-capture-head {
    background: linear-gradient(135deg,#2e1060,#421d8e);
    padding: 30px 40px;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}
.delivery-capture-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    background: rgba(255,255,255,0.12);
    border-radius: 20px;
    padding: 8px;
}
.delivery-capture-kicker {
    font-size: 14px;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: #b9cb25;
    font-weight: 900;
    margin-bottom: 6px;
}
.delivery-capture-title {
    font-size: 32px;
    line-height: 1;
    font-weight: 900;
    margin: 0;
}
.delivery-capture-date {
    margin-top: 8px;
    font-size: 16px;
    color: rgba(255,255,255,0.72);
    font-weight: 700;
}
.delivery-capture-body { padding: 30px 40px; }
.delivery-capture-section {
    background: #faf8ff;
    border: 1px solid #e8e0f0;
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 16px;
}
.delivery-capture-label {
    font-size: 12px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(66,29,142,0.48);
    font-weight: 900;
    margin-bottom: 6px;
}
.delivery-capture-client { font-size: 20px; font-weight: 900; color: #2e1060; margin: 0; }
.delivery-capture-pet { font-size: 14px; font-weight: 700; color: rgba(66,29,142,0.62); margin-top: 4px; }
.delivery-capture-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: start;
    border-bottom: 1px solid rgba(66,29,142,0.10);
    padding: 12px 0;
}
.delivery-capture-item:last-child { border-bottom: 0; }
.delivery-capture-item-name { font-size: 16px; font-weight: 900; color: #2e1060; }
.delivery-capture-item-sub { font-size: 12px; font-weight: 700; color: rgba(66,29,142,0.58); margin-top: 4px; }
.delivery-capture-item-price { font-size: 16px; font-weight: 900; color: #421d8e; white-space: nowrap; }
.delivery-capture-totals {
    background: linear-gradient(135deg,#2e1060,#421d8e);
    border-radius: 20px;
    padding: 24px;
    color: #ffffff;
    margin-bottom: 20px;
}
.delivery-capture-total-row { display:flex; justify-content:space-between; align-items:center; font-size: 16px; font-weight: 800; padding: 6px 0; color: rgba(255,255,255,0.80); }
.delivery-capture-final { border-top: 1px solid rgba(255,255,255,0.22); margin-top: 8px; padding-top: 16px; }
.delivery-capture-final span:first-child { font-size: 14px; letter-spacing: 0.18em; text-transform: uppercase; color: #b9cb25; font-weight: 900; }
.delivery-capture-final span:last-child { font-size: 28px; color: #b9cb25; font-weight: 900; }
.delivery-capture-payment {
    background: #fff0f5;
    border-left: 6px solid #d72b8f;
    border-radius: 0 16px 16px 0;
    padding: 20px 24px;
    color: #421d8e;
    font-size: 14px;
    line-height: 1.5;
    font-weight: 700;
}
.delivery-capture-payment strong { font-weight: 900; color: #2e1060; }
.delivery-capture-footer {
    text-align: center;
    padding: 20px 40px 30px;
    color: rgba(66,29,142,0.48);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.5;
}

/* UX refinada: navegación móvil más inmediata */
#mobile-bottom-nav { transition: transform 0.22s ease, opacity 0.22s ease; will-change: transform, opacity; }
#mobile-bottom-nav.mobile-nav-hidden { transform: translateY(calc(100% + 18px)); opacity: 0; pointer-events: none; }
#mobile-bottom-nav button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; transition: transform 0.08s ease, background-color 0.12s ease; }
#mobile-bottom-nav button:active { transform: scale(0.94); }
#mobile-bottom-nav button.active-mobile-nav { background: rgba(66, 29, 142, 0.10); color: #421d8e; }
@media (prefers-color-scheme: dark) { #mobile-bottom-nav button.active-mobile-nav { background: rgba(185, 203, 37, 0.12); color: #b9cb25; } }
@media (max-width: 768px) { .view { transition: transform 0.28s cubic-bezier(0.25, 1, 0.3, 1), opacity 0.18s ease; } }

/* OPTIMIZACIÓN UX / PERFORMANCE & PREMIUM DESIGN SYSTEM */
.edu-card { transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease; }
.edu-card:hover { transform: translateY(-2px); }
.edu-table { width: 100%; border-collapse: separate; border-spacing: 0; overflow: hidden; }
.edu-table th, .edu-table td { vertical-align: top; }
.edu-mini-badge { display: inline-flex; align-items: center; gap: 6px; }

/* ==========================================================================
   NUEVO DESIGN SYSTEM MODERNO, PREMIUM & GLASSMORPHISM (MILKARF 2.0)
   ========================================================================== */
.glass-panel {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(232, 224, 240, 0.6);
}
@media (prefers-color-scheme: dark) {
    .glass-panel {
        background: rgba(24, 14, 41, 0.85);
        border: 1px solid rgba(66, 29, 142, 0.35);
    }
}

.premium-card {
    transition: all 0.35s cubic-bezier(0.25, 1, 0.3, 1);
}
@media (hover: hover) and (pointer: fine) {
    .premium-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 20px 40px -15px rgba(66, 29, 142, 0.18);
    }
}
@media (prefers-color-scheme: dark) and (hover: hover) and (pointer: fine) {
    .premium-card:hover {
        box-shadow: 0 20px 40px -15px rgba(185, 203, 37, 0.12);
    }
}

/* Sombra resplandeciente moderna (Glow Effect) */
.shadow-glow-purple {
    box-shadow: 0 10px 30px -5px rgba(66, 29, 142, 0.4);
}
.shadow-glow-green {
    box-shadow: 0 10px 30px -5px rgba(185, 203, 37, 0.4);
}
.shadow-glow-pink {
    box-shadow: 0 10px 30px -5px rgba(215, 43, 143, 0.4);
}

/* Mejor ergonomía táctil móvil (>44px de target) */
.touch-target-safe {
    min-height: 44px;
    min-width: 44px;
}

/* ==========================================================================
   SISTEMA GLOBAL ANTI-DESBORDAMIENTO DE TEXTOS (cero errores visuales)
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
}
p, h1, h2, h3, h4, h5, h6, span, div, a, label, li, td, th, button, input, select, textarea {
    max-width: 100%;
}
td, th {
    word-break: break-word;
    overflow-wrap: anywhere;
}
.admin-panel, .premium-card, .nav-card, .glass-panel, [id$="-box"], [id$="-modal"], .bg-white, .dark\:bg-darkcard {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.break-all, [id$="-email"], [id$="-uid"], [id$="-name"], [id*="correo"], [id*="user-name"] {
    overflow-wrap: anywhere;
    word-break: break-word;
}
input, select, textarea {
    max-width: 100%;
    text-overflow: ellipsis;
}

@media (max-width: 768px) {
    .view { transition: transform 0.38s cubic-bezier(0.25, 1, 0.3, 1), opacity 0.25s ease; }
    .view.next { transform: translate3d(18%, 0, -40px) scale(0.98); }
    .view.prev { transform: translate3d(-14%, 0, 40px) scale(1.01); }
    .edu-card:hover, .premium-card:hover { transform: none; box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
    .view { transition: opacity 0.01ms linear !important; transform: none !important; }
    .view.next, .view.prev, .view.active { transform: none !important; }
}
