/* ===============================================================
   KIAN RAYANEH PROFILE — بازطراحی هماهنگ با دیزاین سایت
   شیشه‌ای، دارک-آگاه (html[data-theme])، تاکید آبی سایت
   =============================================================== */

:root{
    --pr-card: rgba(255, 255, 255, .92);
    --pr-ink: #0f172a;
    --pr-muted: #64748b;
    --pr-line: rgba(15, 23, 42, .12);
    --pr-well: #f4f7fb;
    --pr-accent: var(--site-primary, #008be5);
    --pr-accent-2: var(--site-hover, #0072bc);
    --pr-accent-soft: rgba(0, 139, 229, .14);
    --pr-shadow: 0 18px 44px rgba(2, 6, 23, .12);
}

html[data-theme="dark"]{
    --pr-card: rgba(17, 27, 46, .88);
    --pr-ink: #f8fafc;
    --pr-muted: #94a3b8;
    --pr-line: rgba(255, 255, 255, .1);
    --pr-well: rgba(30, 41, 59, .55);
    --pr-accent: #38bdf8;
    --pr-accent-2: #0284c7;
    --pr-accent-soft: rgba(56, 189, 248, .16);
    --pr-shadow: 0 20px 48px rgba(0, 0, 0, .38);
}

.profile-wrapper{
    display: flex;
    gap: 20px;
    margin: 24px auto 48px;
    align-items: flex-start;
    max-width: 1180px;
}

/* سایدبار */
.profile-sidebar{
    width: 260px;
    background: var(--pr-card);
    -webkit-backdrop-filter: blur(18px) saturate(1.3);
    backdrop-filter: blur(18px) saturate(1.3);
    border: 1px solid var(--pr-line);
    border-radius: 18px;
    box-shadow: var(--pr-shadow);
    overflow: hidden;
    position: sticky;
    top: 90px;
}

.profile-user{
    padding: 26px 18px;
    text-align: center;
    background: linear-gradient(135deg, var(--pr-accent), var(--pr-accent-2));
    color: #fff;
}

.profile-user .avatar{
    width: 74px;
    height: 74px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .92);
    color: var(--pr-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    font-weight: bold;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}

.profile-user h3{
    margin: 0;
    font-size: 19px;
}

.profile-user span{
    display: block;
    margin-top: 6px;
    font-size: 13px;
    opacity: .9;
}

.profile-menu{
    margin: 0;
    padding: 0;
    list-style: none;
}

.profile-menu li{
    padding: 14px 18px;
    cursor: pointer;
    transition: .25s;
    font-size: 14px;
    font-weight: 600;
    border-bottom: 1px solid var(--pr-line);
    color: var(--pr-ink);
}

.profile-menu li:hover{
    background: var(--pr-accent-soft);
    padding-right: 26px;
}

.profile-menu li.active{
    background: var(--pr-accent-soft);
    color: var(--pr-accent);
    border-inline-start: 3px solid var(--pr-accent);
}

.profile-menu li a{
    display: block;
    color: inherit;
    text-decoration: none;
}

/* محتوا */
.profile-content{
    flex: 1;
    min-width: 0;
    background: var(--pr-card);
    -webkit-backdrop-filter: blur(18px) saturate(1.3);
    backdrop-filter: blur(18px) saturate(1.3);
    border: 1px solid var(--pr-line);
    border-radius: 18px;
    padding: 26px;
    box-shadow: var(--pr-shadow);
    min-height: 560px;
    color: var(--pr-ink);
}

.profile-page{
    display: none;
    animation: fadeProfile .35s ease;
}

.profile-page.active{
    display: block;
}

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

.profile-page h2{
    margin-bottom: 22px;
    font-size: 20px;
    font-weight: 800;
    color: var(--pr-ink);
    border-bottom: 1px solid var(--pr-line);
    padding-bottom: 12px;
}

/* آمار */
.stats-grid{
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.stat-card{
    background: linear-gradient(135deg, var(--pr-accent), var(--pr-accent-2));
    border-radius: 14px;
    padding: 22px;
    color: #fff;
    text-align: center;
    transition: .25s;
    box-shadow: 0 10px 24px rgba(0, 139, 229, .22);
}

.stat-card:hover{
    transform: translateY(-4px);
    box-shadow: 0 16px 32px rgba(0, 139, 229, .3);
}

.stat-card h3{
    font-size: 30px;
    margin: 0 0 8px;
}

.stat-card span{
    font-size: 13px;
    opacity: .95;
}

/* جدول‌ها */
.profile-table{
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
    background: transparent;
    font-size: 13px;
}

.profile-table th{
    background: var(--pr-well);
    color: var(--pr-ink);
    padding: 11px 13px;
    font-size: 12.5px;
    font-weight: 800;
    border-bottom: 1px solid var(--pr-line);
    text-align: right;
}

.profile-table td{
    padding: 11px 13px;
    border-bottom: 1px solid var(--pr-line);
    font-size: 13px;
    text-align: right;
    color: var(--pr-ink);
}

.profile-table tr:hover td{
    background: var(--pr-accent-soft);
}

/* کارت اطلاعات */
.info-card{
    background: var(--pr-well);
    border: 1px solid var(--pr-line);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 14px;
}

.info-card h3{
    margin: 0 0 16px;
    font-size: 16px;
    color: var(--pr-ink);
}

.info-grid{
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 16px;
}

.info-grid .form-group{
    margin-bottom: 0;
}

/* دکمه ذخیره */
.save-btn{
    background: linear-gradient(180deg, var(--pr-accent), var(--pr-accent-2));
    color: #fff;
    border: none;
    padding: 12px 26px;
    border-radius: 12px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: .25s;
    box-shadow: 0 10px 22px rgba(0, 139, 229, .26);
}

.save-btn:hover{
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(0, 139, 229, .34);
}

/* حالت خالی */
.empty-box{
    padding: 44px 18px;
    text-align: center;
    background: var(--pr-well);
    border: 2px dashed var(--pr-line);
    border-radius: 14px;
    color: var(--pr-muted);
    margin-top: 18px;
}

.empty-box i{
    font-size: 44px;
    display: block;
    margin-bottom: 16px;
    color: var(--pr-accent);
}

/* فیلدهای فرم داخل پروفایل */
.profile-content .form-group label{
    display: block;
    margin-bottom: 6px;
    font-weight: 700;
    font-size: 13px;
    color: var(--pr-ink);
}

.profile-content .form-group input,
.profile-content .form-group select,
.profile-content .form-group textarea{
    width: 100%;
    border: 1px solid var(--pr-line);
    border-radius: 12px;
    background: var(--pr-well);
    color: var(--pr-ink);
    font-family: inherit;
    font-size: 14px;
    padding: 11px 14px;
    transition: border-color .25s, box-shadow .25s;
    box-sizing: border-box;
}

.profile-content .form-group input:focus,
.profile-content .form-group select:focus,
.profile-content .form-group textarea:focus{
    outline: none;
    border-color: var(--pr-accent);
    box-shadow: 0 0 0 3px var(--pr-accent-soft);
}

/* ===== بنر ناقص بودن اطلاعات ===== */
#profileIncompleteBanner{
    background: linear-gradient(160deg, #1e1b4b 0%, #312e81 55%, #3b0764 100%);
    border: 1px solid #5b21b6;
    border-radius: 18px;
    padding: 26px 22px;
    text-align: center;
    color: #ddd6fe;
    margin: 24px auto 40px;
    max-width: 640px;
    box-shadow: 0 18px 44px rgba(59, 7, 100, .3);
}

#profileIncompleteBanner .pcb-title{
    color: #ddd6fe;
    font-size: 20px;
    font-weight: 900;
    margin-bottom: 10px;
}

#profileIncompleteBanner .pcb-sub{
    color: #a78bfa;
    font-size: 13.5px;
    line-height: 2;
}

#profileIncompleteBanner .pcb-btn{
    display: inline-block;
    margin-top: 16px;
    padding: 11px 26px;
    background: #1e1b4b;
    border: 1px solid #6d28d9;
    border-radius: 12px;
    color: #c4b5fd;
    font-weight: 800;
    text-decoration: none;
    transition: .25s;
}

