@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;700&display=swap');

:root {
    --gold: #D4AF37;
    --dark-gold: #B8860B;
    --black: #121212;
    --dark-gray: #1E1E1E;
    --light-gray: #2D2D2D;
    --white: #FFFFFF;
    --red: #FF4D4D;
    --green: #4CAF50;
    --orange: #FFA500;
    --blue: #2196F3;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Vazirmatn', sans-serif;
}

body {
    background-color: var(--black);
    color: var(--white);
    direction: rtl;
    overflow-x: hidden;
}

/* دایره طلایی شناور */
.floating-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--gold), var(--dark-gold));
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.4);
    z-index: 1000;
    animation: float 3s ease-in-out infinite;
}

.floating-button i {
    font-size: 24px;
    color: var(--black);
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

/* پنل پشتیبانی */
.support-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--dark-gray), var(--black));
    z-index: 999;
    display: none;
    flex-direction: column;
}

.panel-header {
    background: linear-gradient(90deg, var(--gold), var(--dark-gold));
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.panel-header h2 {
    color: var(--black);
    font-weight: 700;
    font-size: 1.2rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--black);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.close-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* بخش ورود */
.login-section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-form {
    width: 100%;
    max-width: 350px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.login-form input {
    width: 100%;
    padding: 15px;
    margin-bottom: 15px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    font-size: 16px;
    outline: none;
    transition: all 0.3s;
}

.login-form input:focus {
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 2px var(--gold);
}

.login-form button {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(90deg, var(--gold), var(--dark-gold));
    color: var(--black);
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.3s;
}

.login-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(212, 175, 55, 0.4);
}

.admin-login {
    background: transparent !important;
    color: var(--gold) !important;
    border: 1px solid var(--gold) !important;
}

/* لیست اپراتورها */
.operators-list {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.operators-list h3 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--gold);
}

