/* ============================================================
   Michiland — estilos de componentes compartidos.
   Globales (no scopeados) — los usan Home, Register y cualquier
   wizard/página que venga. Se carga DESPUÉS de app.css para que
   sus selectores ganen.

   Para evitar choques con Bootstrap, todos los nombres llevan
   prefijo o son específicos a Michiland:
     .btn-michi, .input, .field, .field-label, .msg, .grid,
     .step-actions, .placeholder-*, .bait-*
   ============================================================ */

/* ───────────  buttons (movidos desde Home.razor.css)  ─────────── */

.btn-michi {
    appearance: none;
    border: 0;
    cursor: pointer;
    font-family: inherit;
    font-weight: 800;
    font-size: clamp(1.25rem, 2vw, 1.6rem);
    padding: 18px 40px;
    border-radius: 999px;
    min-width: 240px;
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s;
    letter-spacing: 0.02em;
    box-shadow: 0 10px 22px -10px rgba(0, 0, 0, 0.18);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
}
.btn-michi:hover:not(:disabled)  { transform: translateY(-3px) scale(1.04); filter: brightness(1.05); }
.btn-michi:active:not(:disabled) { transform: translateY(0)    scale(1);    }
.btn-michi:focus-visible         { outline: 3px solid #c69bff; outline-offset: 3px; }
.btn-michi:disabled              { opacity: 0.6; cursor: not-allowed; }

.btn-primary {
    background: linear-gradient(180deg, #ff8fb1 0%, #ff6a99 100%);
    color: white;
}
.btn-secondary {
    background: linear-gradient(180deg, #fff8ee 0%, #ffe9d6 100%);
    color: #b56a36;
    border: 2px solid #ffc89a;
    box-shadow: 0 10px 22px -10px rgba(181, 106, 54, 0.35);
}
.btn-ghost {
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    border: 2px dashed rgba(255, 255, 255, 0.45);
    box-shadow: none;
    font-weight: 700;
    min-width: 0;
    padding: 12px 22px;
    animation: none;
}
.btn-ghost:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.10);
    border-color: rgba(255, 255, 255, 0.85);
}

/* ============================================================
   WelcomeLayout — fondo hero + tarjeta centrada.
   Estas reglas son GLOBALES (viven en components.css, no scoped)
   porque AdminLogin, Me y otras páginas usan los mismos
   .welcome / .welcome-card / .welcome-actions y necesitan las
   mismas clases. Antes vivían en Home.razor.css que era scoped
   y por eso /me y /michiland-admin-gate se veían sin layout.
   ============================================================ */

.welcome {
    position: relative;
    min-height: 100vh;
    isolation: isolate;
    display: grid;
    place-items: center;
    overflow: hidden;
    padding: clamp(24px, 4vw, 56px) 0;
}

/* ---------- fondo con ken-burns lento ---------- */
.welcome-bg {
    position: absolute;
    inset: 0;
    z-index: -2;
    overflow: hidden;
}
.welcome-bg-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transform-origin: 50% 50%;
    animation: michi-kenburns 28s ease-in-out infinite alternate;
    will-change: transform;
}
.welcome-bg-overlay {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 70% 65% at 50% 45%, rgba(46, 34, 68, 0.55) 0%, rgba(46, 34, 68, 0) 78%),
        linear-gradient(180deg,
            rgba(46, 34, 68, 0.25) 0%,
            rgba(46, 34, 68, 0.35) 50%,
            rgba(46, 34, 68, 0.70) 100%);
}
@keyframes michi-kenburns {
    from { transform: scale(1.00) translate(0,    0); }
    to   { transform: scale(1.10) translate(-1%, -1.5%); }
}

/* ---------- tarjeta sobre el fondo ---------- */
.welcome-card {
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: none;
    border-radius: 28px;
    padding: clamp(20px, 2.6vw, 30px) clamp(22px, 3.4vw, 40px);
    width: min(520px, 88%);
    text-align: center;
    animation: michi-card-in 0.7s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}
