#wce-chat-widget {
    position: fixed;

    width: 350px;
    background: #ffffff;
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15), 0 0 1px rgba(0, 0, 0, 0.1);
    z-index: 99999;
    border-radius: 12px;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    display: flex;
    flex-direction: column;
    overflow: visible;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

#wce-chat-header {
    background: linear-gradient(135deg, #075e54, #128c7e);
    color: #fff;
    padding: 15px 20px;
    cursor: pointer;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.5px;
    position: relative;
    box-shadow: 0 2px 10px rgba(7, 94, 84, 0.2);
}

#wce-chat-header span {
    display: flex;
    align-items: center;
}

#wce-chat-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    cursor: pointer;
    font-size: 14px;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

#wce-chat-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

#wce-room-btn {
    border: none;
    border-radius: 20px !important;
    padding: 6px 14px !important;
    background: rgba(255, 255, 255, 0.15) !important;
    color: rgb(0, 0, 0) !important;
    cursor: pointer;
    font-size: 13px !important;
    font-weight: 600;
    margin-right: 10px !important;
    transition: background 0.2s !important;
}

#wce-room-btn:hover {
    background: rgba(255, 255, 255, 0.3) !important;
}

#wce-chat-body {
    height: 550px;
    display: flex;
    flex-direction: column;
    background: #f0f2f5;
    border-radius: 0 0 12px 12px;
}

#wce-chat-top-bar {
    background: #fff;
    color: #075e54;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
    font-weight: 600;
}

#wce-chat-back {
    background: #f0f2f5;
    border: none;
    color: #075e54;
    cursor: pointer;
    margin-right: 12px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: bold;
    transition: 0.2s;
}

#wce-chat-back:hover {
    background: #e4e6e9;
}

#wce-user-list {
    flex: 1;
    overflow-y: auto;
    background: #fff;
    border-radius: 0 0 12px 12px;
}

.wce-user-item {
    padding: 15px 20px;
    border-bottom: 1px solid #f5f6f6;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background 0.2s ease;
    font-weight: 500;
    color: #333;
}

.wce-user-item:hover {
    background: #f9fbfb;
}

#wce-chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    border-radius: 0 0 12px 12px;
    overflow: hidden;
}

#wce-chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #efeae2;
    display: flex;
    flex-direction: column;
}

#wce-chat-controls {
    display: flex;
    flex-direction: column;
    padding: 10px 12px;
    background: #fff;
    border-top: 1px solid #e0e0e0;
    gap: 8px;
}

.wce-input-row {
    display: flex;
    width: 100%;
    align-items: center;
}

#wce-chat-input {
    flex: 1;
    padding: 10px 15px;
    border: none;
    background: #f0f2f5;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
}

#wce-chat-input:focus {
    box-shadow: inset 0 0 0 1px #8ab8b2;
}

#wce-chat-send,
#wce-chat-call {
    margin-left: 8px;
    width: 38px;
    height: 30px;
    cursor: pointer;
    background: #128c7e;
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s transform;
}

#wce-chat-send:active,
#wce-chat-call:active {
    transform: scale(0.9);
}

#wce-chat-call {
    background: #25d366;
    font-size: 16px;
}

.wce-msg {
    margin-bottom: 10px;
    padding: 10px 14px;
    border-radius: 14px;
    max-width: 75%;
    word-wrap: break-word;
    font-size: 14.5px;
    line-height: 1.4;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    position: relative;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wce-msg.me {
    background: #dcf8c6;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.wce-msg.other {
    background: #fff;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

#wce-call-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(25, 25, 25, 0.95);
    color: white;
    padding: 25px 30px;
    text-align: center;
    border-radius: 16px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
    z-index: 100000;
    backdrop-filter: blur(10px);
}

#wce-call-accept,
#wce-call-reject {
    border: none;
    padding: 10px 20px;
    margin: 15px 5px 0 5px;
    cursor: pointer;
    border-radius: 20px;
    font-weight: 600;
    transition: opacity 0.2s;
}

#wce-call-accept:hover,
#wce-call-reject:hover {
    opacity: 0.8;
}

#wce-call-accept {
    background: #25d366;
    color: white;
}

#wce-call-reject {
    background: #ff3b30;
    color: white;
}

.wce-online-dot {
    width: 10px;
    height: 10px;
    background-color: #25d366;
    border-radius: 50%;
    display: inline-block;
    margin-right: 12px;
    box-shadow: 0 0 6px rgba(37, 211, 102, 0.6);
}