.operator-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.operator-card:hover {
    background: rgba(212, 175, 55, 0.1);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.operator-card i {
    font-size: 24px;
    color: var(--gold);
    margin-left: 15px;
}

/* صفحه چت */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-header {
    background: linear-gradient(90deg, var(--gold), var(--dark-gold));
    padding: 15px 20px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.back-btn {
    background: none;
    border: none;
    color: var(--black);
    font-size: 20px;
    cursor: pointer;
    margin-left: 15px;
}

.chat-header h3 {
    color: var(--black);
    font-weight: 700;
    flex: 1;
    text-align: center;
}

.status-indicator {
    width: 12px;
    height: 12px;
    background: var(--green);
    border-radius: 50%;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.message {
    max-width: 80%;
    padding: 12px 15px;
    border-radius: 18px;
    margin-bottom: 15px;
    position: relative;
    word-wrap: break-word;
    animation: fadeIn 0.3s;
}

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

.user-message {
    background: linear-gradient(90deg, var(--gold), var(--dark-gold));
    color: var(--black);
    align-self: flex-end;
    border-bottom-right-radius: 5px;
}

.admin-message {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    align-self: flex-start;
    border-bottom-left-radius: 5px;
}

.system-message {
    align-self: center;
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    text-align: center;
    font-size: 14px;
    padding: 8px 15px;
    border-radius: 20px;
    max-width: 90%;
}

.account-message {
    background: var(--red);
    color: white;
    align-self: flex-start;
    border-bottom-left-radius: 5px;
}

.invoice-message {
    background: var(--orange);
    color: white;
    align-self: flex-start;
    border-bottom-left-radius: 5px;
}

.chat-input {
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.attachment-options {
    display: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.attachment-options.show {
    display: flex;
}

.attach-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--white);
    padding: 10px 15px;
    border-radius: 10px;
    margin: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.attach-btn:hover {
    background: rgba(212, 175, 55, 0.3);
}

.input-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.attach-toggle, .send-btn {
    border: none;
    width: 52px;
    min-width: 52px;
    height: 52px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    line-height: 1;
}

.attach-toggle {
    background: rgba(212, 175, 55, 0.18);
    color: var(--gold);
    border: 1px solid rgba(212, 175, 55, 0.35);
}

.send-btn {
    background: linear-gradient(135deg, var(--gold), var(--dark-gold));
    color: var(--black);
    box-shadow: 0 4px 14px rgba(212, 175, 55, 0.28);
}

.attach-toggle:hover {
    background: rgba(212, 175, 55, 0.28);
}

.send-btn:hover {
    filter: brightness(1.08);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: Arial, sans-serif;
    font-weight: 700;
    line-height: 1;
}

#messageInput {
    flex: 1;
    padding: 15px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    outline: none;
}

/* پنل مدیریت */
.admin-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.admin-header {
    background: linear-gradient(90deg, var(--gold), var(--dark-gold));
    padding: 15px 20px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.menu-toggle {
    background: none;
    border: none;
    color: var(--black);
    font-size: 24px;
    margin-left: 15px;
    cursor: pointer;
}

.admin-header h2 {
    color: var(--black);
    font-weight: 700;
    flex: 1;
    text-align: center;
}

.admin-menu {
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.menu-item {
    padding: 15px 20px;
    color: var(--white);
    text-decoration: none;
    border-right: 3px solid transparent;
    transition: all 0.3s;
}

.menu-item.active, .menu-item:hover {
    background: rgba(212, 175, 55, 0.2);
    border-right: 3px solid var(--gold);
}

.admin-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* کارت‌های آمار */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-card h3 {
    color: var(--gold);
    margin-bottom: 10px;
    font-size: 18px;
}

.stat-card p {
    font-size: 24px;
    font-weight: 700;
}

/* جستجوی کاربران */
.search-box {
    display: flex;
    margin-bottom: 20px;
}

.search-box input {
    flex: 1;
    padding: 12px 15px;
    border: none;
    border-radius: 10px 0 0 10px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    outline: none;
}

.search-box button {
    background: var(--gold);
    border: none;
    padding: 0 20px;
    border-radius: 0 10px 10px 0;
    color: var(--black);
    cursor: pointer;
}

.users-list, .messages-list, .admins-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.user-card, .message-card, .admin-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 15px;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.3s;
}

.user-card:hover, .message-card:hover, .admin-card:hover {
    background: rgba(212, 175, 55, 0.1);
    transform: translateY(-2px);
}

.user-info, .message-info, .admin-info {
    flex: 1;
}

.user-name, .message-user, .admin-name {
    font-weight: 700;
    margin-bottom: 5px;
}

.user-phone, .message-preview, .admin-permissions {
    font-size: 14px;
    color: #aaa;
}

.status-badge {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-left: 15px;
}

.unread {
    background: var(--red);
}

.read {
    background: var(--orange);
}

.replied {
    background: var(--green);
}

.add-admin-btn {
    background: var(--gold);
    color: var(--black);
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 20px;
    transition: all 0.3s;
}

.add-admin-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(212, 175, 55, 0.4);
}

/* فیلتر پیام‌ها */
.operators-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.filter-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--white);
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.filter-btn.active, .filter-btn:hover {
    background: var(--gold);
    color: var(--black);
}

/* مودال‌ها */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1001;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: linear-gradient(135deg, var(--dark-gray), var(--black));
    border-radius: 15px;
    padding: 30px;
    width: 90%;
    max-width: 400px;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.close-modal {
    position: absolute;
    top: 15px;
    left: 15px;
    font-size: 24px;
    color: var(--white);
    cursor: pointer;
}

.modal-content h3 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--gold);
}

.modal-content input {
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 15px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    outline: none;
}

.modal-content button {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(90deg, var(--gold), var(--dark-gold));
    color: var(--black);
    font-weight: 700;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.3s;
}

.modal-content button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(212, 175, 55, 0.4);
}

