/* app.css - چاپار | چارچوب طراحی مشترک */

:root {
    --primary: #4361ee;
    --primary-dark: #3a56d4;
    --primary-light: #e6f0ff;
    --secondary: #f72585;
    --success: #4cc9f0;
    --warning: #f8961e;
    --error: #f72585;
    --light: #f8f9fa;
    --dark: #212529;
    --gray: #6c757d;
    --border: #e0e3e9;
    --bg: #f5f7fa;
    --surface: #fff;
    --surface-muted: #f9fafc;
    --surface-subtle: #f0f0f0;
    --radius: 12px;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.08);
}

/* ===== حالت تاریک ===== */
:root[data-theme="dark"] {
    --primary: #5b76f6;
    --primary-dark: #7188f7;
    --primary-light: #232c45;
    --secondary: #f54a97;
    --success: #4cc9f0;
    --warning: #f8961e;
    --error: #f54a97;
    --light: #1e232e;
    --dark: #e8eaf0;
    --gray: #9aa4b2;
    --border: #2b3140;
    --bg: #131722;
    --surface: #1a1f2b;
    --surface-muted: #202634;
    --surface-subtle: #262d3d;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
}

@font-face {
    font-family: 'AradVF';
    src: url("../font/arad.ttf") format("truetype");
    font-weight: normal;
    font-style: normal;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'AradVF', Tahoma, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    background-color: var(--bg);
    color: var(--dark);
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
}

input, textarea, select {
    font-size: 16px;
}

/* ===== کارت‌ها ===== */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
}

/* ===== فرم‌ها ===== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--dark);
    font-weight: 500;
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 0.85rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: var(--surface-muted);
    min-height: 44px;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
    background-color: var(--surface);
}

.form-control.is-invalid {
    border-color: var(--error);
}

.password-container {
    position: relative;
}

.password-container .form-control {
    padding-left: 2.6rem;
}

.toggle-password {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--gray);
    font-size: 1.1rem;
    touch-action: manipulation;
    z-index: 2;
}

.invalid-feedback {
    color: var(--error);
    font-size: 0.8rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.5rem;
    background: rgba(247, 37, 133, 0.05);
    border-radius: 4px;
}

/* ===== دکمه‌ها ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1.4rem;
    background-color: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 44px;
    text-align: center;
    user-select: none;
    touch-action: manipulation;
}

.btn:hover:enabled {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.2);
}

.btn:active:enabled {
    transform: scale(0.98);
}

.btn:disabled {
    background-color: #5a6268;
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-danger {
    background-color: var(--error);
}

.btn-danger:hover:enabled {
    background-color: #e5177a;
    box-shadow: 0 4px 12px rgba(247, 37, 133, 0.2);
}

.btn-warning {
    background-color: var(--warning);
    color: #fff;
}

.btn-warning:hover:enabled {
    background-color: #e08008;
    box-shadow: 0 4px 12px rgba(248, 150, 30, 0.2);
}

.btn-success {
    background-color: var(--success);
    color: #fff;
}

.btn-success:hover:enabled {
    background-color: #3ab4d4;
}

.btn-secondary {
    background-color: var(--gray);
}

.btn-secondary:hover:enabled {
    background-color: #5a6268;
    box-shadow: none;
}

.btn-small {
    padding: 0.5rem 0.9rem;
    font-size: 0.9rem;
    min-height: auto;
}

.btn-group {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* ===== هشدارها ===== */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-danger {
    color: var(--error);
    background-color: rgba(247, 37, 133, 0.08);
    border: 1px solid rgba(247, 37, 133, 0.2);
}

.alert-success {
    color: #0a7a5e;
    background-color: rgba(76, 201, 240, 0.1);
    border: 1px solid rgba(76, 201, 240, 0.25);
}

.alert-info {
    color: var(--warning);
    background-color: rgba(248, 150, 30, 0.1);
    border: 1px solid rgba(248, 150, 30, 0.2);
}

/* ===== مودال ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    padding: 1rem;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius);
    width: 100%;
    max-width: 450px;
    padding: 1.5rem;
    transform: translateY(-20px);
    transition: transform 0.3s;
    max-height: 90vh;
    overflow-y: auto;
}

.modal.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 500;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray);
    line-height: 1;
    padding: 0.25rem;
}

.modal-body {
    text-align: center;
}

.modal img, .modal video {
    max-width: 100%;
    max-height: 250px;
    margin-bottom: 0rem;
    border-radius: 8px;
}

/* ===== نمایشگر تصویر (لایت‌باکس) ===== */
.modal.image-viewer {
    background: rgba(0, 0, 0, 0.88);
    padding: 0;
    z-index: 1500;
}

