/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #0f172a;
    color: #e2e8f0;
    direction: ltr;
}

body.rtl {
    direction: rtl;
}

/* Login Page */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(181, 53, 53, 0.15) 0%, transparent 70%);
    top: -250px;
    right: -250px;
    border-radius: 50%;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(65, 90, 183, 0.15) 0%, transparent 70%);
    bottom: -250px;
    left: -250px;
    border-radius: 50%;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.login-box {
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 16px;
    padding: 48px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-box h1 {
    text-align: center;
    margin-bottom: 32px;
    color: #f1f5f9;
    font-size: 28px;
    font-weight: 700;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #cbd5e1;
    font-size: 14px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    font-size: 15px;
    background-color: rgba(15, 23, 42, 0.6);
    color: #f1f5f9;
    transition: all 0.2s;
}

.form-group input::placeholder {
    color: #64748b;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #415ab7;
    background-color: rgba(15, 23, 42, 0.8);
    box-shadow: 0 0 0 3px rgba(65, 90, 183, 0.2);
}

.error-message {
    color: #f87171;
    font-size: 14px;
    margin-top: 12px;
    padding: 12px;
    background-color: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.2);
    border-radius: 8px;
    display: none;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, #415ab7 0%, #b53535 100%);
    color: white;
    border: none;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(65, 90, 183, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #3548a0 0%, #9d2a2a 100%);
    box-shadow: 0 6px 16px rgba(65, 90, 183, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background-color: #4b5563;
}

.btn-danger {
    background-color: #ef4444;
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-small {
    padding: 8px 16px;
    font-size: 12px;
}

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    border-left: 1px solid rgba(148, 163, 184, 0.1);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.sidebar-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 0;
    flex: 1;
}

.sidebar-menu li {
    margin-bottom: 5px;
}

.sidebar-menu a {
    display: block;
    padding: 12px 20px;
    color: #94a3b8;
    text-decoration: none;
    transition: all 0.2s;
    border-radius: 8px;
    margin: 4px 12px;
}

.sidebar-menu a:hover {
    background-color: rgba(99, 102, 241, 0.1);
    color: #e2e8f0;
}

.sidebar-menu a.active {
    background: linear-gradient(135deg, rgba(65, 90, 183, 0.2) 0%, rgba(181, 53, 53, 0.2) 100%);
    color: #a5b4fc;
}

body:not(.rtl) .sidebar-menu a.active {
    border-left: 3px solid #415ab7;
}

body.rtl .sidebar-menu a.active {
    border-right: 3px solid #415ab7;
}

.sidebar-user {
    padding: 20px;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
    font-size: 14px;
    background-color: rgba(15, 23, 42, 0.5);
}

.sidebar-user p {
    margin: 5px 0;
    color: #cbd5e1;
}

.user-role {
    color: #64748b;
    font-size: 12px;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #0f172a;
}

.content-header {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(10px);
    padding: 24px 32px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.content-header h1 {
    font-size: 24px;
    font-weight: 600;
    color: #f1f5f9;
}

.channel-filters {
    display: flex;
    gap: 10px;
}

.channel-filter-btn {
    padding: 10px 18px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background-color: rgba(30, 41, 59, 0.6);
    color: #cbd5e1;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    font-weight: 500;
}

.channel-filter-btn:hover {
    background-color: rgba(30, 41, 59, 0.8);
    border-color: rgba(148, 163, 184, 0.3);
}

.channel-filter-btn.active {
    background: linear-gradient(135deg, rgba(65, 90, 183, 0.2) 0%, rgba(181, 53, 53, 0.2) 100%);
    color: #a5b4fc;
    border-color: #415ab7;
    box-shadow: 0 4px 12px rgba(65, 90, 183, 0.2);
}

.content-body {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
    background-color: #0f172a;
}

/* Channel Icons */
.channel-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-block;
    position: relative;
}

.channel-icon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.icon-whatsapp::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413Z'/%3E%3C/svg%3E");
}

.icon-facebook::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z'/%3E%3C/svg%3E");
}

.icon-instagram::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zm0-2.163c-3.259 0-3.667.014-4.947.072-4.358.2-6.78 2.618-6.98 6.98-.059 1.281-.073 1.689-.073 4.948 0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98 1.281.058 1.689.072 4.948.072 3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98-1.281-.059-1.69-.073-4.949-.073zm0 5.838c-3.403 0-6.162 2.759-6.162 6.162s2.759 6.163 6.162 6.163 6.162-2.759 6.162-6.163c0-3.403-2.759-6.162-6.162-6.162zm0 10.162c-2.209 0-4-1.79-4-4 0-2.209 1.791-4 4-4s4 1.791 4 4c0 2.21-1.791 4-4 4zm6.406-11.845c-.796 0-1.441.645-1.441 1.44s.645 1.44 1.441 1.44c.795 0 1.439-.645 1.439-1.44s-.644-1.44-1.439-1.44z'/%3E%3C/svg%3E");
}

