/* ===== CHAT SYSTEM STYLES ===== */
/* Colors synced with menu: #fbc500 primary */

/* Chat Widget Button */
.chat-float {
    position: fixed;
    bottom: 90px;
    left: 20px;
    z-index: 9998;
}

.chat-main-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fbc500, #e6b000);
    border: none;
    color: #1a1a1a;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(251, 197, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    font-weight: bold;
}

.chat-main-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(251, 197, 0, 0.5);
}

.chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ff0000;
    color: white;
    font-size: 10px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* Chat Modal */
.chat-modal {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: 0;
    z-index: 10000;
    align-items: flex-end;
    justify-content: flex-start;
    background: rgba(0,0,0,0.5);
}

.chat-modal.open {
    display: flex;
}

.chat-container {
    width: 100%;
    max-width: 400px;
    height: 80vh;
    max-height: 550px;
    background: #1a1a1a;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -5px 30px rgba(0,0,0,0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
    margin: 0 auto;
    border: 1px solid #333;
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.chat-header {
    background: linear-gradient(135deg, #fbc500, #e6b000);
    color: #1a1a1a;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

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

.chat-header-icon {
    font-size: 18px;
    font-weight: bold;
}

.chat-header-title {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a1a;
}

.chat-header-subtitle {
    font-size: 11px;
    opacity: 0.8;
    color: #1a1a1a;
}

.chat-close-btn {
    background: rgba(0,0,0,0.15);
    border: none;
    color: #1a1a1a;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    font-weight: bold;
}

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

/* Branch Selector */
.chat-branch-selector {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #1a1a1a;
}

.chat-branch-selector h4 {
    text-align: center;
    color: #fbc500;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
}

.chat-welcome {
    text-align: center;
    padding: 16px 10px;
    color: #95a5a6;
}

.chat-welcome-icon {
    font-size: 32px;
    margin-bottom: 8px;
    color: #fbc500;
    font-weight: bold;
}

.chat-welcome h4 {
    margin: 0 0 4px 0;
    color: #fff;
    font-size: 14px;
}

.chat-welcome p {
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
}

.chat-branch-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1.5px solid #333;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    background: #2d2d2d;
}

.chat-branch-card:hover {
    border-color: #fbc500;
    background: #3a2d00;
    transform: translateX(-3px);
}

.chat-branch-card .branch-icon {
    font-size: 20px;
    color: #fbc500;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(251,197,0,0.1);
    border-radius: 50%;
    font-weight: bold;
}

.chat-branch-card .branch-info h5 {
    font-size: 14px;
    color: #fff;
    margin: 0 0 2px 0;
}

.chat-branch-card .branch-info p {
    margin: 0;
    color: #888;
    font-size: 11px;
}

/* Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #141414;
}

/* Message Bubbles - SMALLER */
.chat-message {
    max-width: 78%;
    padding: 7px 11px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.45;
    word-wrap: break-word;
    position: relative;
    animation: fadeIn 0.2s ease;
}

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

.chat-message.visitor {
    align-self: flex-end;
    background: linear-gradient(135deg, #fbc500, #e6b000);
    color: #1a1a1a;
    border-bottom-left-radius: 3px;
}

.chat-message.admin {
    align-self: flex-start;
    background: #2d2d2d;
    color: #ecf0f1;
    border: 1px solid #404040;
    border-bottom-right-radius: 3px;
}

.chat-message-time {
    font-size: 9px;
    opacity: 0.65;
    margin-top: 3px;
    display: block;
    text-align: left;
}

.chat-message.visitor .chat-message-time {
    text-align: left;
    color: rgba(26,26,26,0.7);
}

/* Typing Indicator */
.chat-typing {
    align-self: flex-start;
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 14px;
    padding: 10px 14px;
    display: none;
    gap: 3px;
}

.chat-typing.show {
    display: flex;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #888;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Quick Replies / Shortcuts */
.chat-shortcuts {
    display: flex;
    gap: 6px;
    padding: 6px 12px;
    overflow-x: auto;
    flex-shrink: 0;
    background: #1a1a1a;
    border-top: 1px solid #333;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.chat-shortcuts::-webkit-scrollbar { display: none; }

.chat-shortcut-btn {
    background: rgba(251,197,0,0.12);
    border: 1px solid rgba(251,197,0,0.3);
    color: #fbc500;
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    font-family: inherit;
}

.chat-shortcut-btn:hover {
    background: rgba(251,197,0,0.25);
    border-color: #fbc500;
}

/* Slash Menu */
.slash-menu {
    position: absolute;
    bottom: 100%;
    left: 16px;
    right: 16px;
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 12px;
    max-height: 200px;
    overflow-y: auto;
    display: none;
    z-index: 100;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
    margin-bottom: 6px;
}

.slash-menu.show {
    display: block;
}

.slash-menu-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #333;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.slash-menu-item:last-child {
    border-bottom: none;
}

.slash-menu-item:hover {
    background: rgba(251,197,0,0.1);
}

.slash-menu-item .slash-key {
    background: rgba(251,197,0,0.15);
    color: #fbc500;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    font-family: monospace;
}

.slash-menu-item .slash-text {
    color: #ecf0f1;
    font-size: 13px;
}

/* Input Area */
.chat-input-area {
    padding: 10px 12px;
    border-top: 1px solid #333;
    background: #1a1a1a;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-shrink: 0;
    position: relative;
}

.chat-input {
    flex: 1;
    border: 1px solid #444;
    border-radius: 18px;
    padding: 8px 14px;
    font-size: 13px;
    resize: none;
    max-height: 90px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    background: #2d2d2d;
    color: #ecf0f1;
    line-height: 1.4;
}

.chat-input:focus {
    border-color: #fbc500;
}

.chat-input::placeholder {
    color: #666;
}

.chat-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fbc500, #e6b000);
    border: none;
    color: #1a1a1a;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
    font-weight: bold;
}

.chat-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 3px 10px rgba(251,197,0,0.3);
}

.chat-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* Back Button in Chat */
.chat-back-btn {
    background: rgba(0,0,0,0.15);
    border: none;
    color: #1a1a1a;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: none;
    align-items: center;
    justify-content: center;
    margin-left: 6px;
    font-weight: bold;
}

/* Scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 4px;
}
.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 2px;
}

/* RTL Support */
html[dir="ltr"] .chat-float {
    left: auto;
    right: 20px;
}

html[dir="ltr"] .chat-branch-card:hover {
    transform: translateX(3px);
}

/* ===== RESPONSIVE - ALL PHONE SIZES ===== */
/* Small phones (320px - 375px) */
@media (max-width: 375px) {
    .chat-container {
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    .chat-modal.open {
        background: #1a1a1a;
    }
    .chat-float {
        bottom: 80px;
        left: 12px;
    }
    .chat-main-btn {
        width: 46px;
        height: 46px;
        font-size: 18px;
    }
    .chat-message {
        max-width: 85%;
        padding: 6px 10px;
        font-size: 12px;
        border-radius: 12px;
    }
    .chat-header {
        padding: 10px 12px;
    }
    .chat-header-title {
        font-size: 13px;
    }
    .chat-input-area {
        padding: 8px 10px;
    }
    .chat-input {
        padding: 7px 12px;
        font-size: 12px;
    }
    .chat-send-btn {
        width: 34px;
        height: 34px;
    }
    .chat-shortcut-btn {
        padding: 4px 10px;
        font-size: 11px;
    }
    .chat-branch-card {
        padding: 10px 12px;
    }
    .chat-welcome {
        padding: 12px 8px;
    }
}

/* Medium phones (376px - 480px) */
@media (min-width: 376px) and (max-width: 480px) {
    .chat-container {
        max-width: 100%;
        height: 92vh;
        max-height: 92vh;
        border-radius: 16px 16px 0 0;
    }
    .chat-message {
        max-width: 82%;
        font-size: 13px;
    }
}

/* Large phones (481px - 767px) */
@media (min-width: 481px) and (max-width: 767px) {
    .chat-container {
        max-width: 420px;
        height: 85vh;
        max-height: 600px;
        border-radius: 20px 20px 0 0;
        margin: 0 auto;
    }
}

/* Tablets and up */
@media (min-width: 768px) {
    .chat-container {
        max-width: 440px;
        height: 80vh;
        max-height: 650px;
        border-radius: 20px;
        margin: auto auto 20px 20px;
    }
    html[dir="ltr"] .chat-container {
        margin: auto 20px 20px auto;
    }
}

/* ===== ADMIN STYLES ===== */
.admin-body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #0f0f0f;
    height: 100vh;
    overflow: hidden;
}

.admin-container {
    display: flex;
    height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    background: #1a1a1a;
    box-shadow: 0 0 20px rgba(0,0,0,0.3);
}

/* Admin Sidebar */
.admin-sidebar {
    width: 320px;
    border-left: 1px solid #333;
    display: flex;
    flex-direction: column;
    background: #1a1a1a;
    flex-shrink: 0;
}

.admin-sidebar-header {
    padding: 14px 16px;
    background: linear-gradient(135deg, #fbc500, #e6b000);
    color: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-sidebar-header h2 {
    margin: 0;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}

.admin-unread-total {
    background: #1a1a1a;
    color: #fbc500;
    font-size: 12px;
    font-weight: bold;
    padding: 3px 9px;
    border-radius: 12px;
    min-width: 22px;
    text-align: center;
}

.admin-conversations-list {
    flex: 1;
    overflow-y: auto;
    background: #141414;
}

.admin-conversation-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    cursor: pointer;
    border-bottom: 1px solid #222;
    transition: background 0.15s;
    position: relative;
}

.admin-conversation-item:hover {
    background: #222;
}

.admin-conversation-item.active {
    background: rgba(251,197,0,0.08);
    border-right: 3px solid #fbc500;
}

.admin-conversation-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fbc500, #e6b000);
    color: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    flex-shrink: 0;
}

.admin-conversation-info {
    flex: 1;
    min-width: 0;
}

.admin-conversation-name {
    font-weight: 600;
    font-size: 13px;
    color: #fff;
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.admin-conversation-preview {
    font-size: 12px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-conversation-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    flex-shrink: 0;
}

.admin-conversation-time {
    font-size: 10px;
    color: #666;
}

.admin-conversation-badge {
    background: #ff0000;
    color: white;
    font-size: 10px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Admin Chat Area */
.admin-chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0f0f0f;
    position: relative;
}

.admin-chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #555;
    gap: 14px;
}

.admin-chat-empty-icon {
    font-size: 48px;
    opacity: 0.2;
    color: #fbc500;
    font-weight: bold;
}

.admin-chat-empty p {
    font-size: 15px;
}

.admin-chat-header {
    padding: 14px 18px;
    background: #1a1a1a;
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.admin-chat-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fbc500, #e6b000);
    color: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
}

.admin-chat-header-info h4 {
    margin: 0;
    font-size: 14px;
    color: #fff;
}

.admin-chat-header-info p {
    margin: 2px 0 0 0;
    font-size: 11px;
    color: #888;
}

.admin-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.admin-chat-input-area {
    padding: 12px 18px;
    background: #1a1a1a;
    border-top: 1px solid #333;
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-shrink: 0;
    position: relative;
}

.admin-chat-input {
    flex: 1;
    border: 1px solid #444;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 13px;
    resize: none;
    max-height: 100px;
    font-family: inherit;
    outline: none;
    background: #2d2d2d;
    color: #ecf0f1;
}

.admin-chat-input:focus {
    border-color: #fbc500;
}

.admin-chat-send {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fbc500, #e6b000);
    border: none;
    color: #1a1a1a;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: transform 0.2s;
    flex-shrink: 0;
    font-weight: bold;
}

.admin-chat-send:hover {
    transform: scale(1.05);
}

/* Admin Message Bubbles - SMALLER */
.admin-message {
    max-width: 72%;
    padding: 8px 13px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.45;
    word-wrap: break-word;
    animation: fadeIn 0.2s ease;
}

.admin-message.visitor-msg {
    align-self: flex-start;
    background: #2d2d2d;
    border: 1px solid #404040;
    border-bottom-right-radius: 3px;
    color: #ecf0f1;
}

.admin-message.admin-msg {
    align-self: flex-end;
    background: linear-gradient(135deg, #fbc500, #e6b000);
    color: #1a1a1a;
    border-bottom-left-radius: 3px;
}

.admin-message-time {
    font-size: 10px;
    opacity: 0.6;
    margin-top: 4px;
    display: block;
}

.admin-message.admin-msg .admin-message-time {
    color: rgba(26,26,26,0.65);
}

/* Admin Quick Replies */
.admin-shortcuts-bar {
    display: flex;
    gap: 6px;
    padding: 8px 18px;
    background: #1a1a1a;
    border-top: 1px solid #222;
    overflow-x: auto;
    flex-shrink: 0;
    scrollbar-width: none;
}
.admin-shortcuts-bar::-webkit-scrollbar { display: none; }

.admin-shortcut-chip {
    background: rgba(251,197,0,0.1);
    border: 1px solid rgba(251,197,0,0.25);
    color: #fbc500;
    padding: 5px 12px;
    border-radius: 14px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    font-family: inherit;
}
.admin-shortcut-chip:hover {
    background: rgba(251,197,0,0.2);
    border-color: #fbc500;
}

.admin-slash-menu {
    position: absolute;
    bottom: 100%;
    left: 18px;
    right: 70px;
    background: #2d2d2d;
    border: 1px solid #444;
    border-radius: 12px;
    max-height: 220px;
    overflow-y: auto;
    display: none;
    z-index: 100;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
    margin-bottom: 6px;
}
.admin-slash-menu.show { display: block; }

.admin-slash-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #333;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    gap: 10px;
}
.admin-slash-item:last-child { border-bottom: none; }
.admin-slash-item:hover { background: rgba(251,197,0,0.08); }
.admin-slash-item .slash-key {
    background: rgba(251,197,0,0.12);
    color: #fbc500;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    font-family: monospace;
}
.admin-slash-item .slash-text {
    color: #ecf0f1;
    font-size: 13px;
}

/* Responsive Admin */
@media (max-width: 768px) {
    .admin-sidebar {
        width: 100%;
        position: absolute;
        top: 0;
        bottom: 0;
        z-index: 10;
        transition: transform 0.3s ease;
    }
    .admin-sidebar.hidden-mobile {
        transform: translateX(100%);
    }
    .admin-chat-area {
        width: 100%;
    }
    .admin-back-to-list {
        display: flex !important;
    }
    .admin-message {
        max-width: 80%;
        font-size: 12px;
        padding: 7px 11px;
    }
    .admin-chat-header {
        padding: 12px 14px;
    }
    .admin-chat-messages {
        padding: 12px 14px;
    }
    .admin-chat-input-area {
        padding: 10px 14px;
    }
}

@media (max-width: 375px) {
    .admin-sidebar-header h2 {
        font-size: 14px;
    }
    .admin-conversation-item {
        padding: 10px 12px;
    }
    .admin-conversation-avatar {
        width: 38px;
        height: 38px;
        font-size: 14px;
    }
    .admin-message {
        max-width: 85%;
        font-size: 12px;
    }
}

.admin-back-to-list {
    display: none;
    background: rgba(251,197,0,0.15);
    border: none;
    color: #fbc500;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Admin Status */
.admin-status-dot {
    width: 7px;
    height: 7px;
    background: #4CAF50;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
}

.admin-status-text {
    font-size: 11px;
    color: #4CAF50;
    font-weight: 600;
}
.chat-hint {
    position: absolute;
    left: 65px;
    bottom: 5px;

    background: #fff;
    color: #333;
    padding: 10px 14px;
    border-radius: 10px;

    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;

    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
    direction: rtl;

    animation: chatHintPulse 2s ease-in-out infinite;
}

.chat-hint::after {
    content: "";
    position: absolute;
    left: -7px;
    top: 50%;
    transform: translateY(-50%);

    border-width: 7px 7px 7px 0;
    border-style: solid;
    border-color: transparent #fff transparent transparent;
}

@keyframes chatHintPulse {
    0%, 100% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(4px);
    }
}