.modal.image-viewer .modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    line-height: 1;
}

.modal.image-viewer .modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.modal.image-viewer img {
    max-width: 92vw;
    max-height: 92vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 0;
    margin: 0;
}

.modal-actions {
    margin-top: 1rem;
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
}

.modal-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    width: 100%;
    margin-bottom: 0.75rem;
}

/* ===== دیالوگ اعلان/تأیید چاپار (جایگزین alert/confirm بومی) ===== */
.modal.chapaar-dialog {
    z-index: 2000;
}

.modal.chapaar-dialog .modal-content {
    max-width: 380px;
    padding: 1.25rem 1.5rem;
}

.modal.chapaar-dialog .modal-header {
    margin-bottom: 0.75rem;
}

.modal.chapaar-dialog .modal-body {
    text-align: start;
}

.chapaar-dialog-text {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text);
}

.modal.chapaar-dialog .modal-actions {
    margin-top: 1.25rem;
    justify-content: flex-end;
}

.modal.chapaar-dialog .modal-actions .btn {
    min-width: 84px;
}

/* ===== صفحات مرکزی (ورود / ثب‌تام / پیام‌های ساده) ===== */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-container {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 460px;
    padding: 2rem;
    margin: auto;
}

.auth-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.auth-icon {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.auth-title {
    color: var(--dark);
    font-size: 1.6rem;
    font-weight: 700;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.95rem;
    color: var(--gray);
}

.auth-footer a {
    color: var(--primary);
    font-weight: 500;
}

.auth-footer a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ===== حالت خالی ===== */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--gray);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--border);
}

