.profile-page-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 15px;
}

@media (min-width: 900px) {
    .profile-page-layout {
        flex-direction: row;
        align-items: flex-start;
    }
    
    .profile-sidebar {
        flex: 1;
        min-width: 320px;
        max-width: 400px;
    }

    .connections-main {
        flex: 2;
        min-width: 500px;
    }
}

.profile-container {
    width: 100%;
    font-family: inherit;
}

.profile-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #e2e8f0;
}

.profile-card-header {
    display: flex;
    align-items: center;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 16px;
    margin-bottom: 16px;
}

.profile-card-header h2 {
    margin: 0;
    font-size: 18px;
    color: #1e293b;
    font-weight: 700;
}

/* Balance specific styles */
.balance-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.balance-amount {
    font-size: 36px;
    font-weight: 800;
    color: #0f172a;
    margin: 8px 0;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.balance-currency {
    font-size: 16px;
    color: #64748b;
    font-weight: 600;
}

.balance-status {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.balance-status.positive {
    background: #dcfce7;
    color: #047857;
}

.balance-status.negative {
    background: #fee2e2;
    color: #b91c1c;
}

.balance-status.warning {
    background: #fef9c3;
    color: #b45309;
}

/* Amadast Account details */
.account-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.detail-item {
    background: #f8fafc;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.detail-label {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 4px;
    font-weight: 600;
}

.detail-value {
    font-size: 15px;
    color: #0f172a;
    font-weight: 700;
}

/* Connection Items */
.connection-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 12px;
    transition: all 0.2s;
}

.connection-item:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.connection-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.connection-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px;
}

.connection-icon img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.connection-text h3 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
}

.connection-text p {
    margin: 0;
    font-size: 13px;
    color: #64748b;
}

.connection-action .btn-connect {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: 0.2s;
}

.btn-connect.connected {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.btn-connect.disconnected {
    background: #3fbd90;
    color: #fff;
}

.btn-connect.disconnected:hover {
    background: #08b274;
}

.btn-connect.manage {
    background: #fff;
    color: #08b274;
    border: 1px solid #9eecc1;
}
.btn-connect.manage:hover {
    background: #f1fcf5;
}

.charge-button {
    background: #10b981;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    margin-top: 12px;
    transition: 0.2s;
}

.charge-button:hover {
    background: #059669;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
}

/* Active profile page helpers (used with Tailwind markup) */
body {
    font-family: 'Vazirmatn', sans-serif;
    background-color: #f9fafb;
}

.profile-channel-btn {
    border: 1px solid #9eecc1;
    background: #f1fcf5;
    color: #08b274;
    font-size: 13px;
    font-weight: 700;
    border-radius: 999px;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.profile-channel-btn:hover {
    background: #d8f6e7;
    border-color: #7fdfb6;
    color: #069b63;
}

.platform-switch-wrap {
    position: relative;
    width: 48px;
    height: 26px;
    flex: 0 0 auto;
}

.platform-switch-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.platform-switch-track {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #cbd5e1;
    border: 1px solid #94a3b8;
    cursor: pointer;
    transition: background-color 0.22s ease, border-color 0.22s ease;
}

.platform-switch-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.35);
    transition: transform 0.22s ease;
}

.platform-switch-input:checked + .platform-switch-track {
    background: #3fbd90;
    border-color: #08b274;
}

.platform-switch-input:checked + .platform-switch-track::after {
    transform: translateX(22px);
}

.modal-content.profile-modal {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    box-shadow: 0 30px 70px rgba(15, 23, 42, 0.24);
    padding: 22px;
}

.settings-split-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 14px;
}

@media (min-width: 780px) {
    .settings-split-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.settings-panel {
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 14px;
    padding: 12px;
}

.settings-panel-title {
    margin: 0 0 6px 0;
    font-size: 14px;
    font-weight: 800;
    color: #0f172a;
}

.settings-panel-help {
    margin: 0 0 10px 0;
    font-size: 12px;
    color: #64748b;
    line-height: 1.6;
}

.settings-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.settings-toggle-label {
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.5;
}

.profile-modal-title {
    margin-bottom: 6px;
    text-align: center;
    font-size: 20px;
    font-weight: 800;
    color: #0f172a;
}

.profile-modal-subtitle {
    color: #64748b;
    font-size: 13px;
    margin-bottom: 14px;
    text-align: center;
    line-height: 1.9;
}

.profile-modal-hint {
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
    border: 1px solid #fed7aa;
    color: #9a3412;
    font-size: 12px;
    border-radius: 12px;
    padding: 10px 12px;
    line-height: 1.9;
    margin-bottom: 14px;
}

.profile-modal-label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: #08b275;
    font-weight: 700;
}

.profile-modal-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    margin-bottom: 12px;
    font-family: inherit;
    text-align: left;
    background: #fff;
}

.profile-modal-preview {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    font-size: 13px;
    color: #08b275;
    line-height: 1.9;
}

.profile-modal-actions {
    display: flex;
    gap: 10px;
}

/* Container & Modal Setup */
.channel-settings-modal {
    width: 100%;
    max-width: 460px; /* جایگزین عرض بزرگ قبلی */
    border-radius: 24px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08); /* سایه نرم‌تر و مدرن‌تر */
    padding: 32px 24px 24px;
    background: #ffffff;
    box-sizing: border-box;
    font-family: inherit;
    direction: rtl; /* راست‌چین کردن محتوا */
}

.channel-settings-modal .apple-modal-close-x {
    display: none;
}

/* Header Text */
.channel-settings-title {
    margin: 0 0 8px 0;
    text-align: right;
    font-size: 22px; /* منطقی شدن سایز عنوان */
    font-weight: 800;
    color: #111827;
}

