/* ═══════════════════════════════════════════════════════════════════════
   profile-shared.css
   Estilos base compartidos por Perfil.razor Y PerfilDeclara.razor.
   Importar en app.css:  @import url('profile-shared.css');
   ═══════════════════════════════════════════════════════════════════════ */

.profile-shell {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding-bottom: 0.5rem;
}

.panel-kicker {
    display: inline-flex;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--n-blue);
}

/* ── Grid principal: aside + formulario ─────────────────────────────── */
.profile-grid {
    display: grid;
    grid-template-columns: minmax(290px, 340px) minmax(0, 1fr);
    gap: 0.75rem;
    align-items: start;
}

/* ── Cards base ─────────────────────────────────────────────────────── */
.profile-aside-card,
.profile-form-card,
.profile-state-card {
    border-radius: 24px;
    border: 1px solid var(--n-border);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.05);
}

.profile-aside-card,
.profile-form-card {
    padding: 0.82rem;
}

.profile-aside-card {
    background:
        radial-gradient(circle at top, rgba(0, 107, 181, 0.08), transparent 32%),
        linear-gradient(180deg, rgba(255,255,255,0.98), rgba(246,250,254,0.98));
}

/* ── Panel head ─────────────────────────────────────────────────────── */
.profile-panel-head,
.profile-security-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.65rem;
}

.profile-panel-head h3,
.profile-security-head h4,
.profile-section-head h4,
.profile-state-card h3 {
    margin: 0.2rem 0 0;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--n-text);
}

.profile-panel-head-form { margin-bottom: 0.55rem; }

/* ── Pill ───────────────────────────────────────────────────────────── */
.profile-pill {
    min-height: 30px;
    padding: 0 0.72rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,107,181,0.12);
    color: var(--n-blue);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

/* ── Avatar stage ───────────────────────────────────────────────────── */
.profile-avatar-stage {
    margin-top: 0.65rem;
    padding: 0.78rem 0.82rem;
    border-radius: 18px;
    border: 1px solid rgba(147,197,232,0.8);
    background:
        radial-gradient(circle at top, rgba(0,107,181,0.14), transparent 34%),
        linear-gradient(180deg, #ffffff, #f0f7fd);
    display: grid;
    grid-template-columns: auto minmax(0,1fr);
    align-items: center;
    gap: 0.75rem;
    text-align: left;
}

.profile-avatar-frame {
    width: 112px;
    height: 112px;
    padding: 5px;
    border-radius: 24px;
    background: linear-gradient(145deg, rgba(0,107,181,0.22), rgba(39,147,212,0.08));
    box-shadow: 0 12px 22px rgba(0,107,181,0.12);
}

.profile-avatar-preview {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 18px;
    object-fit: cover;
    background: #ffffff;
}

.profile-avatar-copy {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.18rem;
}

.profile-avatar-copy strong {
    font-size: 0.96rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--n-text);
    /* reset de los !important del sistema de botones */
    min-height: unset !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: none !important;
    background-image: none !important;
    box-shadow: none !important;
    display: block !important;
    justify-content: unset !important;
    align-items: unset !important;
    white-space: normal !important;
    text-decoration: none !important;
    color: var(--n-text) !important;
    font-size: 0.96rem !important;
    font-weight: 800 !important;
    line-height: 1.2 !important;
}

.profile-avatar-copy span {
    color: var(--n-text-muted);
    font-size: 0.78rem;
}

/* ── Avatar library ─────────────────────────────────────────────────── */
.profile-avatar-library {
    margin-top: 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.profile-section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.7rem;
}

.profile-section-caption {
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--n-text-muted);
}

.profile-avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
    gap: 0.45rem;
}

/* ── Avatar picker ──────────────────────────────────────────────────── */
.avatar-picker {
    position: relative;
    aspect-ratio: 1;
    padding: 0.22rem;
    border: 1.5px solid #93c5e8;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: inset 0 1px 3px rgba(0,107,181,0.06);
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
    cursor: pointer;
    /* reset botones */
    min-height: unset !important;
    display: block !important;
    justify-content: unset !important;
    align-items: unset !important;
    gap: unset !important;
    font-weight: unset !important;
    line-height: unset !important;
    white-space: unset !important;
    text-decoration: unset !important;
    color: unset !important;
    background-image: none !important;
    box-shadow: inset 0 1px 3px rgba(0,107,181,0.06) !important;
}