/* ===== افکت لودینگ برای تصاویر ===== */
.lazy-img {
    background-color: #f0f0f0;
    background-image: linear-gradient(45deg, #ececec 25%, transparent 25%),
        linear-gradient(-45deg, #ececec 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #ececec 75%),
        linear-gradient(-45deg, transparent 75%, #ececec 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

/* ===== اسکرول‌بار ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-thumb {
    background: #cbd2dd;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #b0b9c8;
}

::-webkit-scrollbar-track {
    background: transparent;
}

/* ===== رسپانسیو ===== */
@media (max-width: 768px) {
    .btn-group {
        flex-direction: column;
    }

    .auth-container {
        padding: 1.5rem;
    }
}

@media (max-width: 576px) {
    .auth-title {
        font-size: 1.4rem;
    }

    .auth-icon {
        font-size: 2.6rem;
    }
}


/* ===== Dashboard ===== */

.dashboard-container {
    display: flex;
    min-height: 100vh;
    direction: rtl;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--surface);
    border-left: 1px solid var(--border);
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    overflow-y: auto;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: .2s;
}

.user-profile:hover {
    background: var(--primary-light);
}

.user-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.user-meta {
    min-width: 0;
}

.user-name {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
}

.tick-icon {
    object-fit: contain;
    flex-shrink: 0;
}

/* Group button */
.new-group-btn {
    width: 100%;
}

/* Groups */
.groups-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.group-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 10px;
    transition: .2s;
}

.group-item:hover {
    background: var(--primary-light);
}

.group-icon {
    width: 25px;
    text-align: center;
}

.group-name {
    flex: 1;
}

/* Main */
.main-content {
    margin-right: 280px;
    flex: 1;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.welcome-section {
    text-align: center;
    max-width: 600px;
}

.welcome-icon img {
    width: 120px;
    height: 120px;
    object-fit: contain;
}

.welcome-title {
    margin-top: 1rem;
    font-size: 2rem;
}

.welcome-text {
    color: var(--gray);
    margin: 1rem 0 2rem;
}

.create-group-section {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.section-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: .9rem;
}

.group-form {
    display: flex;
    gap: 10px;
}

.group-form input {
    flex: 1;
    padding: .8rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.chat-type-select {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.chat-type-option {
    flex: 1;
}

.chat-type-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.chat-type-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: .6rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-size: .9rem;
    color: var(--gray);
    background: var(--surface-muted);
    transition: .2s;
    text-align: center;
}

.chat-type-option input:checked + .chat-type-label {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.chat-type-option:hover .chat-type-label {
    border-color: var(--primary);
}

.logout-link {
    display: inline-flex;
    gap: 8px;
    margin-top: 2rem;
    color: var(--error);
}


/* Mobile */
.mobile-menu-btn {
    display: none;
    background: var(--primary-light);
    color: var(--primary);
    border: none;
    border-radius: 10px;
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mobile-menu-btn:hover {
    background: var(--primary);
    color: #fff;
}

@media(max-width:768px) {

    .sidebar {
        transform: translateX(100%);
        transition: .3s;
        z-index: 100;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .mobile-menu-btn {
        display: flex;
        position: absolute;
        top: 8px;
        left: 12px;
    }

    .main-content {
        margin-right: 0;
    }

}

/* ===== اعلان سراسری (index.php) ===== */
.notice-banner-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 16px;
    flex-shrink: 0;
    max-height: 38vh;
    overflow-y: auto;
}

.notice-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.6rem 0.8rem;
    border-radius: 12px;
    border: 1px solid transparent;
    font-size: 0.82rem;
    line-height: 1.6;
    box-shadow: var(--shadow-sm);
    position: relative;
}

.notice-banner > i {
    flex-shrink: 0;
    margin-top: 3px;
}

.notice-banner span {
    min-width: 0;
    flex: 1;
    word-break: break-word;
}

.notice-dismiss {
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: inherit;
    opacity: 0.75;
    cursor: pointer;
    padding: 2px 6px;
    font-size: 0.8rem;
    border-radius: 6px;
    align-self: flex-start;
    margin-top: 1px;
    transition: opacity 0.15s, background 0.15s;
}

.notice-dismiss:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.1);
}

.notice-banner-notice {
    background: #e8f7ee;
    color: #1f7a43;
    border-color: #b8e3c6;
}

.notice-banner-info {
    background: #e8f0fe;
    color: #1a5bb8;
    border-color: #c0d6f5;
}

.notice-banner-warning {
    background: #fff4e0;
    color: #8a5a00;
    border-color: #f3dcae;
}

.notice-banner-error {
    background: #fdeceb;
    color: #b03027;
    border-color: #f3c1be;
}

:root[data-theme="dark"] .notice-banner-notice {
    background: #1d2b24;
    color: #7fd9a5;
    border-color: #2e4a3b;
}

:root[data-theme="dark"] .notice-banner-info {
    background: #1c2638;
    color: #7da8f2;
    border-color: #2d3f63;
}

:root[data-theme="dark"] .notice-banner-warning {
    background: #2e2719;
    color: #f0c26b;
    border-color: #4d3f22;
}

:root[data-theme="dark"] .notice-banner-error {
    background: #301c1d;
    color: #f0908a;
    border-color: #532d2d;
}

/* ===== Dashboard v2 (index.php) ===== */
.dash {
    display: flex;
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
    direction: rtl;
    overflow: hidden;
}

.dash-topbar {
    display: none;
}

.dash-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: var(--primary);
    font-size: 1.1rem;
}

.dash-side {
    width: 340px;
    background: var(--surface);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100%;
}

.dash-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    flex-shrink: 0;
}

.dash-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, .6);
    flex-shrink: 0;
    background: #fff;
}

.dash-profile-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.dash-username {
    font-weight: 700;
    font-size: .9rem;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    overflow: hidden;
}

.dash-fullname {
    font-size: .72rem;
    opacity: .85;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dash-profile-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.dash-profile-actions a {
    color: #fff;
    text-decoration: none;
    display: inline-flex;
}

.dash-settings {
    font-size: 1.05rem;
    opacity: .9;
    cursor: pointer;
}

.dash-search {
    position: relative;
    margin: 14px 16px 8px;
}

.dash-search i {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    color: var(--gray);
}

.dash-search input {
    width: 100%;
    padding: 11px 38px 11px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    font-size: .95rem;
}

.dash-search input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface);
}

.dash-actions {
    display: flex;
    gap: 8px;
    padding: 8px 16px 12px;
}

.dash-outline {
    background: var(--surface);
    color: var(--primary);
    border: 1px solid var(--primary);
}

