/* ===========================================================================
   Marduk UI — Sistema responsivo mobile-first.
   Tokens, navbar, cards, formularios, modales y utilidades.
   =========================================================================== */

:root {
    --m-primary:   #0d6efd;
    --m-secondary: #6610f2;
    --m-accent:    #0dcaf0;
    --m-success:   #198754;
    --m-warning:   #ffc107;
    --m-danger:    #dc3545;
    --m-bg:        #f6f8fb;
    --m-card:      #ffffff;
    --m-border:    #e5e7eb;
    --m-text:      #1f2937;
    --m-muted:     #6b7280;
    --m-shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
    --m-shadow-md: 0 4px 12px rgba(15, 23, 42, .08), 0 2px 4px rgba(15, 23, 42, .04);
    --m-shadow-lg: 0 12px 28px rgba(13, 110, 253, .12);
    --m-radius:    16px;
    --m-radius-sm: 12px;
    --m-grad:      linear-gradient(135deg, #0d6efd 0%, #6610f2 50%, #0dcaf0 100%);
    --m-grad-success: linear-gradient(135deg, #198754, #0dcaf0);
    --m-grad-warm:    linear-gradient(135deg, #fd7e14, #ffc107);
    --m-grad-cool:    linear-gradient(135deg, #6610f2, #0dcaf0);
}

/* ─── BASE ─────────────────────────────────────────────────────────────── */
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--m-bg);
    color: var(--m-text);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
img, svg, video { max-width: 100%; height: auto; }

/* Touch-friendly defaults */
button, .btn, .nav-link, .dropdown-item, [role="button"] {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.list-group-item { min-height: 56px; padding-block: .85rem; }

/* ─── NAVBAR ───────────────────────────────────────────────────────────── */
.navbar-marduk {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--m-border);
    padding-block: .55rem;
}
.navbar-brand { font-weight: 700; color: var(--m-primary) !important; font-size: 1.15rem; }
.navbar-brand i { color: var(--m-primary); }

@media (max-width: 991.98px) {
    .navbar-marduk .navbar-collapse {
        margin-top: .5rem;
        padding: 1rem;
        background: #fff;
        border-radius: var(--m-radius);
        box-shadow: var(--m-shadow-md);
    }
    .navbar-marduk .nav-link { width: 100%; justify-content: flex-start; padding-block: .75rem; }
    .navbar-marduk #mardukNavAuth {
        flex-direction: column;
        align-items: stretch !important;
        gap: .5rem;
        margin-top: .5rem;
        padding-top: .75rem;
        border-top: 1px solid var(--m-border);
    }
    .navbar-marduk #mardukNavAuth > * { width: 100%; }
}

/* ─── HERO ─────────────────────────────────────────────────────────────── */
.m-hero {
    background: var(--m-grad);
    color: #fff;
    padding: 3.5rem 0 4rem;
    position: relative;
    overflow: hidden;
}
.m-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 80% 20%, rgba(255,255,255,.18), transparent 50%);
    pointer-events: none;
}
.m-hero h1 {
    font-weight: 800;
    font-size: clamp(1.75rem, 5vw, 3.4rem);
    line-height: 1.1;
}
.m-hero .lead { font-size: clamp(.95rem, 2vw, 1.15rem); opacity: .95; }
.m-stat-pill {
    background: rgba(255, 255, 255, .18);
    border-radius: 999px;
    padding: .35rem 1rem;
    font-size: .85rem;
    backdrop-filter: blur(8px);
    display: inline-block;
}

@media (min-width: 992px) { .m-hero { padding: 5rem 0 6rem; } }

/* ─── CARDS ────────────────────────────────────────────────────────────── */
.card-soft {
    border: 1px solid var(--m-border);
    border-radius: var(--m-radius);
    transition: all .25s ease;
    background: var(--m-card);
    box-shadow: var(--m-shadow-sm);
}
@media (hover: hover) {
    .card-soft:hover {
        transform: translateY(-3px);
        box-shadow: var(--m-shadow-lg);
    }
}
.card-soft.card-link { color: inherit; text-decoration: none; }