.icon-website::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0zm-1 19.938v-1.938h-4v-2h4v-2h-4V9.938h4V7.938h-4V5.938h4V3.942c-3.788.06-6.94 3.2-7 7v.058h2v2h-2v2h2v2h-2v2h2v2h1zm11-7.938h-2v-2h2v2zm-4 0h-2v-2h2v2zm-4 0h-2v-2h2v2zm-1-4h-2V6h2v2zm0-4h-2V2h2v2z'/%3E%3C/svg%3E");
}

.icon-telegram::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.479.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z'/%3E%3C/svg%3E");
}

.icon-email::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M24 5.457v13.909c0 .904-.732 1.636-1.636 1.636h-3.819V11.73L12 16.64l-6.545-4.91v9.273H1.636A1.636 1.636 0 0 1 0 19.366V5.457c0-2.023 2.309-3.178 3.927-1.964L5.455 4.64 12 9.548l6.545-4.91 1.528-1.145C21.69 2.28 24 3.434 24 5.457z'/%3E%3C/svg%3E");
}

.icon-default::before {
    background-color: white;
    border-radius: 50%;
}

/* Conversations List */
.conversations-list {
    display: grid;
    gap: 15px;
}

.conversation-item {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.2s;
    border: 1px solid rgba(148, 163, 184, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.conversation-item:hover {
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(65, 90, 183, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.conversation-info h3 {
    font-size: 16px;
    margin-bottom: 5px;
}

.conversation-meta {
    font-size: 14px;
    color: #64748b;
}

/* Inboxes List */
.inboxes-list {
    display: grid;
    gap: 15px;
}

.inbox-item {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid rgba(148, 163, 184, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.inbox-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.inbox-details h3 {
    font-size: 16px;
    margin-bottom: 5px;
}

.inbox-channel {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 5px;
}

.inbox-webhook {
    font-size: 12px;
    color: #64748b;
    font-family: monospace;
}

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

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

.modal-content {
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(20px);
    margin: 50px auto;
    padding: 0;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    border: 1px solid rgba(148, 163, 184, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 20px;
    color: #f1f5f9;
}

.close {
    color: #94a3b8;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close:hover {
    color: #e2e8f0;
}

.modal-body {
    padding: 24px;
    background-color: transparent;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* Chat */
.chat-main {
    display: flex;
    flex-direction: column;
}

.chat-header {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(10px);
    padding: 24px 32px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.back-btn {
    color: #7c9af7;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.back-btn:hover {
    color: #9db2f9;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(10px);
    margin: 24px 32px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

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

.message {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    word-wrap: break-word;
}

.message-incoming {
    align-self: flex-start;
    background: rgba(30, 41, 59, 0.8);
    color: #e2e8f0;
    border: 1px solid rgba(148, 163, 184, 0.1);
}

.message-outgoing {
    align-self: flex-end;
    background: linear-gradient(135deg, #415ab7 0%, #b53535 100%);
    color: white;
}

.message-content {
    margin-bottom: 5px;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    text-align: left;
}

.chat-input-container {
    display: flex;
    padding: 20px;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
    gap: 12px;
    background: rgba(15, 23, 42, 0.4);
}

.chat-input-container input {
    flex: 1;
    padding: 14px 16px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 10px;
    font-size: 15px;
    background-color: rgba(15, 23, 42, 0.6);
    color: #f1f5f9;
}

.chat-input-container input::placeholder {
    color: #64748b;
}

.chat-input-container input:focus {
    outline: none;
    border-color: #415ab7;
    background-color: rgba(15, 23, 42, 0.8);
    box-shadow: 0 0 0 3px rgba(65, 90, 183, 0.2);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #64748b;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 200px;
    }

    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .channel-filters {
        flex-wrap: wrap;
    }

    .message {
        max-width: 85%;
    }
}

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

    .sidebar {
        width: 100%;
        height: auto;
    }

    .sidebar-menu {
        display: flex;
        padding: 10px;
        gap: 10px;
    }

    .sidebar-menu li {
        margin: 0;
    }

    .message {
        max-width: 95%;
    }
}

