:root {
    --primary-color: #6c5ce7;
    --secondary-color: #a29bfe;
    --accent-color: #fd79a8;
    --text-color: #2d3436;
    --text-light: #636e72;
    --bg-color: #f5f6fa;
    --card-color: #ffffff;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
    --chat-bg: #f5f6fa;
    --user-bubble: #6c5ce7;
    --agent-bubble: #ffffff;
    --online-status: #00b894;
    --offline-status: #d63031;
    --typing-status: #fdcb6e;
}

/* Dark Theme */
[data-theme="dark"] {
    --primary-color: #6c5ce7;
    --secondary-color: #a29bfe;
    --accent-color: #fd79a8;
    --text-color: #f5f6fa;
    --text-light: #b2bec3;
    --bg-color: #2d3436;
    --card-color: #1e272e;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --chat-bg: #1e272e;
    --user-bubble: #6c5ce7;
    --agent-bubble: #2d3436;
}

/* Light Theme */
[data-theme="light"] {
    --primary-color: #0984e3;
    --secondary-color: #74b9ff;
    --accent-color: #ff7675;
    --text-color: #2d3436;
    --text-light: #636e72;
    --bg-color: #f5f6fa;
    --card-color: #ffffff;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --chat-bg: #f5f6fa;
    --user-bubble: #0984e3;
    --agent-bubble: #ffffff;
}

/* Space Theme */
[data-theme="space"] {
    --primary-color: #0984e3;
    --secondary-color: #00cec9;
    --accent-color: #fdcb6e;
    --text-color: #dfe6e9;
    --text-light: #b2bec3;
    --bg-color: #0a3d62;
    --card-color: #1e3799;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --chat-bg: #0a3d62;
    --user-bubble: #0984e3;
    --agent-bubble: #1e3799;
}

/* Telegram Theme */
[data-theme="telegram"] {
    --primary-color: #0088cc;
    --secondary-color: #3cb4e7;
    --accent-color: #eb445a;
    --text-color: #000000;
    --text-light: #707579;
    --bg-color: #e6ebee;
    --card-color: #ffffff;
    --shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
    --chat-bg: #e6ebee;
    --user-bubble: #0088cc;
    --agent-bubble: #ffffff;
}

/* Valentine Theme */
[data-theme="valentine"] {
    --primary-color: #e84393;
    --secondary-color: #fd79a8;
    --accent-color: #a29bfe;
    --text-color: #2d3436;
    --text-light: #636e72;
    --bg-color: #ffeaa7;
    --card-color: #fab1a0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --chat-bg: #ffeaa7;
    --user-bubble: #e84393;
    --agent-bubble: #fab1a0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Roboto', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: all 0.3s ease;
}

.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* Sidebar Styles */
.sidebar {
    width: 300px;
    background-color: var(--card-color);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: 10;
    position: relative;
    border-right: 1px solid rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.logo {
    display: flex;
    align-items: center;
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
}

.logo span:first-child {
    margin-right: 10px;
    font-size: 24px;
}

.close-sidebar {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 20px;
    cursor: pointer;
    display: none;
}

.user-profile {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.avatar-upload {
    position: relative;
    margin-bottom: 15px;
}

.avatar-upload img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-color);
    cursor: pointer;
}

.avatar-upload .mdi-camera {
    position: absolute;
    bottom: 0;
    right: 0;
    background-color: var(--primary-color);
    color: white;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.avatar-upload input {
    display: none;
}

.user-info {
    width: 100%;
}

.user-info input, .user-info textarea {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--border-radius);
    background-color: var(--bg-color);
    color: var(--text-color);
    resize: none;
}

.user-info textarea {
    height: 60px;
    font-size: 12px;
}

.search-container {
    padding: 15px;
    position: relative;
}

.search-container input {
    width: 100%;
    padding: 10px 15px 10px 35px;
    border-radius: 20px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background-color: var(--bg-color);
    color: var(--text-color);
}