.avatar-picker img {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 10px;
    object-fit: cover;
}

.avatar-picker:hover {
    transform: translateY(-1px);
    border-color: var(--n-blue) !important;
    box-shadow: 0 0 0 3px rgba(0,107,181,0.14), inset 0 1px 3px rgba(0,107,181,0.06) !important;
    background-image: none !important;
    background-color: #ffffff !important;
}

.avatar-picker-active {
    border-color: var(--n-blue) !important;
    background: #f0f7fd !important;
    background-image: none !important;
    box-shadow: 0 0 0 3px rgba(0,107,181,0.16) !important;
}

.avatar-picker-active::after {
    content: "";
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--n-blue);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.96);
}

.profile-avatar-empty {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.9rem;
    border-radius: 16px;
    background: #eef4fb;
    color: var(--n-text-muted);
    font-size: 0.86rem;
}
.profile-avatar-empty i { color: var(--n-blue); }

/* ── Validation ─────────────────────────────────────────────────────── */
.profile-validation {
    margin-bottom: 0.65rem;
    padding: 0.68rem 0.78rem;
    border-radius: 16px;
    border: 1px solid rgba(176,42,55,0.16);
    background: rgba(253,230,231,0.82);
    color: var(--n-danger-text);
    font-size: 0.8rem;
}
.profile-validation:empty { display: none; }

/* ── Form grid ──────────────────────────────────────────────────────── */
.profile-form-grid,
.profile-password-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 0.65rem;
}

.profile-field-wide { grid-column: 1 / -1; }