#profileIncompleteBanner .pcb-btn:hover{
    background: #7c3aed;
    border-color: #7c3aed;
    color: #fff;
}

/* ===== ریسپانسیو ===== */
@media (max-width: 992px){
    .profile-wrapper{
        flex-direction: column;
        margin: 16px auto 40px;
    }
    .profile-sidebar{
        width: 100%;
        position: relative;
        top: auto;
    }
    .profile-menu{
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }
    .profile-menu li{
        text-align: center;
        padding: 13px 10px;
        border-inline-start: 0;
    }
    .profile-menu li.active{
        border-inline-start: 0;
        border-bottom: 2px solid var(--pr-accent);
    }
    .profile-content{
        width: 100%;
        padding: 18px;
    }
    .stats-grid{
        grid-template-columns: repeat(2, 1fr);
    }
    .profile-user{
        padding: 20px 16px;
    }
    .profile-user .avatar{
        width: 60px;
        height: 60px;
        font-size: 28px;
    }
}

@media (max-width: 768px){
    .profile-content{
        padding: 16px;
    }
    .profile-page h2{
        font-size: 18px;
    }
    .profile-menu{
        grid-template-columns: 1fr;
    }
    .stats-grid{
        grid-template-columns: 1fr;
    }
    .profile-table{
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    .info-grid{
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px){
    .profile-content{
        padding: 14px;
    }
    .stat-card{
        padding: 16px;
    }
    .stat-card h3{
        font-size: 24px;
    }
    .profile-user h3{
        font-size: 16px;
    }
    #profileIncompleteBanner{
        padding: 20px 16px;
    }
    #profileIncompleteBanner .pcb-title{
        font-size: 17px;
    }
}