.search-container .mdi-magnify {
    position: absolute;
    left: 25px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

.agents-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.agent-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.agent-item:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.agent-item.active {
    background-color: var(--primary-color);
    color: white;
}

.agent-item.active .agent-name {
    color: white;
}

.agent-item.active .agent-status {
    color: rgba(255, 255, 255, 0.7);
}

.agent-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 10px;
    overflow: hidden;
}

.agent-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.agent-details {
    flex: 1;
}

.agent-name {
    font-weight: 500;
    font-size: 14px;
    color: var(--text-color);
    margin-bottom: 2px;
}

.agent-status {
    font-size: 12px;
    color: var(--text-light);
}

.agent-status.online {
    color: var(--online-status);
}

.agent-status.offline {
    color: var(--offline-status);
}

.agent-status.typing {
    color: var(--typing-status);
}

.add-agent-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
}

.add-agent-btn:hover {
    background-color: var(--secondary-color);
}

.add-agent-btn .mdi-plus {
    margin-right: 5px;
}

/* Main Content Styles */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    background-color: var(--chat-bg);
}

.chat-header {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    background-color: var(--card-color);
    z-index: 5;
}

.menu-btn {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 20px;
    margin-right: 15px;
    cursor: pointer;
    display: none;
}

.chat-info {
    display: flex;
    align-items: center;
    flex: 1;
}

.agent-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 10px;
    overflow: hidden;
}

.agent-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.agent-details h3 {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 2px;
}

.agent-details p {
    font-size: 12px;
    color: var(--text-light);
}

.coin-balance {
    display: flex;
    align-items: center;
    background-color: var(--primary-color);
    color: white;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
}

.coin-balance .mdi-coin {
    margin-right: 5px;
    font-size: 16px;
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background-color: var(--chat-bg);
    position: relative;
}

.welcome-message {
    text-align: center;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 500px;
}

.welcome-message h2 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.welcome-message p {
    margin-bottom: 10px;
    color: var(--text-light);
    line-height: 1.5;
}

