/* =====================================================================
   OtherSites - estilos propios (sobre Bootstrap 5.3)
   ===================================================================== */

/* ---------- Utilidades ---------- */
.min-w-0 { min-width: 0; }

.brand-mark {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--bs-primary);
}

/* ---------- Temas de la página pública ----------
   Cada tema define variables que usan .profile-page y las muestras del selector. */
.theme-light {
    --p-bg: #f3f4f6;
    --p-bg-image: none;
    --p-text: #1f2328;
    --p-muted: #6b7280;
    --p-btn-bg: #ffffff;
    --p-btn-text: #1f2328;
    --p-btn-border: rgba(0, 0, 0, .08);
    --p-btn-hover: #fafafa;
    --p-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}
.theme-dark {
    --p-bg: #111418;
    --p-bg-image: none;
    --p-text: #f3f4f6;
    --p-muted: #9ca3af;
    --p-btn-bg: #1d2229;
    --p-btn-text: #f3f4f6;
    --p-btn-border: rgba(255, 255, 255, .08);
    --p-btn-hover: #252b33;
    --p-shadow: none;
    --p-icon: currentColor;
}
.theme-ocean,
.theme-sunset,
.theme-forest {
    --p-text: #ffffff;
    --p-muted: rgba(255, 255, 255, .78);
    --p-btn-bg: rgba(255, 255, 255, .14);
    --p-btn-text: #ffffff;
    --p-btn-border: rgba(255, 255, 255, .28);
    --p-btn-hover: rgba(255, 255, 255, .24);
    --p-shadow: none;
    --p-icon: currentColor;
}
.theme-ocean {
    --p-bg: #203a43;
    --p-bg-image: linear-gradient(160deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
}
.theme-sunset {
    --p-bg: #e96443;
    --p-bg-image: linear-gradient(160deg, #c33764 0%, #e96443 55%, #f39c5a 100%);
}
.theme-forest {
    --p-bg: #2c7a5e;
    --p-bg-image: linear-gradient(160deg, #134e5e 0%, #2c7a5e 50%, #5a9e6f 100%);
}

/* ---------- Página pública (othersites.link/usuario) ---------- */
.profile-page {
    min-height: 100vh;
    background-color: var(--p-bg);
    background-image: var(--p-bg-image);
    color: var(--p-text);
}
.profile-wrap {
    max-width: 600px;
    min-height: 100vh;
    margin: 0 auto;
    padding: 3rem 1rem 1.5rem;
    display: flex;
    flex-direction: column;
}
.profile-header {
    text-align: center;
    margin-bottom: 2rem;
}
.profile-header .avatar {
    margin-bottom: 1rem;
    box-shadow: 0 0 0 4px var(--p-btn-border);
}
.profile-page .avatar-initials {
    background: var(--p-btn-bg);
    color: var(--p-text);
}
.profile-name {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: .15rem;
}
.profile-handle {
    color: var(--p-muted);
    margin-bottom: .75rem;
}
.profile-bio {
    max-width: 32rem;
    margin: 0 auto;
    opacity: .92;
}
.profile-links {
    display: flex;
    flex-direction: column;
    gap: .9rem;
}
.link-btn {
    display: grid;
    grid-template-columns: 2.75rem 1fr 2.75rem;
    align-items: center;
    gap: .5rem;
    min-height: 3.6rem;
    padding: .7rem 1rem;
    border: 1px solid var(--p-btn-border);
    border-radius: 1rem;
    background: var(--p-btn-bg);
    box-shadow: var(--p-shadow);
    color: var(--p-btn-text);
    font-weight: 600;
    text-decoration: none;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    transition: transform .15s ease, background-color .15s ease;
}
.link-btn:hover,
.link-btn:focus-visible {
    background: var(--p-btn-hover);
    color: var(--p-btn-text);
    transform: translateY(-2px);
}
.link-btn:focus-visible {
    outline: 3px solid var(--p-muted);
    outline-offset: 2px;
}
.link-btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--p-icon, var(--brand, currentColor));
}
.link-btn-title {
    text-align: center;
    overflow-wrap: anywhere;
}
.link-btn .link-icon-img {
    width: 2rem;
    height: 2rem;
}
.link-icon-img {
    object-fit: contain;
    border-radius: .5rem;
}
.profile-empty {
    text-align: center;
    color: var(--p-muted);
}
.profile-footer {
    margin-top: auto;
    padding-top: 3rem;
    text-align: center;
    font-size: .85rem;
}
.profile-footer a {
    color: var(--p-muted);
    font-weight: 600;
    text-decoration: none;
}
@media (prefers-reduced-motion: reduce) {
    .link-btn { transition: none; }
    .link-btn:hover, .link-btn:focus-visible { transform: none; }
}

/* ---------- Avatares ---------- */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 50%;
    object-fit: cover;
}
.avatar-md { width: 4.5rem; height: 4.5rem; font-size: 1.5rem; }
.avatar-lg { width: 6rem; height: 6rem; font-size: 2rem; }
.avatar-initials {
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
    font-weight: 700;
}

