/* ══════════════════════════════════════════════════════════════════
   PROFILE PAGE — compact hero, wrap-panel layout, MD3 surfaces
   ══════════════════════════════════════════════════════════════════ */

.profile-page {
    max-width: 780px;
    margin: 0 auto;
    padding: var(--gap-md) var(--gap-md) var(--gap-lg);
}

/* ── Loading / Not found ──────────────────────────────────────── */

.profile-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

.profile-not-found {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    gap: var(--gap-md);
    color: var(--text-medium);
}

.profile-not-found .material-symbols-rounded {
    font-size: 3.5rem;
    color: var(--text-low);
}

.profile-not-found p {
    margin: 0;
    font-size: 1rem;
    color: var(--text-medium);
}

/* ══════════════════════════════════════════════════════════════════
   HERO BANNER — compact horizontal bar (same height as nav)
   ══════════════════════════════════════════════════════════════════ */

.profile-hero {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    margin-bottom: var(--gap-md);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.profile-hero-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(157, 36, 153, 0.25) 0%,
        rgba(94, 198, 198, 0.1) 60%,
        rgba(40, 40, 40, 0.4) 100%
    );
    z-index: 0;
}

.profile-hero > * {
    position: relative;
    z-index: 1;
}

/* ── Avatar ── */

.profile-avatar-wrapper {
    position: relative;
    flex-shrink: 0;
}

.profile-avatar {
    border: 2px solid rgba(157, 36, 153, 0.45) !important;
}

.profile-avatar-edit {
    position: absolute !important;
    bottom: -3px;
    right: -3px;
    width: 22px !important;
    height: 22px !important;
    min-width: 22px !important;
    background: var(--surface-dialog) !important;
    border: 1.5px solid var(--border-medium) !important;
    border-radius: var(--radius-circle) !important;
    color: var(--text-high) !important;
}

.profile-avatar-edit:hover {
    background: var(--color-primary) !important;
}

.profile-avatar-edit .mud-icon-root {
    font-size: 0.7rem !important;
}

/* ── Name & username ── */

.profile-hero-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.profile-display-name {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-high);
    letter-spacing: -0.01em;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-username {
    font-size: 0.8rem;
    color: var(--text-medium);
    margin-top: 0;
}

/* ══════════════════════════════════════════════════════════════════
   WRAP-PANEL GRID — sections flow horizontally like WrapPanel
   ══════════════════════════════════════════════════════════════════ */

.profile-wrap-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap-md);
}

/* ── Section cards ── */

.profile-section {
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--elevation-1);
    min-width: 0;
}

/* About spans full width */
.profile-section--about {
    flex: 1 1 100%;
}

/* Account and Settings share a row */
.profile-section--account {
    flex: 1 1 calc(50% - var(--gap-md) / 2);
    min-width: 240px;
}

.profile-section--settings {
    flex: 1 1 calc(50% - var(--gap-md) / 2);
    min-width: 240px;
}

.profile-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.profile-section-header h3 {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-high);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 1;
}

.profile-section-icon {
    font-size: 1.05rem;
    color: var(--color-primary);
    opacity: 0.85;
}

.profile-section-body {
    padding: 12px 16px;
}

/* ── Bio ── */

.profile-bio {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-high);
    white-space: pre-wrap;
}

.profile-bio--empty {
    color: var(--text-medium);
    font-style: italic;
}

/* ── Edit actions ── */

.profile-edit-actions {
    display: flex;
    gap: var(--gap-sm);
    justify-content: flex-end;
}

/* ── Info grid ── */

.profile-info-grid {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.profile-info-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 4px;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease;
}

.profile-info-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.profile-info-item > .material-symbols-rounded {
    font-size: 1.1rem;
    color: var(--color-tertiary);
    flex-shrink: 0;
    width: 22px;
    text-align: center;
}

.profile-info-item > div {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.profile-info-label {
    font-size: 0.7rem;
    color: var(--text-medium);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1;
    margin-bottom: 2px;
}

.profile-info-value {
    font-size: 0.85rem;
    color: var(--text-high);
    font-weight: 500;
}

/* ══════════════════════════════════════════════════════════════════
   SETTINGS / ACTION LIST
   ══════════════════════════════════════════════════════════════════ */

.profile-actions-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.profile-action-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 6px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s ease;
    text-align: left;
    color: inherit;
}

.profile-action-btn:hover {
    background: rgba(255, 255, 255, 0.06);
}

.profile-action-btn:active {
    background: rgba(255, 255, 255, 0.03);
}

.profile-action-btn > .material-symbols-rounded:first-child {
    font-size: 1.2rem;
    color: var(--color-primary);
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

.profile-action-btn > div {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.profile-action-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-high);
}

.profile-action-desc {
    font-size: 0.75rem;
    color: var(--text-medium);
    margin-top: 1px;
}

.profile-action-chevron {
    font-size: 1.15rem;
    color: var(--text-medium);
    flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════════
   MESSAGES (error / success)
   ══════════════════════════════════════════════════════════════════ */

.profile-error,
.profile-success {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    margin-top: var(--gap-md);
    animation: profileMsgIn 0.25s ease;
    flex: 1 1 100%;
}

.profile-error {
    background: rgba(239, 83, 80, 0.1);
    border-left: 3px solid var(--color-danger);
    color: #ff8a80;
}

.profile-success {
    background: rgba(76, 175, 80, 0.1);
    border-left: 3px solid var(--color-success);
    color: #a5d6a7;
}

.profile-error .material-symbols-rounded,
.profile-success .material-symbols-rounded {
    font-size: 1.2rem;
    flex-shrink: 0;
}

@keyframes profileMsgIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════════════════════════════
   MUD INPUT OVERRIDES — ensure light text on dark backgrounds
   ══════════════════════════════════════════════════════════════════ */

.profile-page .mud-input-root,
.profile-page .mud-input,
.profile-page .mud-input input,
.profile-page .mud-input textarea,
.profile-page .mud-input-slot {
    color: var(--text-high) !important;
}

.profile-page .mud-input-label,
.profile-page .mud-input-label-outlined {
    color: var(--text-medium) !important;
}

.profile-page .mud-input-helper-text {
    color: var(--text-medium) !important;
}

.profile-page .mud-input-outlined .mud-input-outlined-border {
    border-color: var(--border-medium) !important;
}

.profile-page .mud-input-outlined:hover .mud-input-outlined-border {
    border-color: rgba(255, 255, 255, 0.35) !important;
}

.profile-page .mud-input-outlined.mud-input-focused .mud-input-outlined-border {
    border-color: var(--color-primary) !important;
}

/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE — stack to single column on mobile
   ══════════════════════════════════════════════════════════════════ */

@media (max-width: 640.98px) {
    .profile-page {
        padding: var(--gap-sm) var(--gap-sm) var(--gap-md);
    }

    .profile-hero {
        padding: 8px 12px;
    }

    .profile-section--account,
    .profile-section--settings {
        flex: 1 1 100%;
        min-width: 0;
    }

    .profile-section-body {
        padding: 10px 14px;
    }
}