.messages {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    display: flex;
    max-width: 80%;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.agent {
    align-self: flex-start;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-top: auto;
    overflow: hidden;
    flex-shrink: 0;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-content {
    margin: 0 10px;
    max-width: calc(100% - 42px);
}

.message-bubble {
    padding: 12px 15px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.message.user .message-bubble {
    background-color: var(--user-bubble);
    color: white;
    border-bottom-right-radius: 2px;
}

.message.agent .message-bubble {
    background-color: var(--agent-bubble);
    color: var(--text-color);
    box-shadow: var(--shadow);
    border-bottom-left-radius: 2px;
}

.message-time {
    font-size: 10px;
    color: var(--text-light);
    margin-top: 5px;
    text-align: right;
}

.message-actions {
    display: flex;
    gap: 5px;
    margin-top: 5px;
    opacity: 0;
    transition: opacity 0.2s;
}

.message:hover .message-actions {
    opacity: 1;
}

.message-action {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 14px;
    cursor: pointer;
    padding: 2px;
}

.message-action:hover {
    color: var(--primary-color);
}

.attachment-preview {
    margin-top: 10px;
    max-width: 100%;
    border-radius: var(--border-radius);
    overflow: hidden;
    position: relative;
}

.attachment-preview img {
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: var(--border-radius);
}

.attachment-info {
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: var(--border-radius);
    font-size: 12px;
    display: inline-block;
    margin-top: 5px;
}

.input-area {
    display: flex;
    padding: 15px;
    background-color: var(--card-color);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    align-items: flex-end;
}

.attachment-btn {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 24px;
    margin-right: 10px;
    cursor: pointer;
    position: relative;
    align-self: center;
}

.attachment-btn input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.message-input-container {
    flex: 1;
    display: flex;
    background-color: var(--bg-color);
    border-radius: 20px;
    padding: 5px 15px;
    align-items: flex-end;
}

.message-input-container textarea {
    flex: 1;
    border: none;
    background: none;
    resize: none;
    max-height: 120px;
    padding: 8px 0;
    color: var(--text-color);
    outline: none;
    font-size: 14px;
}

.send-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 24px;
    margin-left: 10px;
    cursor: pointer;
    align-self: center;
}

/* Settings Panel */
.settings-panel {
    position: absolute;
    top: 0;
    right: -350px;
    width: 350px;
    height: 100%;
    background-color: var(--card-color);
    box-shadow: var(--shadow);
    transition: right 0.3s ease;
    z-index: 20;
    display: flex;
    flex-direction: column;
}

.settings-panel.open {
    right: 0;
}

.settings-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.settings-header h3 {
    font-size: 18px;
    font-weight: 500;
}

.close-settings {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 20px;
    cursor: pointer;
}

.settings-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.setting-item {
    margin-bottom: 20px;
}

.setting-item label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
}

.setting-item select {
    width: 100%;
    padding: 10px;
    border-radius: var(--border-radius);
    border: 1px solid rgba(0, 0, 0, 0.1);
    background-color: var(--bg-color);
    color: var(--text-color);
}

.setting-item.toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.export-btn, .buy-coins-btn {
    width: 100%;
    padding: 12px;
    margin-top: 10px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.export-btn:hover, .buy-coins-btn:hover {
    background-color: var(--secondary-color);
}

.export-btn .mdi, .buy-coins-btn .mdi {
    margin-right: 8px;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--card-color);
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 500;
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 20px;
    cursor: pointer;
}

.modal-body {
    padding: 20px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
}

.form-group input, .form-group textarea {
    width: 100%;
    padding: 10px;
    border-radius: var(--border-radius);
    border: 1px solid rgba(0, 0, 0, 0.1);
    background-color: var(--bg-color);
    color: var(--text-color);
    resize: none;
}

.save-agent-btn, .gift-btn, .pay-btn {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
    margin-top: 10px;
}

.save-agent-btn:hover, .gift-btn:hover, .pay-btn:hover {
    background-color: var(--secondary-color);
}

.agent-info-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin: 0 auto 20px;
    overflow: hidden;
}

.agent-info-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.agent-info-details p {
    margin-bottom: 10px;
    line-height: 1.5;
}

.agent-info-details strong {
    font-weight: 500;
}

.gift-coins {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.gift-coins input {
    flex: 1;
    padding: 10px;
    border-radius: var(--border-radius);
    border: 1px solid rgba(0, 0, 0, 0.1);
    background-color: var(--bg-color);
    color: var(--text-color);
}

.coin-option {
    background-color: var(--bg-color);
    border-radius: var(--border-radius);
    padding: 15px;
    text-align: center;
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.2s;
}

.coin-option:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.coin-option .mdi-coin {
    font-size: 30px;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.coin-option h4 {
    margin-bottom: 5px;
    font-size: 16px;
}

.coin-option p {
    font-size: 14px;
    color: var(--text-light);
}

.payment-details {
    margin-top: 20px;
}

.payment-details input {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border-radius: var(--border-radius);
    border: 1px solid rgba(0, 0, 0, 0.1);
    background-color: var(--bg-color);
    color: var(--text-color);
}

/* Feedback Popup */
.feedback-popup {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.feedback-popup.show {
    opacity: 1;
    visibility: visible;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .close-sidebar {
        display: block;
    }
    
    .menu-btn {
        display: block;
    }
    
    .settings-panel {
        width: 100%;
        right: -100%;
    }
    
    .message {
        max-width: 90%;
    }
}

@media (max-width: 480px) {
    .chat-header {
        padding: 10px;
    }
    
    .chat-container {
        padding: 10px;
    }
    
    .input-area {
        padding: 10px;
    }
    
    .message-bubble {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    .modal-content {
        width: 95%;
    }
}