.rafi-profile{max-width:1100px;margin:30px auto;background:#fff;border-radius:16px;overflow:hidden;box-shadow:0 8px 30px rgba(0,0,0,.08)}
.rafi-profile-cover{position:relative;height:250px;overflow:hidden;background:#eef2f7}
.rafi-profile-cover>img{width:100%;height:100%;object-fit:cover}
.rafi-cover-form{position:absolute;right:20px;bottom:20px}
.rafi-cover-btn{
    display:inline-flex;
    align-items:center;
    padding:2px 20px;
    border-radius:20px;
    background:rgba(58, 2, 2, 0.65);
    color:#fff;
    cursor:pointer;
    font-size:14px;
    line-height:1.1;
}
.rafi-avatar{margin:-60px 0 0 30px;position:relative;z-index:2}
.rafi-avatar img{width:120px;height:120px;border:5px solid #fff;border-radius:50%;object-fit:cover}
.rafi-user-name{margin:12px 30px 8px}
.rafi-profile-actions,.rafi-profile-stats{display:flex;align-items:center;gap:12px;flex-wrap:wrap;padding:10px 30px}
.rafi-profile-stats span{padding:8px 12px;border-radius:20px;background:#f3f6fa}
.rafi-profile-description{padding:0 30px 25px}
.rafi-follow-btn,.rafi-message-btn{border:0;border-radius:10px;padding:10px 16px;text-decoration:none;cursor:pointer}
.rafi-follow-btn{background:#0d6efd;color:#fff}.rafi-message-btn{background:#eef2f7;color:#172033}
.rafi-timeline{max-width:900px;margin:30px auto}.rafi-timeline-heading{margin-bottom:16px}
.rafi-profile-post-card{margin-bottom:20px}
.rafi-profile-post-media img,.rafi-profile-post-media video{display:block;width:100%;max-height:650px;object-fit:contain;margin-top:15px}
.rafi-post-summary{display:flex;gap:18px;padding:10px 0;color:#667085}
.rafi-comments-area{margin-top:12px}.rafi-empty-timeline,.rafi-profile-login,.rafi-profile-error{padding:30px;text-align:center;background:#f7f9fc;border-radius:12px}
/* ==========================================================
   RaFi Profile - Edit Profile Design
   Add this at the END of:
   includes/profile/assets/css/profile.css
   ========================================================== */

.rafi-profile-edit-wrap {
    margin: 18px 30px 28px;
}

.rafi-edit-profile-toggle {
    border: 0;
    background: #172b55;
    color: #fff;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 5px 16px rgba(23,43,85,.16);
    transition: .2s ease;
}

.rafi-edit-profile-toggle:hover {
    background: #0d6efd;
    transform: translateY(-1px);
}

.rafi-profile-edit-box {
    display: none;
    margin-top: 14px;
    padding: 24px;
    background: #f8fafc;
    border: 1px solid #e4e9f0;
    border-radius: 16px;
    box-shadow: 0 8px 28px rgba(15,23,42,.07);
}

.rafi-profile-edit-wrap.is-open .rafi-profile-edit-box {
    display: block;
}

.rafi-edit-header {
    margin-bottom: 20px;
}

.rafi-edit-header h3 {
    margin: 0 0 5px;
    font-size: 22px;
    color: #172033;
}

.rafi-edit-header p {
    margin: 0;
    color: #667085;
    font-size: 13px;
}

.rafi-edit-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.rafi-edit-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.rafi-edit-full {
    grid-column: 1 / -1;
}

.rafi-edit-field label {
    font-size: 13px;
    font-weight: 700;
    color: #344054;
}

.rafi-edit-field input[type="text"],
.rafi-edit-field input[type="email"],
.rafi-edit-field input[type="password"],
.rafi-edit-field input[type="file"],
.rafi-edit-field textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #d6dce5;
    background: #fff;
    border-radius: 9px;
    padding: 11px 12px;
    color: #172033;
    font-size: 14px;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.rafi-edit-field input:focus,
.rafi-edit-field textarea:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13,110,253,.10);
}

.rafi-edit-field textarea {
    resize: vertical;
    min-height: 115px;
    line-height: 1.6;
}

.rafi-edit-photo-row {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 76px;
}

.rafi-edit-preview img,
.rafi-edit-preview .rafi-custom-avatar {
    width: 76px !important;
    height: 76px !important;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #fff;
    box-shadow: 0 3px 12px rgba(15,23,42,.15);
}

.rafi-edit-photo-input {
    flex: 1;
}

.rafi-edit-photo-input input[type="file"] {
    padding: 8px;
}

.rafi-edit-photo-input small {
    display: block;
    margin-top: 5px;
    color: #98a2b3;
    font-size: 11px;
}

.rafi-password-section {
    margin-top: 22px;
    padding: 20px;
    background: #fff;
    border: 1px solid #e4e9f0;
    border-radius: 13px;
}

.rafi-password-heading {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
}

.rafi-password-icon {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eef4ff;
    border-radius: 9px;
    flex-shrink: 0;
}

.rafi-password-heading h4 {
    margin: 0 0 3px;
    font-size: 17px;
    color: #172033;
}

.rafi-password-heading p {
    margin: 0;
    color: #667085;
    font-size: 12px;
}

.rafi-password-note {
    margin: 10px 0 0;
    color: #667085;
    font-size: 12px;
}

.rafi-edit-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 18px;
}

.rafi-profile-save-btn {
    border: 0;
    border-radius: 10px;
    padding: 11px 20px;
    background: #0d6efd;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 5px 14px rgba(13,110,253,.20);
    transition: .2s ease;
}

.rafi-profile-save-btn:hover {
    background: #0b5ed7;
    transform: translateY(-1px);
}

@media (max-width: 700px) {
    .rafi-profile-edit-wrap {
        margin-left: 18px;
        margin-right: 18px;
    }

    .rafi-profile-edit-box {
        padding: 16px;
    }

    .rafi-edit-grid {
        grid-template-columns: 1fr;
    }

    .rafi-edit-full {
        grid-column: auto;
    }

    .rafi-edit-footer {
        justify-content: stretch;
    }

    .rafi-profile-save-btn {
        width: 100%;
    }
}
/* ==========================================================
   My Posts Profile Avatar
   ========================================================== */

.rafi-profile-post-avatar-wrap {
    width: 48px;
    height: 48px;
    min-width: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 50%;
    flex-shrink: 0;
}

.rafi-profile-post-avatar-wrap img,
.rafi-profile-post-avatar-wrap .rafi-custom-avatar,
.rafi-profile-post-avatar-wrap .rafi-profile-post-avatar {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px;
    min-height: 48px;
    max-width: 48px;
    max-height: 48px;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.rafi-profile-post-author {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.rafi-profile-post-author-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
/* ==========================================================
   Profile Bottom Navigation
   Home + Edit Profile
   ========================================================== */

.rafi-profile-edit-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 18px 30px 28px;
}

/* Home button */
.rafi-profile-edit-wrap > a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    box-sizing: border-box;

    padding: 10px 16px;
    border-radius: 10px;

    background: #eef3f9;
    color: #172b55;

    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;

    border: 1px solid #e0e7f0;

    transition:
        background .2s ease,
        color .2s ease,
        transform .2s ease,
        box-shadow .2s ease;
}

.rafi-profile-edit-wrap > a:hover {
    background: #e4ebf5;
    color: #0d6efd;
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(15,23,42,.10);
}

/* Edit Profile button */
.rafi-edit-profile-toggle {
    min-height: 42px;
    box-sizing: border-box;

    padding: 10px 16px;
    border-radius: 10px;

    font-size: 14px;
    font-weight: 700;
    line-height: 1;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    margin: 0;
}
/* ==========================================================
   Profile Navigation Buttons
   Home + Edit Profile
   ========================================================== */

.rafi-profile-edit-wrap {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    flex-wrap: wrap !important;
}

/* HOME BUTTON */
.rafi-profile-edit-wrap a {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;

    height: 42px !important;
    min-width: 128px !important;
    box-sizing: border-box !important;

    padding: 0 16px !important;
    margin: 0 !important;

    border: 1px solid #e1e7ef !important;
    border-radius: 10px !important;

    background: #f3f6fa !important;
    color: #172b55 !important;

    font-size: 14px !important;
    font-weight: 700 !important;
    line-height: 1 !important;

    text-decoration: none !important;

    transition: all .2s ease !important;
}

.rafi-profile-edit-wrap a:hover {
    background: #e8eef7 !important;
    color: #0d6efd !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 5px 14px rgba(15,23,42,.10) !important;
}

/* EDIT PROFILE BUTTON */
.rafi-profile-edit-wrap .rafi-edit-profile-toggle {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;

    height: 42px !important;
    min-width: 128px !important;
    box-sizing: border-box !important;

    padding: 0 16px !important;
    margin: 0 !important;

    border-radius: 10px !important;

    font-size: 14px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
}

/* Mobile */
@media (max-width: 700px) {

    .rafi-profile-edit-wrap {
        gap: 8px !important;
    }

    .rafi-profile-edit-wrap a,
    .rafi-profile-edit-wrap .rafi-edit-profile-toggle {
        min-width: 115px !important;
        height: 40px !important;
        padding: 0 13px !important;
        font-size: 13px !important;
    }
}
/* Keep both buttons visually equal */
.rafi-profile-edit-wrap > a,
.rafi-profile-edit-wrap .rafi-edit-profile-toggle {
    min-width: 128px;
}

/* Mobile */
@media (max-width: 700px) {

    .rafi-profile-edit-wrap {
        margin-left: 18px;
        margin-right: 18px;
        gap: 8px;
    }

    .rafi-profile-edit-wrap > a,
    .rafi-profile-edit-wrap .rafi-edit-profile-toggle {
        min-width: 115px;
        min-height: 40px;
        padding: 9px 13px;
        font-size: 13px;
    }
}
/* নিজের Profile-এর Edit Profile button উপরে ও বামে আনা */

.rafi-profile-edit-wrap {

    margin-top: -25px !important;
    margin-left: -20px !important;

}
.rafi-post-professional-title {
    font-size: 12px;
    line-height: 1.35;
    color: #64748b;
    font-weight: 400;
    margin-top: 1px;
    margin-bottom: 1px;
}
.rafi-profile-left-panel .rafi-professional-title {
    display: block !important;
    position: relative !important;
    left: 30px !important;
}


/* ==========================================================
   RaFi Profile - MOBILE NAME / COVER FINAL
   Keep full name on one line when it fits
   ========================================================== */

@media (max-width: 700px) {

    .rafi-profile {
        overflow: visible !important;
    }

    .rafi-user-name {
        width: calc(100% - 36px) !important;
        max-width: none !important;
        margin-left: 18px !important;
        margin-right: 18px !important;
        margin-top: -3px !important;
        white-space: nowrap !important;
    }

    .rafi-user-name h1,
    .rafi-user-name h2,
    .rafi-user-name strong,
    .rafi-user-name .rafi-profile-name {
        display: block !important;
        width: 100% !important;
        max-width: none !important;
        white-space: nowrap !important;
        overflow: visible !important;
        text-overflow: clip !important;
        word-break: normal !important;
        font-size: clamp(22px, 6.2vw, 30px) !important;
        letter-spacing: -0.3px !important;
    }

    /* Keep the cover positioned a little further left so the portrait
       remains visible without changing the cover height. */
    .rafi-profile-cover > img {
        object-position: 34% center !important;
    }
}

@media (max-width: 420px) {

    .rafi-user-name {
        margin-left: 18px !important;
        margin-right: 18px !important;
        width: calc(100% - 36px) !important;
    }

    .rafi-user-name h1,
    .rafi-user-name h2,
    .rafi-user-name strong,
    .rafi-user-name .rafi-profile-name {
        font-size: 21px !important;
    }

    .rafi-profile-cover > img {
        object-position: 34% center !important;
    }
}


/* Hide profile posts when the requested profile is unavailable/deactivated. */
body:has(.rafi-profile-error) .rafi-profile-post-card {
    display: none !important;
}


/* ==========================================================
   RaFi Profile - Direct Profile Picture Preview / Position
   ========================================================== */
.rafi-avatar-adjust-box {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    width: min(420px, calc(100vw - 40px));
    margin: 10px 0 0 30px;
    padding: 12px;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid #dbe3ee;
    border-radius: 14px;
    box-shadow: 0 6px 20px rgba(15,23,42,.08);
}

.rafi-avatar-adjust-preview {
    flex: 0 0 86px;
}

.rafi-avatar-adjust-circle {
    width: 86px;
    height: 86px;
    overflow: hidden;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 3px 12px rgba(15,23,42,.15);
    background: #eef2f7;
}

.rafi-avatar-adjust-circle img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rafi-avatar-adjust-controls {
    flex: 1;
    min-width: 0;
}

.rafi-avatar-adjust-controls label {
    display: block;
    margin: 0 0 4px;
    color: #344054;
    font-size: 12px;
    font-weight: 700;
}

.rafi-avatar-adjust-controls input[type="range"] {
    width: 100%;
    margin: 0 0 9px;
}

.rafi-avatar-adjust-buttons {
    display: flex;
    gap: 8px;
    margin-top: 3px;
}

.rafi-avatar-save-btn,
.rafi-avatar-cancel-btn {
    border-radius: 9px;
    padding: 8px 13px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.rafi-avatar-save-btn {
    border: 0;
    background: #365eaa;
    color: #fff;
}

.rafi-avatar-cancel-btn {
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #334155;
}

@media (max-width: 700px) {
    .rafi-avatar-adjust-box {
        margin-left: 18px;
        margin-right: 18px;
        width: calc(100% - 36px);
    }
}

/* ==========================================================
   RaFi Profile - Cover Picture Preview / Position / Save
   Cover only. Profile picture behavior remains unchanged.
   ========================================================== */
.rafi-cover-adjust-box {
    display: none;
    position: absolute;
    left: 20px;
    bottom: 18px;
    z-index: 100001;
    width: min(330px, calc(100% - 40px));
    padding: 10px 12px;
    box-sizing: border-box;
    background: rgba(255,255,255,.97);
    border: 1px solid #dbe3ee;
    border-radius: 12px;
    box-shadow: 0 8px 22px rgba(15,23,42,.18);
}

.rafi-cover-adjust-controls label {
    display: block;
    margin: 0 0 3px;
    color: #344054;
    font-size: 11px;
    font-weight: 700;
}

.rafi-cover-adjust-controls input[type="range"] {
    width: 100%;
    display: block;
    margin: 0 0 7px;
}

.rafi-cover-adjust-buttons {
    display: flex;
    gap: 7px;
    margin-top: 3px;
}

.rafi-cover-save-btn,
.rafi-cover-cancel-btn {
    border-radius: 8px;
    padding: 7px 11px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.rafi-cover-save-btn {
    border: 0;
    background: #365eaa;
    color: #fff;
}

.rafi-cover-cancel-btn {
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #334155;
}

@media (max-width: 700px) {
    .rafi-cover-adjust-box {
        left: 18px;
        bottom: 16px;
        width: calc(100% - 36px);
    }
}


/* ==========================================================
   RaFi Profile - Mobile UI Fix v2
   Corrected: CSS only. Desktop remains unchanged.
   ========================================================== */

@media (max-width: 700px) {

    .rafi-profile {
        overflow: visible !important;
    }

    .rafi-profile .rafi-user-name {
        margin-top: 2px !important;
        margin-bottom: 2px !important;
        line-height: 1.1 !important;
    }

    .rafi-profile .rafi-profile-actions {
        gap: 5px !important;
        padding: 3px 18px !important;
        flex-wrap: nowrap !important;
    }

    .rafi-profile .rafi-profile-stats {
        gap: 5px !important;
        padding: 3px 18px 5px !important;
        flex-wrap: nowrap !important;
        overflow: hidden !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .rafi-profile .rafi-profile-stats span {
        flex: 0 0 auto !important;
        padding: 6px 7px !important;
        font-size: 11px !important;
        line-height: 1.15 !important;
        white-space: nowrap !important;
    }

    .rafi-profile .rafi-profile-description {
        padding: 0 18px 8px !important;
    }

    .rafi-profile .rafi-profile-edit-wrap {
        margin: 7px 18px 16px !important;
        padding: 0 !important;
    }

    .rafi-profile .rafi-edit-profile-toggle {
        margin: 0 !important;
    }

    /* Keep account/security control in normal flow and prevent overlap. */
    .rafi-profile .rafi-account-security-toggle {
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }
}

@media (max-width: 420px) {

    .rafi-profile .rafi-user-name {
        font-size: 25px !important;
        margin-top: 0 !important;
        margin-bottom: 1px !important;
    }

    .rafi-profile .rafi-profile-stats {
        gap: 4px !important;
        padding-left: 18px !important;
        padding-right: 18px !important;
    }

    .rafi-profile .rafi-profile-stats span {
        padding: 5px 6px !important;
        font-size: 10.5px !important;
    }

    .rafi-profile .rafi-profile-edit-wrap {
        margin-left: 18px !important;
        margin-right: 18px !important;
    }
}


/* ==========================================================
   RaFi Profile - Mobile Avatar/Name Gap Fix v3
   Only reduces the blank space between avatar and name.
   Biography and lower sections keep their current position.
   ========================================================== */
@media (max-width: 700px) {

    .rafi-profile .rafi-profile-layout {
        margin-top: 0 !important;
    }

    /* Keep Biography where it is, while the profile identity
       block moves upward with the name/title/stats. */
    .rafi-profile .rafi-profile-bio-panel {
        margin-top: 20px !important;
    }
}

@media (max-width: 420px) {

    .rafi-profile .rafi-profile-layout {
        margin-top: 0 !important;
    }

    .rafi-profile .rafi-profile-bio-panel {
        margin-top: 20px !important;
    }
}


/* ==========================================================
   RaFi Profile - Mobile Gap Balance Fix v4
   Based on v3. Only mobile vertical spacing is adjusted.
   ========================================================== */
@media (max-width: 700px) {

    /* Main remaining gap: stats row -> Biography. */
    .rafi-profile .rafi-profile-layout {
        row-gap: 7px !important;
    }

    /* Keep the Biography heading close to the stats row. */
    .rafi-profile .rafi-profile-bio-heading {
        margin-top: 0 !important;
        margin-bottom: 6px !important;
    }

    /* Keep the biography box compact and the buttons separated cleanly. */
    .rafi-profile .rafi-profile-bio-box {
        margin-bottom: 0 !important;
    }

    .rafi-profile .rafi-profile-edit-wrap {
        margin-top: 7px !important;
    }
}

@media (max-width: 420px) {
    .rafi-profile .rafi-profile-layout {
        row-gap: 5px !important;
    }

    .rafi-profile .rafi-profile-bio-heading {
        margin-bottom: 5px !important;
    }
}


/* ==========================================================
   RaFi Profile - Mobile Final Spacing v5
   Light CSS-only adjustment based on the current v4.
   Desktop remains unchanged.
   ========================================================== */
@media (max-width: 700px) {

    /* Bring Biography closer to the stats row. */
    .rafi-profile .rafi-profile-bio-panel {
        margin-top: 20px !important;
    }

    /* Keep the lower controls comfortably separated from the bio box. */
    .rafi-profile .rafi-profile-edit-wrap {
        margin-top: 7px !important;
    }
}

@media (max-width: 420px) {

    .rafi-profile .rafi-profile-bio-panel {
        margin-top: 18px !important;
    }
}


/* ==========================================================
   RaFi Profile - FINAL Mobile Position Fix v7
   Removes the negative layout shift that caused the name/avatar overlap.
   Desktop remains unchanged.
   ========================================================== */
@media (max-width: 900px) {
    .rafi-profile .rafi-profile-layout {
        margin-top: 0 !important;
    }

    .rafi-profile .rafi-profile-bio-panel {
        margin-top: 20px !important;
    }
}

@media (max-width: 420px) {
    .rafi-profile .rafi-profile-layout {
        margin-top: 0 !important;
    }

    .rafi-profile .rafi-profile-bio-panel {
        margin-top: 18px !important;
    }
}


/* ==========================================================
   RaFi Profile Timeline - Smart See More
   Shows a short preview only when the post content is long.
   Short posts remain unchanged and do not show See more.
   ========================================================== */
.rafi-profile-post-content-wrap {
    position: relative;
}

.rafi-profile-post-content-inner {
    max-height: 4.95em;
    overflow: hidden;
    line-height: 1.65;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.rafi-profile-post-content-wrap.is-expanded .rafi-profile-post-content-inner {
    max-height: none;
    overflow: visible;
}

.rafi-profile-post-see-more {
    display: inline-block;
    margin: 4px 0 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: #0d6efd;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
    cursor: pointer;
}

.rafi-profile-post-see-more:hover {
    text-decoration: underline;
}