/* ===== kr-account-tiles: چینش حساب کاربری به سبک کاشی‌های آیکونی ===== */
/* سایدبار به نوار باریک افقی تبدیل می‌شود */
.profile-sidebar{
    width: 100% !important;
    position: static !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
}

.profile-wrapper{ gap: 12px; margin-top: 16px; }

.profile-user{
    display: flex !important;
    align-items: center !important;
    gap: 14px;
    text-align: right;
    padding: 14px 16px !important;
    background: var(--pr-card) !important;
    border: 1px solid var(--pr-line) !important;
    border-radius: 16px;
    color: var(--pr-ink) !important;
}

.profile-user .avatar{ width: 52px !important; height: 52px !important; margin: 0 !important; font-size: 24px !important; }
.profile-user h3{ font-size: 16px !important; text-align: right; }
.profile-user span{ margin-top: 3px !important; font-size: 12.5px !important; text-align: right; }

/* منو: کاشی‌های افقی آیکونی */
.profile-menu{ display: flex !important; flex-wrap: wrap; gap: 8px; }
.profile-menu li{
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    width: calc(25% - 6px) !important;
    background: var(--pr-card) !important;
    border: 1px solid var(--pr-line) !important;
    border-radius: 12px !important;
    padding: 12px 14px !important;
    font-size: 13.5px !important;
    color: var(--pr-muted) !important;
    box-sizing: border-box !important;
}
.profile-menu li:hover{ background: var(--pr-accent-soft) !important; padding-right: 14px !important; color: var(--pr-accent) !important; }
.profile-menu li.active{ background: var(--pr-accent-soft) !important; color: var(--pr-accent) !important; border-inline-start: 3px solid var(--pr-accent) !important; }

.profile-content{ border-radius: 16px !important; padding: 22px !important; }
.profile-page h2{ font-size: 17px !important; }

@media (max-width: 992px){
    .profile-menu li{ width: calc(50% - 4px) !important; }
    .profile-user .avatar{ width: 44px !important; height: 44px !important; font-size: 20px !important; }
    .profile-user h3{ font-size: 14.5px !important; }
}
@media (max-width: 480px){
    .profile-menu li{ width: 100% !important; }
}
/* بنر و محتوا ستونی */
.profile-wrapper{ flex-direction: column !important; }
#profileIncompleteBanner{ width: 100% !important; box-sizing: border-box; order: -1; }

.profile-wrapper{ align-items: stretch !important; }
.profile-content{ width: 100% !important; }


/* ===== kr-tiles-colorful: تم رنگی و کلفت برای کاشی‌های حساب ===== */
@media (max-width: 992px){ }
.profile-menu li{
    padding: 15px 16px !important;
    border-radius: 16px !important;
    border-width: 2px !important;
    font-size: 14px !important;
    font-weight: 800 !important;
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease !important;
}

/* داشبورد — آبی */
.profile-menu li:nth-child(1){
    background: rgba(0, 139, 229, .1) !important;
    border-color: rgba(0, 139, 229, .35) !important;
    color: #0069c0 !important;
}
.profile-menu li:nth-child(1):hover{ box-shadow: 0 8px 20px rgba(0, 139, 229, .3) !important; }

/* سفارش‌های من — سبز */
.profile-menu li:nth-child(2){
    background: rgba(16, 185, 129, .1) !important;
    border-color: rgba(16, 185, 129, .35) !important;
    color: #059669 !important;
}
.profile-menu li:nth-child(2):hover{ box-shadow: 0 8px 20px rgba(16, 185, 129, .3) !important; }