.cat-icon {
    width: 48px; height: 48px;
    border-radius: var(--m-radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* ─── FORM / INPUTS ────────────────────────────────────────────────────── */
.form-control, .form-select {
    border-radius: var(--m-radius-sm);
    padding: .65rem .85rem;
    font-size: 1rem;
    border: 1px solid var(--m-border);
}
.form-control:focus, .form-select:focus {
    border-color: var(--m-primary);
    box-shadow: 0 0 0 .2rem rgba(13, 110, 253, .15);
}
.form-floating > .form-control,
.form-floating > .form-select { border-radius: var(--m-radius-sm); }

.btn { border-radius: var(--m-radius-sm); padding: .55rem 1rem; font-weight: 500; }
.btn-pill { border-radius: 999px; }
.btn-primary { background: var(--m-primary); border: 0; }
.btn-cta {
    background: var(--m-grad);
    border: 0;
    color: #fff;
    font-weight: 600;
    padding: .75rem 1.5rem;
}
.btn-cta:hover { filter: brightness(1.05); color: #fff; }

/* ─── BADGES suaves (compatibilidad index legacy) ───────────────────── */
.bg-primary-soft   { background: rgba(13,110,253,.12)  !important; }
.bg-secondary-soft { background: rgba(108,117,125,.12) !important; }
.bg-success-soft   { background: rgba(25,135,84,.14)   !important; }
.bg-warning-soft   { background: rgba(255,193,7,.18)   !important; }
.bg-danger-soft    { background: rgba(220,53,69,.14)   !important; }
.bg-info-soft      { background: rgba(13,202,240,.16)  !important; }
.bg-amber-soft     { background: rgba(245,158,11,.18)  !important; }
.bg-green-soft     { background: rgba(34,197,94,.14)   !important; }
.bg-teal-soft      { background: rgba(20,184,166,.14)  !important; }
.text-amber  { color: #b45309 !important; }
.text-green  { color: #15803d !important; }
.text-teal   { color: #0f766e !important; }
.text-purple { color: #6610f2 !important; }

/* ─── SKELETON LOADERS ─────────────────────────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg, #eef2f7 25%, #f7f9fc 50%, #eef2f7 75%);
    background-size: 200% 100%;
    animation: skel 1.4s ease infinite;
    border-radius: 8px;
}
@keyframes skel { 0% { background-position: 200% 0 } 100% { background-position: -200% 0 } }

/* ─── MODALES en mobile ────────────────────────────────────────────────── */
@media (max-width: 575.98px) {
    .modal-fullscreen-sm {
        margin: 0; max-width: 100%;
    }
    .modal-fullscreen-sm .modal-content {
        height: 100dvh; border-radius: 0; border: 0;
    }
    .modal-dialog-centered { align-items: stretch; }
    .modal-dialog { margin: 0; max-width: 100% !important; }
    .modal-content { border-radius: 0; min-height: 100dvh; }
    .modal-body { padding: 1rem; }
}

/* ─── TOASTS ───────────────────────────────────────────────────────────── */
#mardukToastHost { z-index: 1080; }
@media (max-width: 575.98px) {
    #mardukToastHost { left: 1rem; right: 1rem; top: auto !important; bottom: 1rem; }
    #mardukToastHost > * { width: 100% !important; max-width: 100% !important; }
}

/* ─── HELPERS IA ───────────────────────────────────────────────────────── */
.ai-action {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .35rem .75rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #6610f2, #0dcaf0);
    color: #fff;
    font-size: .8rem;
    font-weight: 500;
    border: 0;
    cursor: pointer;
    min-height: 36px;
}
.ai-action:hover { filter: brightness(1.07); color: #fff; }
.ai-action[disabled] { opacity: .55; cursor: progress; }
.ai-spinner {
    width: 14px; height: 14px; border-radius: 50%;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.ai-suggestion-list .item {
    border: 1px solid var(--m-border);
    border-radius: var(--m-radius-sm);
    padding: .65rem .85rem;
    margin-bottom: .4rem;
    cursor: pointer;
    transition: all .15s;
    background: #fff;
}
.ai-suggestion-list .item:hover {
    border-color: var(--m-primary);
    background: rgba(13, 110, 253, .04);
}

/* ─── FOOTER ───────────────────────────────────────────────────────────── */
.footer-marduk {
    background: #0d1117;
    color: #c9d1d9;
    padding: 3rem 0 1.5rem;
}
.footer-marduk a { color: #c9d1d9; text-decoration: none; }
.footer-marduk a:hover { color: #fff; }

/* ─── RESPONSIVE TABLE ─────────────────────────────────────────────────── */
.responsive-table {
    width: 100%;
    border-collapse: collapse;
}
@media (max-width: 575.98px) {
    .responsive-table thead { display: none; }
    .responsive-table, .responsive-table tbody, .responsive-table tr, .responsive-table td {
        display: block; width: 100%;
    }
    .responsive-table tr { border: 1px solid var(--m-border); border-radius: var(--m-radius-sm); margin-bottom: .75rem; padding: .75rem; }
    .responsive-table td { display: flex; justify-content: space-between; gap: .5rem; padding: .35rem 0; border: 0; }
    .responsive-table td::before { content: attr(data-label); font-weight: 600; color: var(--m-muted); }
}

/* ─── UTILIDADES ───────────────────────────────────────────────────────── */
.line-clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.scroll-x {
    display: flex;
    gap: .75rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: .5rem;
}
.scroll-x > * { scroll-snap-align: start; flex: 0 0 auto; }
.scroll-x::-webkit-scrollbar { height: 6px; }
.scroll-x::-webkit-scrollbar-thumb { background: rgba(0,0,0,.18); border-radius: 999px; }