.dash-outline:hover:enabled {
    background: var(--primary-light);
    color: var(--primary-dark);
    transform: none;
    box-shadow: none;
}

.dash-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 12px 12px;
}

.dash-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 6px 4px;
    font-size: .7rem;
    color: var(--gray);
    font-weight: 600;
}

.dash-section-count {
    background: var(--bg);
    padding: 1px 7px;
    border-radius: 999px;
    font-size: .66rem;
    color: var(--gray);
}

.dash-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 10px;
    transition: .15s;
}

.dash-item:hover {
    background: var(--primary-light);
}

.dash-item-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.dash-item-avatar-wrap {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
}

.dash-item-avatar-wrap .online-dot {
    position: absolute;
    bottom: 0;
    left: 0;
    border: 2px solid var(--bg);
    display: none;
}

.dash-item-avatar-wrap .online-dot.visible {
    display: block;
}

.online-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #2ecc71;
    display: inline-block;
}

.offline-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--gray);
    display: inline-block;
}

.dash-item-avatar-group {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--success), #3b86d4);
    color: #fff;
    font-size: .95rem;
}

.dash-item-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.dash-item-name {
    font-weight: 600;
    font-size: .95rem;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 4px;
}

.dash-item-preview {
    color: var(--gray);
    font-size: .85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-item-side {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.dash-item-time {
    font-size: .73rem;
    color: var(--gray);
    margin-top: 2px;
}

.dash-item-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    font-size: .73rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dash-item-delete {
    flex-shrink: 0;
    width: 0;
    height: 30px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--gray);
    font-size: .85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    overflow: hidden;
    margin-inline-start: -10px;
    transition: width .18s ease, opacity .18s ease, margin-inline-start .18s ease;
}

.dash-item:hover .dash-item-delete,
.dash-item-delete:focus-visible {
    width: 30px;
    opacity: 1;
    margin-inline-start: 0;
}

.dash-item-delete:hover {
    background: rgba(247, 37, 133, .12);
    color: var(--error);
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--gray);
    font-size: 1.05rem;
    padding: 6px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.theme-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .55rem .75rem;
    border-radius: 10px;
    background: var(--bg);
}

.theme-row-label {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: .9rem;
    color: var(--dark);
}

.theme-row-label i {
    color: var(--primary);
    width: 18px;
    text-align: center;
}

.switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch .slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 999px;
    cursor: pointer;
    transition: .2s;
}

.switch .slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: .2s;
}

.switch input:checked + .slider {
    background: var(--primary);
}

.switch input:checked + .slider::before {
    transform: translateX(20px);
}

.dash-empty {
    text-align: center;
    color: var(--gray);
    padding: 16px 8px;
    font-size: .9rem;
}

.dash-empty-link {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-weight: 600;
    margin-top: 6px;
    display: inline-block;
}

.dash-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    color: var(--gray);
    flex-shrink: 0;
}

.dash-logout {
    color: var(--error);
    font-size: 1.05rem;
    padding: 6px;
    border-radius: 8px;
}

.dash-logout:hover {
    background: rgba(247, 37, 133, .08);
}

.dash-main {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.welcome-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 0 0 1.5rem;
}

.welcome-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.4rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .7rem;
    cursor: pointer;
    transition: .2s;
    box-shadow: var(--shadow-sm);
}

.welcome-card i {
    font-size: 1.7rem;
    color: var(--primary);
}

.welcome-card span {
    font-weight: 600;
    color: var(--dark);
}

.welcome-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.chat-search-box {
    position: relative;
    margin-bottom: 12px;
}

.chat-search-box i {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    color: var(--gray);
}

.chat-search-box input {
    width: 100%;
    padding: .8rem 38px .8rem 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    background: var(--bg);
}

.chat-search-box input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface);
}

.chat-search-results {
    max-height: 60vh;
    overflow-y: auto;
}

.chat-search-hint {
    text-align: center;
    color: var(--gray);
    padding: 20px 10px;
    font-size: .9rem;
}

.chat-search-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 12px;
    cursor: pointer;
}

.chat-search-item:hover {
    background: var(--primary-light);
}

.chat-search-item > img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg);
}

.chat-search-item-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-search-item-name {
    font-weight: 600;
    color: var(--dark);
}