.wce-offline-dot {
    width: 10px;
    height: 10px;
    background-color: #d1d1d6;
    border-radius: 50%;
    display: inline-block;
    margin-right: 12px;
}

.wce-total-unread-badge {
    position: absolute;
    top: -12px;
    left: -12px;
    background: linear-gradient(135deg, #ff3b30, #ff1a1a);
    color: white;
    padding: 4px 9px;
    min-width: 14px;
    text-align: center;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(255, 59, 48, 0.6);
    animation: floatingPulse 1.8s infinite ease-in-out;
    border: 3px solid #fff;
    z-index: 100000;
}

@keyframes floatingPulse {
    0% {
        transform: scale(1) translateY(0);
        box-shadow: 0 4px 10px rgba(255, 59, 48, 0.4);
    }

    50% {
        transform: scale(1.1) translateY(-3px);
        box-shadow: 0 8px 16px rgba(255, 59, 48, 0.7);
    }

    100% {
        transform: scale(1) translateY(0);
        box-shadow: 0 4px 10px rgba(255, 59, 48, 0.4);
    }
}

.wce-unread-badge {
    background: linear-gradient(135deg, #ff3b30, #ff1a1a);
    color: white;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    margin-left: auto;
    box-shadow: 0 2px 5px rgba(255, 59, 48, 0.4);
}

#wce-toast-container {
    position: absolute;
    bottom: 100%;
    right: 0;
    width: 280px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    z-index: 100001;
}

.wce-toast {
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(10px);
    color: white;
    padding: 10px 14px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    font-size: 14px;
    line-height: 1.5;
    animation: wceToastIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    pointer-events: auto;
    border-left: 5px solid #25d366;
}

.wce-toast-hiding {
    animation: wceToastOut 0.4s cubic-bezier(0.6, -0.28, 0.735, 0.045) forwards;
}

@keyframes wceToastIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes wceToastOut {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

.wce-toast-sender {
    font-weight: bold;
    color: #25d366;
    margin-bottom: 4px;
    display: block;
    font-size: 13.5px;
}

#wce-blocked-modal,
#wce-tasks-view-modal {
    animation: fadeIn 0.3s ease;
}

.wce-task-view-item {
    transition: transform 0.2s ease;
}

.wce-task-view-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.wce-msg.pinned {
    border: 2px solid #f44336;
    background: #fff9f9 !important;
}

.wce-msg.starred {
    border-left: 4px solid #ffb300;
}

.wce-msg-actions button:hover {
    background: #f0f0f0;
    border-radius: 50%;
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

/* Embedded Mode for Sidebar */
#wce-chat-widget.embedded-mode {
    position: relative !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    z-index: 1 !important;
    display: flex !important;
}

#wce-chat-widget.embedded-mode #wce-chat-header {
    border-radius: 0 !important;
    padding: 12px 15px !important;
    box-shadow: none !important;
    cursor: default !important;
}

#wce-chat-widget.embedded-mode #wce-chat-header #wce-chat-toggle {
    display: none !important;
}

#wce-chat-widget.embedded-mode #wce-chat-body {
    display: flex !important;
    height: calc(100vh - 280px) !important;
    border-radius: 0 !important;
}

#wce-chat-widget.embedded-mode .wce-total-unread-badge {
    display: none !important;
}

#wce-chat-widget.embedded-mode #wce-chat-history {
    background: #f8f9fa !important;
}

#wce-chat-widget.embedded-mode #wce-user-list {
    border-radius: 0 !important;
}

/* Mini Mode Styles for Video Call */
#wce-video-call-overlay.wce-mini-mode {
    width: 320px !important;
    height: 240px !important;
    top: auto;
    left: auto;
    bottom: 20px;
    right: 20px;
    border-radius: 20px;
    overflow: hidden;
    backdrop-filter: none !important;
    background: #111 !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    cursor: move;
    transition: width 0.3s, height 0.3s, border-radius 0.3s, background 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#wce-video-call-overlay.wce-mini-mode #wce-remote-video-container {
    height: calc(100% - 50px) !important;
}

#wce-video-call-overlay.wce-mini-mode #wce-local-video-container {
    width: 80px !important;
    height: 60px !important;
    bottom: 10px !important;
    right: 10px !important;
    border-radius: 10px !important;
    border-width: 1px !important;
}