/* ── Field card ─────────────────────────────────────────────────────── */
.profile-field-card {
    display: flex;
    flex-direction: column;
    gap: 0.32rem;
    padding: 0.62rem;
    border-radius: 16px;
    border: 1px solid #bfdbf0;
    background: linear-gradient(180deg, #f5faff, #eef4fb);
}

.profile-field-card-readonly {
    background: linear-gradient(180deg, #eef4fb, #e8f2fb);
}

.profile-field-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.45rem;
}

.profile-field-label {
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #1e3a5f;
}

.profile-field-tag {
    min-height: 22px;
    padding: 0 0.5rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,107,181,0.09);
    color: var(--n-blue);
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

/* ── Input shell ────────────────────────────────────────────────────── */
.profile-input-shell {
    min-height: 38px;
    padding: 0 0.6rem;
    border: 1.5px solid #93c5e8;
    border-radius: 9px;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    background: #ffffff;
    box-shadow: inset 0 1px 3px rgba(0,107,181,0.06);
    transition: all 0.2s ease-in-out;
}

.profile-field-card:focus-within .profile-input-shell {
    border-color: var(--n-blue);
    background-color: #f0f7fd;
    box-shadow: 0 0 0 3px rgba(0,107,181,0.18), inset 0 1px 3px rgba(0,107,181,0.06);
}

.profile-input-shell-readonly {
    background-color: #dceef9;
    border-color: #b3d4ef;
    box-shadow: none;
}

.profile-input-icon {
    color: #3b82b8;
    font-size: 0.92rem;
    flex-shrink: 0;
}

.profile-field-input {
    width: 100%;
    min-width: 0;
    height: 34px;
    padding: 0;
    margin: 0;
    border: 0 !important;
    background: transparent !important;
    color: var(--n-text, #16324a);
    font-size: 0.89rem;
    font-weight: 600;
    font-family: inherit;
    outline: none;
    box-shadow: none !important;
    -webkit-appearance: none;
    appearance: none;
    /* reset sistema de botones */
    min-height: unset !important;
    border-radius: 0 !important;
    display: block !important;
    justify-content: unset !important;
    align-items: unset !important;
    gap: unset !important;
    line-height: unset !important;
    white-space: unset !important;
    text-decoration: none !important;
    background-image: none !important;
    transform: none !important;
}

.profile-field-input:focus,
.profile-field-input:focus-visible {
    outline: none;
    box-shadow: none !important;
    background: transparent !important;
}

.profile-field-input::placeholder { color: #7bafd4; }

.profile-field-input-readonly { color: #5a8ab0; cursor: default; }

.profile-field-value {
    display: flex;
    align-items: center;
    line-height: 1;
}

.profile-field-error {
    color: var(--n-danger-text);
    font-size: 0.74rem;
    font-weight: 700;
}

/* ── Security card ──────────────────────────────────────────────────── */
.profile-security-card {
    margin-top: 0.7rem;
    padding: 0.72rem 0.8rem;
    border-radius: 18px;
    border: 1px solid #bfdbf0;
    background: linear-gradient(180deg, #f5faff, #eef4fb);
}

.profile-security-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.profile-security-badge {
    min-height: 28px;
    padding: 0 0.68rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,107,181,0.08);
    color: #2b5d86;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    /* reset */
    min-height: 28px !important;
    box-shadow: none !important;
    background-image: none !important;
    transform: none !important;
}

.profile-security-badge-active {
    background: rgba(0,107,181,0.14) !important;
    color: var(--n-blue) !important;
}

/* ── Toggle ─────────────────────────────────────────────────────────── */
.profile-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    cursor: pointer;
    user-select: none;
}

.profile-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.profile-toggle-track {
    position: relative;
    width: 46px;
    height: 26px;
    border-radius: 999px;
    background: #dbe8f3;
    transition: background-color 0.18s ease, box-shadow 0.18s ease;
    flex-shrink: 0;
}

.profile-toggle-track::after {
    content: "";
    position: absolute;
    top: 4px;
    left: 4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 4px 10px rgba(15,23,42,0.18);
    transition: transform 0.18s ease;
}

.profile-toggle input:checked + .profile-toggle-track {
    background: linear-gradient(135deg, var(--n-blue), #2793d4);
    box-shadow: 0 10px 18px rgba(0,107,181,0.18);
}

.profile-toggle input:checked + .profile-toggle-track::after {
    transform: translateX(20px);
}

.profile-toggle-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--n-text);
}

/* ── Security placeholder ───────────────────────────────────────────── */
.profile-security-placeholder {
    margin-top: 0.65rem;
    padding: 0.68rem 0.78rem;
    border-radius: 16px;
    border: 1px dashed #93c5e8;
    background: rgba(0,107,181,0.05);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.profile-security-placeholder-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,107,181,0.12);
    color: var(--n-blue);
}

.profile-security-placeholder-copy {
    display: flex;
    flex-direction: column;
    gap: 0.16rem;
}

.profile-security-placeholder-copy strong {
    font-size: 0.84rem;
    color: var(--n-text);
    /* reset */
    min-height: unset !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: none !important;
    background-image: none !important;
    box-shadow: none !important;
    display: block !important;
    justify-content: unset !important;
    align-items: unset !important;
    white-space: normal !important;
    text-decoration: none !important;
    color: var(--n-text) !important;
    font-size: 0.84rem !important;
    font-weight: 800 !important;
    line-height: 1.2 !important;
}

.profile-security-placeholder-copy span {
    color: var(--n-text-muted);
    font-size: 0.76rem;
}

/* ── Form footer ────────────────────────────────────────────────────── */
.profile-form-footer {
    margin-top: 0.75rem;
    padding-top: 0.6rem;
    border-top: 1px solid #dfeaf4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
}

.profile-save-btn { min-width: 176px; }

/* ── State card ─────────────────────────────────────────────────────── */
.profile-state-card {
    min-height: 280px;
    padding: 1.6rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 0.75rem;
}

.profile-state-icon {
    width: 68px;
    height: 68px;
    border-radius: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,107,181,0.12);
    color: var(--n-blue);
}

.profile-state-card p {
    max-width: 38ch;
    margin: 0;
    color: var(--n-text-muted);
    line-height: 1.55;
}

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 1080px) {
    .profile-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
    .profile-form-grid,
    .profile-password-grid    { grid-template-columns: 1fr; }

    .profile-form-footer,
    .profile-panel-head,
    .profile-security-head    { flex-direction: column; align-items: stretch; }

    .profile-security-controls { justify-content: space-between; }

    .profile-save-btn,
    .profile-pill             { width: 100%; }
}

@media (max-width: 640px) {
    .profile-aside-card,
    .profile-form-card,
    .profile-state-card       { padding: 0.85rem; border-radius: 20px; }

    .profile-avatar-stage     { grid-template-columns: 1fr; text-align: center; }
    .profile-avatar-copy      { align-items: center; }
    .profile-avatar-frame     { width: 132px; height: 132px; border-radius: 28px; }
    .profile-avatar-preview   { border-radius: 20px; }
    .profile-avatar-grid      { grid-template-columns: repeat(auto-fill, minmax(56px,1fr)); }
    .profile-security-placeholder { align-items: flex-start; }
}