/* Variante ancha para páginas con más contenido (/me, /admin/panel). */
.welcome-card.wide { width: min(820px, 94%); }
@keyframes michi-card-in {
    from { transform: translateY(22px) scale(0.97); opacity: 0; }
    to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

/* ---------- título + brand ---------- */
.welcome-title {
    margin: 0;
    line-height: 1.05;
    text-align: center;
    animation: michi-rise 0.8s 0.15s cubic-bezier(0.2,0.7,0.3,1) both;
}
.welcome-title .title-pre {
    display: block;
    font-size: clamp(2rem, 3.6vw, 2.9rem);
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: clamp(12px, 1.6vw, 20px);
    -webkit-text-stroke: 1.4px rgba(46, 34, 68, 0.85);
            text-stroke: 1.4px rgba(46, 34, 68, 0.85);
    paint-order: stroke fill;
    text-shadow: 0 0 12px rgba(255, 255, 255, 0.45), 0 2px 14px rgba(46, 34, 68, 0.65), 0 1px 3px rgba(0, 0, 0, 0.45);
}
.welcome-title .brand-img {
    display: block;
    width: min(640px, 100%);
    height: auto;
    margin: 0 auto;
    filter: drop-shadow(0 6px 18px rgba(46, 34, 68, 0.55)) drop-shadow(0 0 12px rgba(255, 255, 255, 0.40));
    animation: michi-rise 0.8s 0.25s cubic-bezier(0.2,0.7,0.3,1) both;
}
@keyframes michi-rise {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* ---------- tagline ---------- */
.welcome-tagline {
    color: rgba(255, 255, 255, 0.92);
    font-size: clamp(1.35rem, 2.3vw, 1.75rem);
    font-weight: 500;
    margin: 8px 0 24px;
    -webkit-text-stroke: 1px rgba(46, 34, 68, 0.75);
            text-stroke: 1px rgba(46, 34, 68, 0.75);
    paint-order: stroke fill;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.40), 0 2px 14px rgba(46, 34, 68, 0.60), 0 1px 3px rgba(0, 0, 0, 0.45);
    animation: michi-rise 0.8s 0.3s cubic-bezier(0.2,0.7,0.3,1) both;
}

/* ---------- botones (layout de fila) ---------- */
.welcome-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    animation: michi-actions-in 0.8s 0.45s cubic-bezier(0.2,0.7,0.3,1) both;
}
@keyframes michi-actions-in {
    from { transform: translateY(16px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* ---------- footer / versión ---------- */
.welcome-footer {
    margin: 24px 0 0;
    color: rgba(255, 255, 255, 0.85);
    font-size: 1.2rem;
    font-weight: 500;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.30), 0 2px 14px rgba(46, 34, 68, 0.60), 0 1px 3px rgba(0, 0, 0, 0.40);
    animation: michi-rise 0.9s 0.6s cubic-bezier(0.2,0.7,0.3,1) both;
}
.welcome-version {
    margin: 8px 0 0;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.25), 0 2px 14px rgba(46, 34, 68, 0.55), 0 1px 3px rgba(0, 0, 0, 0.40);
    animation: michi-rise 0.9s 0.7s cubic-bezier(0.2,0.7,0.3,1) both;
}

/* ---------- responsive ---------- */
@media (max-width: 480px) {
    .welcome-card { padding: 24px 18px; }
    .welcome-card.wide { width: 96%; }
    .welcome-actions { flex-direction: column; }
    .btn-michi { width: 100%; min-width: 0; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .welcome-bg-img,
    .welcome-title,
    .welcome-title .brand-img,
    .welcome-tagline,
    .welcome-actions,
    .btn-michi,
    .welcome-footer,
    .welcome-version {
        animation: none !important;
    }
}

/* ───────────  form fields (usados por Step1Registration)  ─────────── */

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.field-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.90);
    letter-spacing: 0.02em;
}
.input {
    appearance: none;
    border: 2px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.10);
    color: #ffffff;
    border-radius: 12px;
    padding: 11px 14px;
    font: inherit;
    font-weight: 600;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.input::placeholder { color: rgba(255, 255, 255, 0.45); }
.input:focus {
    outline: none;
    border-color: #ff6a99;
    background: rgba(255, 255, 255, 0.16);
    box-shadow: 0 0 0 4px rgba(255, 106, 153, 0.25);
}
.input-select { padding-right: 36px; cursor: pointer; }
.input-select option { background: #2e2244; color: #ffffff; }

/* textarea usa la misma skin que .input pero deja respirar al texto. */
textarea.input {
    resize: vertical;
    min-height: 64px;
    line-height: 1.4;
    font-family: inherit;
}
.bio-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
}
.bio-counter {
    font-variant-numeric: tabular-nums;
    margin-left: auto;
}

.field.is-readonly .input {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.85);
    cursor: not-allowed;
    border-style: dashed;
}

/* Blazor pone .input-validation-error en inputs que rechazan DataAnnotations */
.input.input-validation-error,
.input-validation-error {
    border-color: #ff5c5c !important;
    box-shadow: 0 0 0 4px rgba(255, 92, 92, 0.25) !important;
}