/* ---------- Panel ---------- */
.stat-card .card-body { padding: .85rem 1rem; }
.stat-label {
    overflow: hidden;
    font-size: .8rem;
    color: var(--bs-secondary-color);
    text-overflow: ellipsis;
    white-space: nowrap;
}
.stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.25;
}
.stat-hint {
    font-size: .75rem;
    color: var(--bs-tertiary-color);
}
@media (max-width: 575.98px) {
    .stat-card .card-body { padding: .7rem .75rem; }
    .stat-value { font-size: 1.2rem; }
}

.link-list .list-group-item { padding: .7rem .85rem; }
.link-list .list-group-item.is-inactive .link-list-icon,
.link-list .list-group-item.is-inactive .min-w-0 { opacity: .5; }
.drag-handle {
    padding: .25rem 0;
    font-size: 1.2rem;
    color: var(--bs-tertiary-color);
    cursor: grab;
    touch-action: none;
}
.sortable-ghost { opacity: .4; }
.sortable-chosen { background: var(--bs-tertiary-bg); }

.link-list-icon,
.icon-preview {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: .6rem;
    background: var(--bs-tertiary-bg);
    color: var(--brand, var(--bs-body-color));
}
.link-list-icon { width: 2.4rem; height: 2.4rem; font-size: 1.25rem; }
.icon-preview { width: 3rem; height: 3rem; font-size: 1.6rem; }
[data-bs-theme="dark"] .link-list-icon,
[data-bs-theme="dark"] .icon-preview { color: var(--bs-body-color); }
.link-list-icon .link-icon-img { width: 1.7rem; height: 1.7rem; }
.icon-preview .link-icon-img { width: 2.2rem; height: 2.2rem; }
.icon-preview-img {
    width: 3rem;
    height: 3rem;
    flex-shrink: 0;
    border-radius: .6rem;
    background: var(--bs-tertiary-bg);
    object-fit: contain;
}
.icon-preview-sm { min-width: 2.75rem; justify-content: center; font-size: 1.1rem; }

/* Selector de tema */
.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .4rem;
    width: 100%;
    padding: .5rem;
    border: 2px solid var(--bs-border-color);
    border-radius: .75rem;
    cursor: pointer;
}
.btn-check:checked + .theme-option {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 .2rem rgba(var(--bs-primary-rgb), .15);
}
.btn-check:focus-visible + .theme-option {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}
.theme-swatch {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: .35rem;
    width: 100%;
    height: 3.5rem;
    padding: 0 .75rem;
    border-radius: .5rem;
    background-color: var(--p-bg);
    background-image: var(--p-bg-image);
}
.theme-swatch span {
    display: block;
    height: .6rem;
    border: 1px solid var(--p-btn-border);
    border-radius: 1rem;
    background: var(--p-btn-bg);
}

/* Gráficos */
.chart-box { position: relative; height: 240px; }
.chart-box-lg { height: 300px; }
@media (max-width: 575.98px) {
    .chart-box-lg { height: 240px; }
}