.wce-call-control-bar {
    gap: 20px;
}

#wce-video-call-overlay.wce-mini-mode .wce-call-control-bar {
    gap: 6px !important;
}

#wce-video-call-overlay.wce-mini-mode .wce-call-control-btn {
    width: 28px !important;
    height: 28px !important;
}

#wce-video-call-overlay.wce-mini-mode .wce-call-control-btn svg {
    width: 12px !important;
    height: 12px !important;
}

/* Right Sidebar Overlay Styles */
.chat-sidebar-overlay {
    position: fixed;
    top: 0 !important;
    right: 0 !important;
    width: 400px;
    height: 100vh !important;
    background: var(--sidebar-bg, #1e1e1e);
    z-index: 100000;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border);
}

.chat-sidebar-overlay.hidden {
    transform: translateX(101%);
}

#chat-sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: transparent;
    backdrop-filter: none;
    z-index: 99999;
    pointer-events: none;
}

#chat-sidebar-backdrop.hidden {
    display: none;
}

/* Adjust chat widget for the right sidebar drawer */
#app-chat-sidebar #wce-chat-widget {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    z-index: 1 !important;
    background: #fff !important;
}

#app-chat-sidebar #wce-chat-header {
    border-radius: 0 !important;
    padding: 15px 20px !important;
    background: var(--primary) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

#app-chat-sidebar #wce-active-call-bar {
    border-radius: 0 !important;
    margin: 0 !important;
    flex-shrink: 0;
}

#app-chat-sidebar #wce-chat-body {
    flex: 1 !important;
    height: 0 !important;
    min-height: 0;
    border-radius: 0 !important;
    display: block !important;
    /* Stack them for absolute positioning overlap */
    position: relative;
}

#app-chat-sidebar #wce-chat-area {
    display: none;
}

#app-chat-sidebar #wce-chat-area:not([style*="display: none"]) {
    display: flex !important;
    flex-direction: column !important;
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    z-index: 5;
    background: #fff;
}

#app-chat-sidebar #wce-user-list {
    height: 100% !important;
    width: 100% !important;
    display: block;
}

#app-chat-sidebar #wce-user-list[style*="display: none"] {
    display: none !important;
}

/* Force Mutual Exclusivity: List vs Detail */
#app-chat-sidebar #wce-chat-area:not([style*="display: none"])~#wce-user-list,
#app-chat-sidebar #wce-chat-area:not(.wce-hidden)~#wce-user-list {
    display: none !important;
}

#app-chat-sidebar #wce-chat-history {
    flex: 1 !important;
    overflow-y: auto !important;
}

#app-chat-sidebar #wce-chat-controls {
    flex-shrink: 0;
}

/* Video Conference Side Thumbnails */
#wce-video-thumbnails::-webkit-scrollbar {
    width: 6px;
}
#wce-video-thumbnails::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
}

.wce-thumbnail-item {
    width: 100%;
    aspect-ratio: 4/3;
    background: #111;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}
.wce-thumbnail-item:hover {
    border-color: rgba(255,255,255,0.4);
}
.wce-thumbnail-item.active {
    border-color: var(--primary);
}
.wce-thumbnail-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.wce-thumbnail-label {
    position: absolute;
    bottom: 5px;
    left: 5px;
    background: rgba(0,0,0,0.5);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    max-width: 80%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Invite List Item */
.wce-invite-item {
    display: flex;
    align-items: center;
    padding: 10px;
    gap: 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
}
.wce-invite-item:hover {
    background: #f5f5f5;
}
.wce-invite-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}
.wce-invite-info {
    flex: 1;
}
.wce-invite-name {
    font-weight: 600;
    font-size: 14px;
    color: #333;
}
.wce-invite-sub {
    font-size: 12px;
    color: #666;
}
.wce-invite-btn {
    padding: 6px 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 80px;
}
.wce-invite-btn:hover {
    background: var(--primary-dark, #0056b3);
}
.wce-invite-btn.calling {
    background: #ff9800; /* Turuncu (Aramada) */
    position: relative;
}
.wce-invite-btn.calling:hover {
    background: #ff3b30 !important; /* Kırmızı (İptal Et) */
}
.wce-invite-btn.calling:hover span {
    display: none;
}
.wce-invite-btn.calling:hover::after {
    content: 'İptal Et';
    display: inline-block;
}
.wce-invite-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}