/* ───────────  mensajes y rejillas  ─────────── */

.msg { font-size: 0.85rem; line-height: 1.4; margin: 0; }
.msg-error { color: #ffb4b4; font-weight: 600; }
.msg-hint  { color: rgba(255, 255, 255, 0.55); }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 520px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ───────────  actions row (compartido)  ─────────── */
.step-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

/* ───────────  modal / overlay (compartido)  ─────────── */
/* Versión global para que tanto el loader de Home como el
   modal de cebo del wizard hereden estos estilos. Las páginas
   pueden sobreescribir con sus clases específicas (.bait-card). */

.action-overlay {
    position: fixed;
    inset: 0;
    background: rgba(91, 58, 138, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: grid;
    place-items: center;
    z-index: 50;
    animation: michi-overlay-in 0.2s ease-out;
    padding: 16px;
}
@keyframes michi-overlay-in { from { opacity: 0; } to { opacity: 1; } }

.action-card {
    background: #fff;
    border-radius: 24px;
    padding: 28px 36px;
    display: grid;
    gap: 14px;
    justify-items: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
    min-width: 260px;
    max-width: 92vw;
    text-align: center;
    animation: michi-card-pop 0.32s cubic-bezier(0.2, 0.7, 0.3, 1.4) both;
}
@keyframes michi-card-pop {
    from { transform: scale(0.85) translateY(20px); opacity: 0; }
    to   { transform: scale(1)    translateY(0);    opacity: 1; }
}

.action-title {
    margin: 0;
    color: #5b3a8a;
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1.25;
}

/* ───────────  modal de cebo de sexo  ─────────── */
/* Antes vivía en Register.razor.css (scoped a Register), pero el
   modal lo renderiza Step1Registration — así que vive aquí. */

.bait-card {
    max-width: 380px;
    width: min(380px, 92%);
}
.bait-title { color: #ff6a99; }
.bait-msg {
    color: #2e2244;
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.45;
}
.bait-msg .bait-emoji { font-size: 1.2em; }
.bait-img {
    display: block;
    width: clamp(110px, 45%, 170px);
    height: auto;
    margin: 0 auto 4px;
    animation: michi-bait-run 0.7s ease-in-out infinite alternate;
    filter: drop-shadow(0 6px 10px rgba(91, 58, 138, 0.25));
}
@keyframes michi-bait-run {
    from { transform: translateX(-8px) rotate(-2deg); }
    to   { transform: translateX( 8px) rotate( 2deg); }
}

/* ───────────  responsive del modal ─────────── */
/* En pantallas chicas el modal crece demasiado (card padding
   grande + título + img + texto + botón). Lo compactamos y
   dejamos la card scrollable si aun así se pasa del alto. */
@media (max-width: 520px) {
    .action-overlay {
        padding: 10px;
        align-items: center;              /* centrado en viewport */
    }
    .action-card {
        padding: 18px 18px 16px;
        gap: 10px;
        border-radius: 18px;
        margin-top: max(0px, env(safe-area-inset-top, 0px));
        max-height: calc(100dvh - 20px);
        overflow-y: auto;
    }
    .action-title {
        font-size: 1.05rem;
        line-height: 1.2;
    }
    .bait-img {
        width: clamp(90px, 38vw, 140px);
    }
    .bait-msg { font-size: 0.92rem; }
    .action-card .btn-michi {
        min-width: 0;
        width: 100%;
        font-size: 1.05rem;
        padding: 12px 18px;
    }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
    .action-overlay,
    .action-card,
    .bait-img {
        animation: none !important;
    }
}

/* ============================================================
   Step 2 — picker de 12 ejes (design grid)
   ============================================================ */

.design-grid {
    display: grid;
    gap: 14px;
}

.design-summary {
    display: flex;
    gap: 12px;
    align-items: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px dashed rgba(255, 255, 255, 0.25);
    border-radius: 14px;
    padding: 12px 14px;
}
.design-summary-icon {
    font-size: 1.8rem;
    flex: 0 0 auto;
}
.design-summary-text {
    margin: 0;
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.92rem;
    line-height: 1.45;
}
.design-summary-text small {
    color: rgba(255, 255, 255, 0.55);
}

.design-grid-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
@media (max-width: 520px) {
    .design-grid-fields { grid-template-columns: 1fr; }
}

.design-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.design-field-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.78);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

/* ───── modal de generación ───── */

.design-modal {
    max-width: 460px;
    width: min(460px, 96vw);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    gap: 12px;
}
.design-title { color: #5b3a8a; }

.design-modal-hint {
    margin: 0;
    color: #4a3a66;
    font-size: 0.92rem;
    line-height: 1.45;
    text-align: center;
}

.design-modal-list {
    list-style: none;
    margin: 0;
    padding: 10px 14px;
    background: #f6f0ff;
    border-radius: 12px;
    width: 100%;
    box-sizing: border-box;
    display: grid;
    gap: 4px;
    max-height: 50dvh;
    overflow-y: auto;
}
.design-modal-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.88rem;
    border-bottom: 1px dashed rgba(91, 58, 138, 0.15);
    padding: 3px 0;
}
.design-modal-row:last-child { border-bottom: 0; }
.design-modal-key { color: #5b3a8a; font-weight: 700; }
.design-modal-val { color: #2e2244; font-weight: 500; text-align: right; }

.design-modal-meta {
    margin: 0;
    color: rgba(91, 58, 138, 0.55);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}

.design-result-img {
    background:
        repeating-conic-gradient(#f0e8ff 0% 25%, #fff 0% 50%) 0 0 / 16px 16px;
    border-radius: 12px;
}
.design-result-img--large {
    width: clamp(140px, 40vw, 220px);
}

/* ───── responsive del modal de generación (móvil) ─────
   El modal tiene 13 filas (12 parámetros + acciones) y se pasaba
   del alto del viewport. Lo compactamos. */
@media (max-width: 520px) {
    .design-modal {
        max-width: 100%;
        width: 100%;
        max-height: calc(100dvh - 24px);
        padding: 16px 14px 14px;
        gap: 10px;
        border-radius: 18px;
    }
    .design-modal .action-title {
        font-size: 1.05rem;
        line-height: 1.2;
    }
    .design-modal-hint {
        font-size: 0.85rem;
    }
    .design-modal-list {
        padding: 8px 12px;
        gap: 2px;
        max-height: 42dvh;
    }
    .design-modal-row {
        font-size: 0.82rem;
        padding: 2px 0;
        gap: 8px;
    }
    .design-modal-row .design-modal-key { flex: 0 0 auto; }
    .design-modal-row .design-modal-val { flex: 1 1 auto; min-width: 0; }
}

/* El .action-card es display:grid + justify-items:center, así que sus
   hijos (incluido .step-actions) se encogen al ancho de su contenido.
   Eso hace que en desktop los botones Generar+Editar no quepan en una
   sola fila y se apilen verticalmente. Forzamos a step-actions a
   ocupar todo el ancho disponible y mantener los botones en una fila
   aunque el contenido de cada uno sea ancho. */
.action-card .step-actions {
    width: 100%;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: nowrap;
}
.action-card .step-actions .btn-michi {
    flex: 1 1 0;
    min-width: 0;
    padding-left: 12px;
    padding-right: 12px;
}

/* El .btn-ghost global está pensado para la card oscura del wizard
   (fondo transparente + texto blanco). Sobre .action-card (fondo
   blanco) el ghost queda invisible. Re-pintamos para que contraste. */
.action-card .btn-ghost {
    background: #f7e6f5 !important;
    color: #5b3a8a !important;
    border: 1.5px dashed #c69bff !important;
    box-shadow: none;
}
.action-card .btn-ghost:hover:not(:disabled) {
    background: #ffd2e6 !important;
    border-color: #ff6a99 !important;
    color: #b13b6a !important;
}

/* ───── loader del paso 2 ───── */

.design-loader {
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: 18px 0;
}
.design-loader-paw {
    font-size: 2.4rem;
    animation: michi-loader-paw 1.2s ease-in-out infinite;
}
@keyframes michi-loader-paw {
    0%, 100% { transform: translateY(0)   rotate(0deg);  }
    25%      { transform: translateY(-8px) rotate(-12deg); }
    50%      { transform: translateY(0)   rotate(0deg);  }
    75%      { transform: translateY(-4px) rotate(8deg);  }
}
.design-loader-bar {
    width: min(220px, 70%);
    height: 8px;
    background: #ece4ff;
    border-radius: 999px;
    overflow: hidden;
}
.design-loader-bar-inner {
    height: 100%;
    width: 40%;
    border-radius: 999px;
    background: linear-gradient(90deg, #ff8fb1, #c69bff);
    animation: michi-loader-bar 1.4s ease-in-out infinite;
}
@keyframes michi-loader-bar {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(250%);  }
}
.design-loader-text {
    margin: 0;
    color: rgba(91, 58, 138, 0.7);
    font-size: 0.88rem;
}

@media (prefers-reduced-motion: reduce) {
    .design-loader-paw,
    .design-loader-bar-inner { animation: none !important; }
}