.channel-settings-subtitle {
    margin: 0 0 24px 0;
    text-align: right;
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
    line-height: 1.5;
}

/* Sections Divider */
.channel-settings-section {
    border-top: 1px solid #f3f4f6;
    padding-top: 20px;
    margin-top: 20px;
}

.channel-settings-section-title {
    margin: 0 0 16px;
    font-size: 16px;
    font-weight: 700;
    color: #111827;
}

/* Input Fields - Channel ID */
.channel-input-shell {
    display: flex;
    align-items: center;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 14px;
    min-height: 52px; /* ارتفاع استاندارد به جای 64px */
    padding: 0 16px;
    gap: 12px;
    transition: all 0.2s ease;
}

.channel-input-shell:focus-within {
    border-color: #3fbd90;
    box-shadow: 0 0 0 2px rgba(63, 189, 144, 0.2);
    background: #ffffff;
}

.channel-input-field {
    flex: 1;
    border: 0;
    outline: none;
    background: transparent;
    font-family: inherit;
    font-size: 15px; /* به جای 30px */
    color: #374151;
    text-align: left;
    direction: ltr;
    width: 100%;
}

.channel-input-field::placeholder {
    color: #9ca3af;
}

.channel-input-side {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.channel-input-side-label {
    font-size: 14px;
    color: #4b5563;
    font-weight: 600;
}

/* Green Tick Icon */
.channel-input-side-ok {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3fbd90;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
}

/* Toggle Switch Row */
.channel-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.channel-toggle-switch-group {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.channel-toggle-state {
    min-width: 40px;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 999px;
    background: #e5e7eb;
    color: #4b5563;
}

.channel-toggle-state.is-on {
    background: #dcfce7;
    color: #08b274;
}

.channel-toggle-state.is-off {
    background: #e5e7eb;
    color: #4b5563;
}

.channel-toggle-text {
    font-size: 15px;
    color: #1f2937;
    font-weight: 600;
}

/* iOS Style Switch */
.caption-switch-wrap {
    position: relative;
    width: 52px; /* ابعاد استاندارد به جای 110px */
    height: 30px; 
    flex: 0 0 auto;
    direction: ltr; /* فیکس کردن انیمیشن سوییچ در حالت RTL */
}

.caption-switch-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

.caption-switch-track {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    border: 2px solid #d1d5db;
    background: #d1d5db;
    cursor: pointer;
    transition: all 0.3s ease;
}

.caption-switch-track::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
}

.caption-switch-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.caption-switch-input:checked + .caption-switch-track {
    border-color: #3fbd90;
    background: #3fbd90;
}

.caption-switch-input:checked + .caption-switch-track::before {
    content: '';
}

.caption-switch-input:checked + .caption-switch-track::after {
    transform: translateX(22px);
}

/* Replacement Text Box */
.channel-replacement-wrap {
    margin-top: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    background: #f9fafb;
    padding: 16px;
}

.channel-replacement-title-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    margin-bottom: 12px;
}

.channel-replacement-label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.channel-replacement-info {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1.5px solid #9ca3af;
    color: #6b7280;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: serif;
}

.channel-replacement-input {
    width: 100%;
    height: 46px; /* ارتفاع منطقی */
    border: 1px solid #d1d5db;
    border-radius: 12px;
    background: #ffffff;
    padding: 0 16px;
    font-family: inherit;
    font-size: 14px;
    color: #4b5563;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.channel-replacement-input:focus {
    outline: none;
    border-color: #3fbd90;
}

.channel-replacement-input::placeholder {
    color: #9ca3af;
}

/* Buttons */
.channel-settings-actions {
    display: flex;
    gap: 12px;
    margin-top: 28px;
}

.channel-btn {
    flex: 1;
    height: 48px; /* ارتفاع متعادل بجای 76px */
    border: 0;
    border-radius: 12px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s, background-color 0.2s;
    position: relative;
}

.channel-btn:hover {
    opacity: 0.9;
}

.channel-btn-muted {
    background: #f3f4f6;
    color: #4b5563;
}

.channel-btn-muted:hover {
    background: #e5e7eb;
}

.channel-btn-save {
    background: #3fbd90;
    color: #ffffff;
}

.channel-btn-save:hover {
    background: #08b274;
}

.channel-btn:disabled {
    cursor: not-allowed;
}

.channel-btn.is-loading {
    opacity: 0.88;
}

.channel-btn.is-loading::after {
    content: '';
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #fff;
    display: inline-block;
    vertical-align: middle;
    margin-inline-start: 8px;
    animation: channel-btn-spin 0.8s linear infinite;
}

@keyframes channel-btn-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Footer Note */
.channel-settings-footer-note {
    margin: 20px 0 0;
    text-align: center;
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}

/* Mobile Adjustments (دیگر نیازی به کدهای شلوغ برای موبایل نیست، همین‌ها کافیست) */
@media (max-width: 480px) {
    .channel-settings-modal {
        padding: 24px 16px;
        border-radius: 20px;
    }
}

@media (max-width: 900px) {
    .profile-page-layout {
        padding: 0 10px;
    }

    .balance-amount {
        font-size: 28px;
    }

    .connection-item {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .connection-action {
        width: 100%;
    }

    .connection-action .btn-connect {
        width: 100%;
        min-height: 44px;
    }
}

@media (max-width: 640px) {
    .profile-card {
        padding: 14px;
    }

    .account-details-grid {
        grid-template-columns: 1fr;
    }

    .connection-info {
        width: 100%;
    }

    .channel-settings-actions {
        flex-direction: column;
    }

    .channel-btn {
        width: 100%;
    }

    .channel-settings-modal {
        max-height: 90vh;
        overflow-y: auto;
    }
}