/* تیکت‌ها — کهربایی */
.profile-menu li:nth-child(3){
    background: rgba(245, 158, 11, .12) !important;
    border-color: rgba(245, 158, 11, .4) !important;
    color: #b45309 !important;
}
.profile-menu li:nth-child(3):hover{ box-shadow: 0 8px 20px rgba(245, 158, 11, .32) !important; }

/* علاقه‌مندی‌ها — صورتی */
.profile-menu li:nth-child(4){
    background: rgba(244, 63, 94, .1) !important;
    border-color: rgba(244, 63, 94, .35) !important;
    color: #e11d48 !important;
}
.profile-menu li:nth-child(4):hover{ box-shadow: 0 8px 20px rgba(244, 63, 94, .3) !important; }

/* اطلاعات حساب — بنفش */
.profile-menu li:nth-child(5){
    background: rgba(139, 92, 246, .1) !important;
    border-color: rgba(139, 92, 246, .35) !important;
    color: #7c3aed !important;
}
.profile-menu li:nth-child(5):hover{ box-shadow: 0 8px 20px rgba(139, 92, 246, .3) !important; }

/* خروج — قرمز */
.profile-menu li:nth-child(6){
    background: rgba(239, 68, 68, .1) !important;
    border-color: rgba(239, 68, 68, .4) !important;
    color: #dc2626 !important;
}
.profile-menu li:nth-child(6):hover{ box-shadow: 0 8px 20px rgba(239, 68, 68, .32) !important; }

