/* ============================================
   POLISH EXTREMO - TANDA 86
   Mejoras visuales globales sin tocar pantallas
   ============================================ */

/* === Animación fade-in al cargar === */
.hub-tabs > a, .form-grid .fld, .seed-card, .cfg-card {
    animation: fadeInUp 0.4s ease-out backwards;
}
.hub-tabs > a:nth-child(1) { animation-delay: 0.05s }
.hub-tabs > a:nth-child(2) { animation-delay: 0.10s }
.hub-tabs > a:nth-child(3) { animation-delay: 0.15s }
.hub-tabs > a:nth-child(4) { animation-delay: 0.20s }
.hub-tabs > a:nth-child(5) { animation-delay: 0.25s }
.hub-tabs > a:nth-child(6) { animation-delay: 0.30s }
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === Hover con micro-zoom === */
.hub-tab, .btn, button:not(:disabled), .card, [role="button"] {
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease !important;
}
.hub-tab:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0,0,0,.12) !important;
}
.btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,.15) !important;
}
.btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,.1) !important;
}

/* === Inputs con foco visible === */
input:focus, textarea:focus, select:focus {
    outline: 0 !important;
    border-color: #ff6f1c !important;
    box-shadow: 0 0 0 3px rgba(255,111,28,.15) !important;
    transition: border-color 0.15s, box-shadow 0.15s !important;
}

/* === Loading spinner global === */
.manolito-loading {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2.5px solid #f3f4f6;
    border-top-color: #ff6f1c;
    border-radius: 50%;
    animation: manolitoSpin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}
@keyframes manolitoSpin { to { transform: rotate(360deg); } }

/* === Toast container global === */
#manolito-toasts {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
    pointer-events: none;
}
.manolito-toast {
    background: #1f2937;
    color: white;
    padding: 14px 20px;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.25);
    font-weight: 500;
    font-size: 14px;
    max-width: 360px;
    pointer-events: auto;
    animation: toastIn 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 10px;
}
.manolito-toast.ok { background: #059669; }
.manolito-toast.warn { background: #d97706; }
.manolito-toast.err { background: #dc2626; }
.manolito-toast.fading { animation: toastOut 0.3s ease-in forwards; }
@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
    to { opacity: 0; transform: translateX(40px); }
}

/* === Empty state amigable === */
.manolito-empty {
    text-align: center;
    padding: 48px 24px;
    color: #6b7280;
}
.manolito-empty-icon {
    font-size: 56px;
    opacity: .35;
    margin-bottom: 12px;
    display: block;
}
.manolito-empty-title {
    font-size: 18px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}
.manolito-empty-cta {
    margin-top: 16px;
    display: inline-block;
}

/* === Skeleton loader (para listas mientras cargan) === */
.skeleton {
    background: linear-gradient(90deg, #f3f4f6 0%, #e5e7eb 50%, #f3f4f6 100%);
    background-size: 200% 100%;
    animation: skeletonPulse 1.5s ease-in-out infinite;
    border-radius: 6px;
    color: transparent !important;
}
@keyframes skeletonPulse {
    0% { background-position: 200% 0 }
    100% { background-position: -200% 0 }
}

/* === Tooltips === */
[data-tip] { position: relative; cursor: help; }
[data-tip]:hover::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 100;
    pointer-events: none;
    animation: tipFade 0.2s ease-out;
    max-width: 240px;
    white-space: normal;
    text-align: center;
    width: max-content;
    max-width: 240px;
}
@keyframes tipFade {
    from { opacity: 0; transform: translateX(-50%) translateY(4px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* === Atajos de teclado visibles === */
.kbd {
    display: inline-block;
    padding: 2px 6px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-bottom-width: 2px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 11px;
    color: #374151;
    margin: 0 2px;
}

/* === Mejor scroll en mobile === */
@media (max-width: 768px) {
    html, body { overscroll-behavior: contain; }
    .hub-tabs { gap: 8px !important; padding: 8px !important; }
    .hub-tab { min-height: 90px; padding: 12px !important; }
    .ht-tit { font-size: 13px !important; }
    .btn { min-height: 44px; padding: 12px 18px !important; } /* touch target Apple/Google */
    input, select, textarea { font-size: 16px !important; } /* evita zoom en iOS */
    .manolito-toast { left: 16px; right: 16px; bottom: 16px; max-width: none; }
    #manolito-toasts { left: 0; right: 0; align-items: stretch; }
    table { font-size: 13px; }
    .form-grid { grid-template-columns: 1fr !important; }
}

/* === Pulse de notificación === */
.pulse-dot {
    position: relative;
}
.pulse-dot::before {
    content: '';
    position: absolute;
    top: -4px; right: -4px;
    width: 10px; height: 10px;
    background: #dc2626;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(220,38,38,.6);
    animation: pulseRed 1.5s infinite;
}
@keyframes pulseRed {
    0% { box-shadow: 0 0 0 0 rgba(220,38,38,.6); }
    70% { box-shadow: 0 0 0 10px rgba(220,38,38,0); }
    100% { box-shadow: 0 0 0 0 rgba(220,38,38,0); }
}

/* === Modo oscuro automático según sistema (opcional) === */
@media (prefers-color-scheme: dark) {
    /* Por ahora solo mejora foco para pantallas oscuras */
    body[data-theme="auto"] { color-scheme: light dark; }
}

/* === Mejor focus visible (accesibilidad) === */
*:focus-visible {
    outline: 3px solid #ff6f1c !important;
    outline-offset: 2px !important;
    border-radius: 4px;
}
button:focus-visible, a:focus-visible { outline-offset: 4px !important; }

/* === Print friendly === */
@media print {
    .hub-tabs, button, .btn, header, footer, nav, .no-print { display: none !important; }
    body { background: white; }
}

/* === Smooth transitions entre tabs === */
.tab-content {
    animation: tabFade 0.25s ease-out;
}
@keyframes tabFade {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === Tablas con hover === */
table tbody tr {
    transition: background-color 0.15s;
}
table tbody tr:hover {
    background-color: #fff7ed;
}

/* === Cards más vivos === */
.hub-tab, .seed-card, .cfg-card, .suc-row {
    transition: all 0.2s !important;
}

/* === Buttons disabled más claros === */
button:disabled, .btn:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

/* === Scrollbar custom (más sutil) === */
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: #f3f4f6; }
*::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }
*::-webkit-scrollbar-thumb:hover { background: #9ca3af; }