.file-upload {
    margin-bottom: 20px;
    text-align: center;
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-label:hover {
    border-color: var(--gold);
}

.upload-label i {
    font-size: 40px;
    color: var(--gold);
    margin-bottom: 15px;
}

.permissions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 20px 0;
}

.permissions label {
    display: flex;
    align-items: center;
    font-size: 14px;
}

.permissions input {
    width: auto;
    margin-left: 10px;
}

.secondary-btn {
    background: transparent !important;
    color: var(--gold) !important;
    border: 1px solid var(--gold) !important;
}

/* رسپانسیو */
@media (max-width: 768px) {
    .panel-header h2 {
        font-size: 1.1rem;
    }
    
    .login-form {
        padding: 20px;
    }
    
    .operator-card {
        padding: 15px;
    }
    
    .message {
        max-width: 90%;
    }
    
    .modal-content {
        width: 95%;
        padding: 20px;
    }
    
    .permissions {
        grid-template-columns: 1fr;
    }
}

/* انیمیشن‌ها */
@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.slide-in {
    animation: slideIn 0.3s forwards;
}
/* دکمه‌های بازگشت در بخش کاربر */
.section-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(212, 175, 55, 0.35);
    color: var(--white);
    padding: 10px 14px;
    border-radius: 12px;
    cursor: pointer;
    margin-bottom: 14px;
    font-size: 14px;
    transition: all 0.3s;
}

.section-back-btn:hover {
    background: rgba(212, 175, 55, 0.25);
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.back-btn span {
    font-size: 13px;
    font-weight: 700;
}

/* Admin messages improvements */
.empty-state {
    padding: 18px;
    text-align: center;
    color: #b8b8b8;
    background: rgba(255,255,255,0.04);
    border-radius: 12px;
    margin: 10px 0;
}

.message-card {
    cursor: pointer;
}

.message-card--unread {
    border-right: 4px solid #d4af37;
    background: rgba(212, 175, 55, 0.10);
}

.message-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 7px;
    font-size: 12px;
    color: #9f9f9f;
}

.message-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.unread-count {
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    border-radius: 999px;
    background: #d4af37;
    color: #111;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
}

.open-conversation-btn {
    border: 0;
    border-radius: 10px;
    padding: 8px 12px;
    background: #d4af37;
    color: #111;
    cursor: pointer;
    font-weight: 700;
}

.admin-conversation-content {
    width: min(680px, calc(100vw - 26px));
    max-height: 86vh;
    display: flex;
    flex-direction: column;
}

.admin-conversation-messages {
    min-height: 260px;
    max-height: 52vh;
    overflow-y: auto;
    padding: 14px;
    background: rgba(0,0,0,0.35);
    border-radius: 14px;
    margin: 12px 0;
}

.admin-conversation-message {
    width: fit-content;
    max-width: 78%;
    padding: 10px 12px;
    border-radius: 14px;
    margin-bottom: 10px;
    color: #fff;
    line-height: 1.9;
}

.admin-conversation-message--user {
    margin-left: auto;
    background: #333;
}

.admin-conversation-message--admin {
    margin-right: auto;
    background: #7a5a08;
}

.admin-conversation-time {
    margin-top: 5px;
    font-size: 11px;
    color: rgba(255,255,255,0.65);
}

.admin-reply-area {
    display: flex;
    gap: 10px;
}

.admin-reply-area input {
    flex: 1;
    border: 0;
    border-radius: 12px;
    padding: 12px 14px;
    background: #3a3a3a;
    color: #fff;
    outline: none;
}

.admin-reply-area button {
    border: 0;
    border-radius: 12px;
    padding: 12px 18px;
    background: #d4af37;
    color: #111;
    cursor: pointer;
    font-weight: 700;
}

@media (max-width: 640px) {
    .message-card {
        align-items: flex-start;
        gap: 12px;
    }

    .message-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .admin-reply-area {
        flex-direction: column;
    }

    .admin-conversation-message {
        max-width: 92%;
    }
}