/* حالت دارک: رنگ‌های روشن‌تر */
html[data-theme="dark"] .profile-menu li:nth-child(1){ background: rgba(56, 189, 248, .14) !important; border-color: rgba(56, 189, 248, .4) !important; color: #7dd3fc !important; }
html[data-theme="dark"] .profile-menu li:nth-child(2){ background: rgba(52, 211, 153, .14) !important; border-color: rgba(52, 211, 153, .4) !important; color: #34d399 !important; }
html[data-theme="dark"] .profile-menu li:nth-child(3){ background: rgba(251, 191, 36, .14) !important; border-color: rgba(251, 191, 36, .45) !important; color: #fbbf24 !important; }
html[data-theme="dark"] .profile-menu li:nth-child(4){ background: rgba(251, 113, 133, .14) !important; border-color: rgba(251, 113, 133, .4) !important; color: #fb7185 !important; }
html[data-theme="dark"] .profile-menu li:nth-child(5){ background: rgba(251, 113, 133, .14) !important; border-color: rgba(251, 113, 133, .4) !important; color: #fb7185 !important; }
html[data-theme="dark"] .profile-menu li:nth-child(6){ background: rgba(248, 113, 113, .14) !important; border-color: rgba(248, 113, 113, .45) !important; color: #f87171 !important; }


/* دکمه آدرس بنر هم کلفت‌تر */
#profileIncompleteBanner .pcb-btn{ padding: 12px 30px !important; border-radius: 14px !important; border-width: 2px !important; font-size: 14px !important; }

/* ===== kr-info-rows: اطلاعات حساب به‌صورت ردیف تمیز ===== */
.kr-info-grid{ display:grid; grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); gap:12px; }
.kr-info-row{ display:flex; align-items:center; gap:12px; background:var(--pr-well); border:1px solid var(--pr-line); border-radius:12px; padding:12px 14px; }
.kr-ico{ flex:0 0 36px; width:36px; height:36px; display:flex; align-items:center; justify-content:center; background:var(--pr-accent-soft); border-radius:10px; font-size:16px; }
.kr-info-txt{ display:flex; flex-direction:column; gap:2px; min-width:0; }
.kr-lbl{ font-size:11.5px; color:var(--pr-muted); font-weight:700; }
.kr-info-txt b{ font-size:13.5px; color:var(--pr-ink); word-break:break-word; }
.kr-addr-card{ padding:14px; background:var(--pr-well); border:1px solid var(--pr-line); border-radius:12px; line-height:2; color:var(--pr-ink); font-size:13px; }
.kr-addr-type{ font-weight:800; margin-bottom:4px; }
.kr-addr-type-blue{ color:var(--pr-accent); }
.kr-addr-type-violet{ color:#a78bfa; }
@media(max-width:600px){ .kr-info-grid{ grid-template-columns:1fr; } }

/* ===== kr-readonly-polish: فیلدهای نمایشی اطلاعات حساب تمیز و هماهنگ ===== */
.profile-content input[readonly], .info-card input[readonly]{
    background: var(--pr-well) !important;
    border: 1px solid var(--pr-line) !important;
    color: var(--pr-ink) !important;
    border-radius: 12px !important;
    height: 46px !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
}
.info-card input[readonly][style*="color:#94a3b8"]{ color: var(--pr-muted) !important; }

/* ===== kr-address-tidy: مرتب‌سازی آکاردئون آدرس‌ها و دکمه‌های حساب ===== */
@media (min-width: 993px){ .profile-content div[style*="margin-top:25px"][style*="display:flex"]{ display:grid !important; grid-template-columns:1fr 1fr !important; gap:10px !important; } }
.profile-content .modern-btn.btn-auth-submit{ height:46px !important; min-height:46px !important; border-radius:12px !important; font-size:13.5px !important; width:auto !important; padding:0 22px !important; }
.profile-content .addr-acc{ border:1px solid var(--pr-line) !important; border-radius:12px !important; margin-bottom:12px !important; background:var(--pr-card) !important; overflow:hidden; }
.profile-content .addr-acc-head{ background:var(--pr-well) !important; color:var(--pr-ink) !important; padding:12px 16px !important; }
.profile-content .addr-acc-body{ padding:16px !important; }
.profile-content .addr-acc .modern-btn{ background:linear-gradient(180deg,var(--pr-accent),var(--pr-accent-2)) !important; }

/* ===== kr-address-btn-small: دکمه‌های آدرس کوچک ===== */
.profile-content #addressesEmbedHost .modern-btn{ width:auto !important; min-width:0 !important; max-width:280px !important; height:38px !important; min-height:34px !important; padding:6px 18px !important; font-size:13px !important; border-radius:10px !important; display:inline-block !important; }
.profile-content .addr-acc-body .form-group:last-of-type{ margin-bottom:0; }
.profile-content .addr-acc-body{ text-align:right; }

/* ===== kr-hide-add-second: دکمه افزودن آدرس دوم حذف شد ===== */

/* ===== ویرایش فیلدبه‌فیلد اطلاعات حساب ===== */
.kr-fields{
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 14px;
}

.kr-field{
    background: var(--pr-card);
    border: 1px solid var(--pr-line);
    border-radius: 10px;
    padding: 9px 13px;
}

.kr-field-row{
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.kr-field-label{
    font-weight: 800;
    font-size: 12.5px;
    color: var(--pr-ink);
    min-width: 150px;
}

.kr-field-value{
    flex: 1;
    min-width: 150px;
    color: var(--pr-ink);
    font-weight: 600;
    font-size: 13.5px;
    word-break: break-word;
}

.kr-field-value.is-muted{
    color: var(--pr-muted);
    font-weight: 500;
}

.kr-edit-btn{
    background: var(--pr-accent-soft);
    color: var(--pr-accent);
    border: 1px solid var(--pr-accent);
    border-radius: 999px;
    padding: 4px 12px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: .2s;
}

.kr-edit-btn:hover{
    background: var(--pr-accent);
    color: #fff;
}

.kr-field-form{
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--pr-line);
}

.kr-field-actions{
    margin-top: 10px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

@media (max-width: 600px){
    .kr-field-label{
        min-width: 100%;
    }
}


/* ===== kr-profile-mobile: بهبود نمای موبایل پروفایل ===== */
@media (max-width: 600px){

    .kr-field{ padding: 12px 14px; }

    .kr-field-row{
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .kr-field-label{ min-width: 0 !important; font-size: 12.5px; }
    .kr-field-value{ min-width: 0 !important; font-size: 13.5px; line-height: 1.9; }

    .kr-edit-btn{ align-self: flex-start; padding: 6px 14px; }

    .kr-field-actions{ flex-direction: column; }
    .kr-field-actions .modern-btn{ width: 100% !important; justify-content: center; }

    #addressesEmbedBox .addr-acc-head{
        flex-wrap: wrap;
        row-gap: 6px;
        padding: 12px 12px;
    }
    #addressesEmbedBox .addr-acc-head > span:first-child{ flex: 1 1 100%; font-size: 13px; }
    #addressesEmbedBox .acc-arrow{ margin-right: auto; }

    .info-card{ padding: 14px 12px; }

    .info-card > div > button.kr-edit-btn{
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    .kr-tx-item{ flex-direction: column; align-items: stretch; gap: 10px; }

    .kr-tx-filters{ gap: 6px; }
    .kr-tx-chip{ padding: 6px 12px; font-size: 12px; }
    .kr-tx-select{ width: 100%; margin-top: 8px; }
}
