/* ==========================================================================
   Croplod — Formal look (global)
   ظاهر رسمی و جدی برای تمام سرویس‌های اکوسیستم:
   گوشه‌های تیز، حاشیه‌های ظریف، فوکوس حرفه‌ای، تایپوگرافی منظم
   ========================================================================== */

/* ---------- Thin, tidy scrollbars ---------- */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb, rgba(100, 116, 139, 0.5)) transparent;
}
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background-color: var(--scrollbar-thumb, rgba(100, 116, 139, 0.5));
    border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover {
    background-color: var(--scrollbar-thumb, rgba(100, 116, 139, 0.75));
}
::-webkit-scrollbar-corner {
    background: transparent;
}

/* ---------- Sharp corners for shared components (all services) ---------- */
.account-card,
.stat-card,
.wallet-hero,
.auth-card,
.checkout-card,
.profile-card,
.pm-card,
.lib-card,
.plus-card,
.list-group {
    border-radius: 10px !important;
}

.btn,
.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-danger,
.btn-sm,
.btn-lg,
.btn-block {
    border-radius: 6px !important;
}

.list-item,
.soc-search-card,
.soc-search,
.post {
    border-radius: 8px !important;
}

.badge,
.chip,
.wallet-chip,
.soc-history-chip {
    border-radius: 4px !important;
}

.empty-state,
.empty-state-icon,
.account-sidebar-link {
    border-radius: 8px !important;
}

.account-header-action-btn {
    border-radius: 8px !important;
}

/* Modal panels: رسمی‌تر */
.profile-modal,
.confirm-modal,
.modal,
.modal-content {
    border-radius: 12px !important;
}

/* Cards inside feeds */
.soc-feed-card,
.soc-layout-main .account-card,
.soc-layout-side .account-card {
    border-radius: 10px !important;
}

/* ==========================================================================
   رسمی‌سازی: حاشیه‌ها و سطوح
   ========================================================================== */

/* کارت‌ها: حاشیه‌ی ظریف و مشخص به‌جای سایه‌ی سنگین */
.account-card,
.stat-card,
.wallet-hero,
.auth-card,
.checkout-card,
.profile-card,
.pm-card,
.lib-card,
.plus-card,
.list-group,
.soc-feed-card,
.post,
.settings-card,
.security-section {
    border: 1px solid var(--border-primary);
    box-shadow: var(--card-shadow);
}

/* فیلدهای فرم: حاشیه‌ی ثابت و واضح */
.form-input,
.form-select,
.form-textarea,
.auth-form .form-input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="search"],
select,
textarea {
    border: 1px solid var(--border-secondary) !important;
    background-color: var(--bg-input);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus,
.auth-form .form-input:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
    border-color: var(--color-primary-600) !important;
    box-shadow: 0 0 0 3px var(--focus-ring);
    outline: none;
}

/* ---------- دکمه‌ها: حالت رسمی ---------- */
.btn,
.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-danger {
    font-weight: var(--font-weight-semibold);
    letter-spacing: var(--letter-spacing-wide);
    transition: background-color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), color var(--transition-fast);
}
.btn:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-ghost:focus-visible,
.btn-danger:focus-visible,
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--color-primary-500);
    outline-offset: 2px;
}

/* لینک‌ها: زیرخط رسمی و محترمانه */
a {
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

/* ---------- تایپوگرافی رسمی ---------- */
h1, h2, h3, h4, h5, h6 {
    letter-spacing: var(--letter-spacing-tight);
    font-weight: var(--font-weight-bold);
}
.account-page-title,
.account-profile-name,
.hero-section h1,
.pm-greeting {
    letter-spacing: -0.02em;
}

/* عنوان‌های کارت: وزن و فاصله‌ی منظم */
.account-card-title,
.section-title,
.card-title {
    letter-spacing: var(--letter-spacing-normal);
}

/* متن‌های ثانویه: سلسله‌مراتب واضح */
.text-muted,
.account-page-subtitle,
.stat-card-label,
.info-row-label {
    letter-spacing: var(--letter-spacing-wide);
}

/* ---------- فوکوس کلی و دسترس‌پذیری ---------- */
::selection {
    background: var(--color-primary-600);
    color: #fff;
}

/* اسکرول‌بار هنگام فوکوس کیبوردی قابل مشاهده باشد */
:focus-visible {
    outline: 2px solid var(--color-primary-500);
    outline-offset: 2px;
}

/* ---------- Premium (رنگ طلایی فقط برای سرویس پریمیوم) ---------- */

/* Premium header avatar ring */
.account-header-avatar.premium-header-avatar {
    position: relative;
    box-shadow: 0 0 0 2px var(--bg-card, #fff), 0 0 14px 1px rgba(217, 119, 6, 0.55);
}

/* Premium avatar ring on posts/comments */
.post-avatar.premium-avatar,
.soc-avatar-mini.premium-avatar {
    position: relative;
    border-radius: 50%;
}

/* ---------- Premium upgrade CTA (رسمی‌تر و کم‌تر چشمک‌زن) ---------- */
.cr-upgrade-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #b45309 0%, #d97706 45%, #b45309 100%);
    color: #fff !important;
    font-weight: 700;
    font-size: 13.5px;
    border: none;
    border-radius: 6px;
    padding: 10px 20px;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 2px 10px -2px rgba(180, 83, 9, 0.5);
    transition: transform 150ms ease, box-shadow 150ms ease, filter 150ms ease;
}
.cr-upgrade-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px -2px rgba(180, 83, 9, 0.6);
    filter: brightness(1.04);
    color: #fff !important;
}
.cr-upgrade-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}
.cr-upgrade-btn-sm {
    padding: 7px 14px;
    font-size: 12.5px;
    border-radius: 6px;
}