.chat-search-item .tick-icon {
    width: 18px;
    height: 18px;
    border-radius: 0;
    vertical-align: middle;
    margin-right: 3px;
}

.chat-search-item-full {
    font-size: .82rem;
    color: var(--gray);
}

/* رسپانسیو dashboards */
@media (max-width: 768px) {
    .dash {
        display: block;
        height: auto;
        min-height: 100vh;
    }

    .dash-side {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 82%;
        max-width: 340px;
        height: 100%;
        z-index: 100;
        transform: translateX(110%);
        transition: transform .3s ease;
        box-shadow: -4px 0 15px rgba(0, 0, 0, .12);
    }

    .dash-side.active {
        transform: translateX(0);
    }

    .dash-topbar {
        display: flex;
        align-items: center;
        height: 58px;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        padding: 0 16px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 50;
    }

    .dash-main {
        min-height: calc(100vh - 58px);
        margin-top: 58px;
        padding: 1.25rem;
    }

    .welcome-section {
        max-width: 100%;
        width: 100%;
    }

    .welcome-icon img {
        width: 90px;
        height: 90px;
    }

    .welcome-title {
        font-size: 1.6rem;
    }

    .welcome-text {
        margin: .8rem 0 1.5rem;
        font-size: .95rem;
    }

    .welcome-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .welcome-card {
        padding: 1.1rem .6rem;
    }

    .welcome-card i {
        font-size: 1.4rem;
    }
}

@media (max-width: 480px) {
    .group-form {
        flex-direction: column;
    }

    .group-form .btn {
        width: 100%;
    }
}

/* ===== مودال پروفایل (نسخه جدید) ===== */
.prof-modal .modal-body {
    padding: 1.25rem;
}

.prof-hero {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.prof-hero .profile-photo {
    position: relative;
    flex-shrink: 0;
}

.prof-hero .profile-photo-img {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
    border: 3px solid var(--primary-light);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.profile-photo-badge {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    border: 2px solid #fff;
}

.prof-title {
    min-width: 0;
}

.prof-title .profName {
    font-size: 1.25rem;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.profFullname {
    color: var(--gray);
    font-size: 0.95rem;
}

.prof-meta {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.prof-meta-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--gray);
    font-size: 0.9rem;
    background: var(--bg);
    padding: 0.55rem 0.75rem;
    border-radius: 10px;
}

.prof-meta-item i {
    color: var(--primary);
    width: 18px;
    text-align: center;
}

.prof-settings {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.settings-title {
    font-size: 1rem;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.25rem 0 0;
}

.settings-title i {
    color: var(--primary);
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.settings-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--dark);
}

.settings-row {
    display: flex;
    gap: 0.5rem;
}

.settings-row input,
.settings-group input {
    flex: 1;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
    outline: none;
    font-size: 0.9rem;
    background: var(--surface);
}

.settings-row input:focus,
.settings-group input:focus {
    border-color: var(--primary);
}

.settings-row .btn {
    flex-shrink: 0;
}

.settings-msg {
    font-size: 0.82rem;
    min-height: 1rem;
}

.settings-msg.ok {
    color: var(--success);
}

.settings-msg.err {
    color: var(--danger, #e74c3c);
}

/* لینک گفتگوی گروه (داخل پیام) */
.group-link {
    color: var(--primary);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* لوگو با دو نسخه (روشن/تیره): نسخه تیره برای تم روشن، نسخه سفید برای تم تیره */
.logo-day {
    display: inline;
}

.logo-night {
    display: none;
}

:root[data-theme="dark"] .logo-day {
    display: none;
}

:root[data-theme="dark"] .logo-night {
    display: inline;
}
/* ===== نشان حساب (user badge) ===== */
.user-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    color: #fff;
    border-radius: 8px;
    padding: 1px 7px;
    margin-right: 6px;
    vertical-align: middle;
    line-height: 1.7;
    font-weight: 700;
}
.user-badge.has-photo img {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    object-fit: cover;
    flex: none;
}
.user-badge > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 140px;
}

/* ===== تگ عضو گروه ===== */
.member-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    color: #fff;
    border-radius: 8px;
    padding: 1px 7px;
    margin-right: 6px;
    vertical-align: middle;
    line-height: 1.7;
    font-weight: 700;
}
.member-tag.has-photo img {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    object-fit: cover;
    flex: none;
}
.member-tag > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 140px;
}
