/* ── Profile Page ─────────────────────────────────────── */

.profile-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 24px 16px 24px;
}

.profile-page-header {
    display: block;
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 48px;
}

.profile-page-header .back-btn {
    padding: 0;
    margin-left: 0;
}

.profile-page-title {
    margin: 16px 0 12px;
    font-size: 2.0rem;
    font-weight: 600;
    text-align: left;
}

.profile-body {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
    margin-top: 0;
}

.contact-intro-block {
    width: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 20px;
}

.contact-intro-copy {
    margin: 0;
    flex: 1;
    width: auto;
    max-width: none;
    color: var(--text-primary);
    line-height: 1.65;
    text-align: left;
}

/* Profile photo */

.profile-photo-wrapper {
    position: relative;
}

.profile-photo {
    width: 128px;
    height: 128px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
}

.profile-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.2s ease-in;
}

.profile-photo img.loaded {
    opacity: 1;
}

.profile-photo-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.2s;
    border-radius: 50%;
    cursor: pointer;
    border: 0;
    padding: 0;
    color: inherit;
    font: inherit;
}

.profile-photo-overlay:focus-visible {
    opacity: 1;
    outline: 2px solid #111;
    outline-offset: 2px;
}

.profile-photo-wrapper:hover .profile-photo-overlay {
    opacity: 1;
}

.profile-photo-wrapper.is-disabled .profile-photo-overlay {
    opacity: 1;
    background: rgba(0, 0, 0, 0.62);
    cursor: not-allowed;
}

.profile-photo-wrapper.is-disabled:hover .profile-photo-overlay {
    opacity: 1;
}

.profile-photo-spinner {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
}

.profile-photo-spinner[hidden] {
    display: none;
}

.profile-photo-spinner-ring {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: avatar-spin 0.7s linear infinite;
}

/* Form section */

.profile-form-section {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.profile-form-section--narrow {
    max-width: 300px;
}

.profile-form-shell {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.profile-form-shell[hidden] {
    display: none;
}

.profile-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.profile-message {
    display: none;
    width: 100%;
    padding: 12px;
    border-radius: 5px;
    font-weight: 500;
    line-height: 1.6;
}

.profile-message[hidden] {
    display: none !important;
}

.profile-message p {
    margin: 0;
    color: inherit;
}

.profile-message.visible {
    display: block;
}

.profile-message.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.profile-message.success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.profile-message.info {
    display: block;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.28);
    color: #93c5fd;
}

.profile-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
}

.profile-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.profile-label {
    text-align: left;
    margin-left: 4px;
    font-weight: 500;
}

.profile-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 12px 16px;
    font-family: inherit;
    font-size: 0.875rem;
    outline: none;
    transition: all 0.2s ease-in-out;
    box-sizing: border-box;
}

.profile-input:focus {
    border-color: #3b82f6;
}

.profile-input:disabled,
.profile-textarea:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.profile-textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 12px 16px;
    font-family: inherit;
    font-size: 0.875rem;
    outline: none;
    resize: none;
    transition: all 0.2s ease-in-out;
    box-sizing: border-box;
    min-height: 5.5rem; /* slightly taller default for short bios */
    line-height: 1.6;   /* increase line spacing for prefilled text */
}

.profile-textarea:focus {
    border-color: #3b82f6;
}

/* Make textarea scrollbar track transparent and style thumb */
.profile-textarea {
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: rgba(255,255,255,0.12) transparent; /* thumb then track */
}

.profile-textarea::-webkit-scrollbar {
    width: 12px;
}
.profile-textarea::-webkit-scrollbar-track {
    background: transparent;
}
.profile-textarea::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.12);
    border-radius: 8px;
    border: 3px solid transparent; /* creates padding so thumb doesn't touch edges */
    background-clip: padding-box;
}
.profile-textarea::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.18);
}

.profile-email-display {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 12px 16px;
    color: var(--text-medium);
    font-size: 0.875rem;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
}

.profile-save-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-top: 28px;
    margin-bottom: 48px;
}

.profile-save-btn {
    align-self: center;
    padding: 12px 60px;
    background: #fff;
    color: #000;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 20px 25px -5px rgba(255, 255, 255, 0.05);
}

.profile-save-btn:hover {
    background: #3b82f6;
    color: #fff;
}

.profile-save-btn:active {
    background: #3b82f6;
    color: #fff;
}

.profile-save-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (min-width: 641px) {
    .profile-container {
        padding: 24px 16px 48px;
    }
    .profile-photo {
        width: 160px;
        height: 160px;
    }
    .profile-body {
        margin-top: 0;
    }
}

@media (max-width: 640px) {
    .profile-container--contact .profile-page-header {
        margin-bottom: 40px;
    }

    .profile-page-header {
        margin-bottom: 40px;
    }

    .contact-intro-block {
        gap: 16px;
        align-items: flex-start;
    }

    .profile-side-title {
        font-size: 1.375rem;
    }
}

/* ── Password input toggle ────────────────────────── */

.password-input-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.password-input-wrapper .profile-input {
    width: 100%;
    padding-right: 48px !important;
    margin: 0;
}

.password-toggle-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-medium);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    height: 32px;
    width: 32px;
}

.password-toggle-btn:hover {
    color: var(--text-medium);
}

.password-toggle-btn svg {
    width: 18px;
    height: 18px;
    display: block;
}