/* Sidebar upgrade link */
.cr-upgrade-sidebar-link {
    background: linear-gradient(135deg, rgba(180,83,9,.12), rgba(217,119,6,.06)) !important;
    border: 1px solid rgba(180, 83, 9, 0.3);
    color: #b45309 !important;
    font-weight: 700 !important;
    margin: 2px 10px;
    width: calc(100% - 20px);
}
[data-theme="dark"] .cr-upgrade-sidebar-link {
    color: #fbbf24 !important;
    border-color: rgba(251, 191, 36, 0.3);
}
/* Premium badge chip */
.cr-premium-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: linear-gradient(135deg, #b45309, #d97706);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 4px;
}
.cr-premium-chip svg {
    width: 12px;
    height: 12px;
}


/* ---------- Premium profile hero: twinkle stars behind avatar ---------- */
.premium-profile-hero {
    position: relative;
    overflow: hidden;
}

.premium-profile-stars {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 0;
}

.premium-profile-stars i {
    position: absolute;
    display: block;
    width: 6px;
    height: 6px;
    background: #d97706;
    border-radius: 50%;
    box-shadow: 0 0 8px 1px rgba(217, 119, 6, 0.5);
    opacity: 0;
    animation: premium-star-twinkle 3.2s ease-in-out infinite;
}

.premium-profile-stars i:nth-child(1)  { top: 30%;  left: 38%; animation-delay: 0s; }
.premium-profile-stars i:nth-child(2)  { top: 22%;  left: 46%; animation-delay: .4s; }
.premium-profile-stars i:nth-child(3)  { top: 34%;  left: 55%; animation-delay: .8s; }
.premium-profile-stars i:nth-child(4)  { top: 40%;  left: 42%; animation-delay: 1.2s; }
.premium-profile-stars i:nth-child(5)  { top: 24%;  left: 52%; animation-delay: 1.6s; }
.premium-profile-stars i:nth-child(6)  { top: 28%;  left: 34%; animation-delay: 2.0s; }
.premium-profile-stars i:nth-child(7)  { top: 38%;  left: 60%; animation-delay: 2.4s; }
.premium-profile-stars i:nth-child(8)  { top: 18%;  left: 48%; animation-delay: .6s; }
.premium-profile-stars i:nth-child(9)  { top: 42%;  left: 50%; animation-delay: 1.0s; }
.premium-profile-stars i:nth-child(10) { top: 26%;  left: 62%; animation-delay: 1.4s; }
.premium-profile-stars i:nth-child(11) { top: 36%;  left: 30%; animation-delay: 1.8s; }
.premium-profile-stars i:nth-child(12) { top: 20%;  left: 40%; animation-delay: 2.2s; }

@keyframes premium-star-twinkle {
    0%, 100% { opacity: 0; transform: translateY(8px) scale(.6); }
    50%      { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==========================================================================
   ریسپانسیو رسمی: تایپوگرافی سیال برای موبایل
   ========================================================================== */
@media (max-width: 639px) {
    h1, .hero-section h1 {
        font-size: clamp(1.5rem, 5.5vw, 2.25rem);
        line-height: var(--line-height-tight);
    }
    h2 {
        font-size: clamp(1.25rem, 4.5vw, 1.875rem);
    }
    .account-page-title {
        font-size: clamp(1.125rem, 4vw, 1.5rem);
    }
}

/* جداول موبایل: سرستون چسبان هنگام اسکرول افقی */
.table-responsive table th {
    position: sticky;
    top: 0;
    z-index: 1;
}
/* FIX: header/sidebar formal overrides - ensure solid monochrome and sidebar over header */
.account-header {
    background-color: var(--bg-primary) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-bottom: 1px solid var(--border-subtle) !important;
}
.account-sidebar {
    background-color: var(--bg-primary) !important;
    z-index: 500 !important;
}
.account-sidebar-overlay {
    z-index: 400 !important;
}
/* FIX: icons explicit sizing - prevent unstyled (formal - handled in responsive) */
.account-sidebar-link-icon, .account-header-action-btn svg {
    width: 20px;
    height: 20px;
    display: block;
}
