@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --wa-green: #25D366;
    --wa-green-dark: #128C7E;
    --wa-teal: #075E54;
    --wa-bg-light: #ECE5DD;
    --wa-chat-bg: #efeae2;
    --wa-bubble-out: #d9fdd3;
    --wa-bubble-in: #ffffff;
    --ig-pink: #E1306C;
    --ig-purple: #833AB4;
    --ig-orange: #F77737;
    --tg-blue: #229ED9;
    --tg-dark: #168AC2;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-active: #25D366;
    --card-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.05);
}

/* ===================== OMNICHANNEL BRAND LOGO ===================== */
.brand-icon-omni {
    position: relative;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-icon-omni > .bi-whatsapp {
    color: var(--wa-green);
    font-size: 1.6rem;
}

/* Kanal indicator dots in sidebar */
.sidebar-channel-dots {
    display: flex;
    gap: 3px;
    align-items: center;
}
.channel-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
}
.wa-dot { background: var(--wa-green); }
.ig-dot { background: var(--ig-pink); }
.tg-dot { background: var(--tg-blue); }

/* ===================== CHANNEL INDICATOR BADGES (Chat list) ===================== */
.channel-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    font-size: 0.6rem;
    font-weight: 700;
    border: 1.5px solid #fff;
    position: absolute;
    bottom: 0;
    right: 0;
}
.channel-badge-wa { background: var(--wa-green); color: #fff; }
.channel-badge-ig { background: linear-gradient(135deg, var(--ig-pink), var(--ig-purple)); color: #fff; }
.channel-badge-tg { background: var(--tg-blue); color: #fff; }

/* ===================== MSG BUBBLE PER CHANNEL ===================== */
.msg-outbound.ig-bubble { background: linear-gradient(135deg, #fce4ec, #f3e5f5); }
.msg-outbound.tg-bubble { background: #e3f2fd; }

/* Channel filter bar */
.channel-filter-bar {
    display: flex;
    gap: 0.4rem;
    padding: 0.6rem 0.85rem;
    border-bottom: 1px solid #f1f5f9;
    background: #fff;
    overflow-x: auto;
}
.channel-filter-bar::-webkit-scrollbar { display: none; }

.cfilter-btn {
    flex-shrink: 0;
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    border: 1.5px solid #e2e8f0;
    background: #f8fafc;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.cfilter-btn:hover { border-color: #cbd5e1; background: #f1f5f9; }
.cfilter-btn.active-all  { background: #1e293b; color: #fff; border-color: #1e293b; }
.cfilter-btn.active-wa   { background: var(--wa-green); color: #fff; border-color: var(--wa-green); }
.cfilter-btn.active-ig   { background: var(--ig-pink); color: #fff; border-color: var(--ig-pink); }
.cfilter-btn.active-tg   { background: var(--tg-blue); color: #fff; border-color: var(--tg-blue); }

/* ===================== CHANNEL STATUS CARDS (Dashboard & Channels page) ===================== */
.channel-stat-card {
    border-radius: 14px;
    padding: 1.25rem;
    border: 1px solid;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s ease;
}
.channel-stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.08); }

.channel-stat-card.wa-card {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border-color: rgba(37,211,102,0.25);
}
.channel-stat-card.ig-card {
    background: linear-gradient(135deg, #fdf2f8, #fce7f3);
    border-color: rgba(225,48,108,0.2);
}
.channel-stat-card.tg-card {
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    border-color: rgba(34,158,217,0.2);
}

.cstat-icon {
    width: 46px; height: 46px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
}
.cstat-icon-wa { background: linear-gradient(135deg, #25D366, #128C7E); color: #fff; }
.cstat-icon-ig { background: linear-gradient(135deg, #E1306C, #833AB4); color: #fff; }
.cstat-icon-tg { background: linear-gradient(135deg, #229ED9, #168AC2); color: #fff; }



body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: #f8fafc;
    color: #1e293b;
    overflow-x: hidden;
}

/* Sidebar */
.app-sidebar {
    width: 260px;
    min-height: 100vh;
    background-color: var(--sidebar-bg);
    color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    padding: 1.5rem 1.25rem;
    font-size: 1.25rem;
    font-weight: 800;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    text-decoration: none;
}

.sidebar-brand i {
    color: var(--wa-green);
    font-size: 1.6rem;
}

.sidebar-menu {
    padding: 1.25rem 0.75rem;
    list-style: none;
    margin: 0;
    flex-grow: 1;
}

.sidebar-menu .menu-header {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    font-weight: 700;
    padding: 0.75rem 0.75rem 0.35rem;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.7rem 0.85rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s ease;
    margin-bottom: 0.2rem;
}

.sidebar-menu li a:hover,
.sidebar-menu li.active a {
    color: #fff;
    background-color: rgba(37, 211, 102, 0.12);
}

.sidebar-menu li.active a {
    color: var(--wa-green);
    font-weight: 600;
}

.sidebar-menu li a i {
    font-size: 1.15rem;
}

/* Main Content Area */
.app-main {
    margin-left: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.app-navbar {
    background: #fff;
    padding: 0.85rem 2rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 999;
}

.page-container {
    padding: 2rem;
    flex-grow: 1;
}

/* Cards */
.card-custom {
    background: #fff;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card-custom:hover {
    box-shadow: 0 10px 25px -3px rgba(15, 23, 42, 0.08);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}

/* WhatsApp Chat Interface */
/* WhatsApp & Omnichannel Chat Interface (3-Column CRM) */
.chat-wrapper {
    height: calc(100vh - 120px);
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    display: flex;
    box-shadow: 0 4px 16px rgba(0,0,0,0.04);
}

/* Sol Panel: Kanal & Sohbet Listesi */
.chat-sidebar {
    width: 320px;
    min-width: 300px;
    max-width: 340px;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    background: #fff;
}

.channel-nav {
    display: flex;
    gap: 0.5rem;
    padding: 0.85rem 0.85rem 0.4rem 0.85rem;
}

.channel-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.45rem 0.75rem;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
}

.channel-btn.active.wa {
    background: #25D366;
    color: #fff;
    border-color: #25D366;
}

.channel-btn.active.tg {
    background: #229ED9;
    color: #fff;
    border-color: #229ED9;
}

.account-selector-box {
    padding: 0.4rem 0.85rem;
}

.chat-search-wrap {
    padding: 0.4rem 0.85rem;
}

.chat-filter-chips {
    display: flex;
    gap: 0.35rem;
    padding: 0.4rem 0.85rem 0.65rem 0.85rem;
    border-bottom: 1px solid #f1f5f9;
    overflow-x: auto;
}

.chip-btn {
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.65rem;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.chip-btn.active, .chip-btn:hover {
    background: #ea580c;
    color: #fff;
    border-color: #ea580c;
}

.chat-list {
    flex-grow: 1;
    overflow-y: auto;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 0.85rem;
    border-bottom: 1px solid #f8fafc;
    cursor: pointer;
    transition: background 0.15s ease;
    text-decoration: none;
    color: inherit;
    position: relative;
}

.chat-item:hover {
    background: #f8fafc;
}

.chat-item.active {
    background: #fff7ed;
    border-left: 3px solid #ea580c;
}

.avatar-wrapper {
    position: relative;
    flex-shrink: 0;
}

.chat-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    font-weight: 700;
    font-size: 0.95rem;
}

.status-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 11px;
    height: 11px;
    background: #22c55e;
    border: 2px solid #fff;
    border-radius: 50%;
}

/* Orta Panel: Aktif Mesaj Akışı */
.chat-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background: #fdfbf7;
    background-image: radial-gradient(#d5ccbd 0.85px, transparent 0.85px);
    background-size: 22px 22px;
    min-width: 360px;
}

.chat-header {
    background: #fff;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-messages {
    flex-grow: 1;
    padding: 1.25rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.msg-bubble {
    max-width: 65%;
    padding: 0.65rem 0.95rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.45;
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.msg-inbound {
    align-self: flex-start;
    background: #ffffff;
    border-top-left-radius: 2px;
}

.msg-outbound {
    align-self: flex-end;
    background: #dcf8c6;
    border-top-right-radius: 2px;
}

.chat-composer-bar {
    background: #fff;
    padding: 0.75rem 1rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.composer-tool-btn {
    background: none;
    border: none;
    color: #64748b;
    font-size: 1.25rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s ease;
}

.composer-tool-btn:hover {
    background: #f1f5f9;
    color: #ea580c;
}

.composer-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #ea580c;
    border: none;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.composer-send-btn:hover {
    background: #c2410c;
}

/* Sağ Panel: Müşteri Profili & CRM Detayları (Görsel 3) */
.chat-crm-sidebar {
    width: 320px;
    min-width: 290px;
    max-width: 340px;
    border-left: 1px solid #e2e8f0;
    background: #fff;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.crm-profile-header {
    padding: 1.5rem 1rem 1rem 1rem;
    text-align: center;
    border-bottom: 1px solid #f1f5f9;
    position: relative;
}

.crm-avatar-large {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #fef08a;
    color: #854d0e;
    font-size: 1.6rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.65rem;
    position: relative;
}

.crm-nav-tabs {
    display: flex;
    padding: 0.75rem 1rem;
    gap: 0.5rem;
    border-bottom: 1px solid #f1f5f9;
}

.crm-tab-btn {
    flex: 1;
    padding: 0.45rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s ease;
}

.crm-tab-btn.active {
    background: #ea580c;
    color: #fff;
    border-color: #ea580c;
}

.crm-info-list {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.crm-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
    padding-bottom: 0.45rem;
    border-bottom: 1px dashed #f1f5f9;
}

.crm-info-label {
    color: #64748b;
    font-weight: 500;
}

.crm-info-val {
    color: #1e293b;
    font-weight: 600;
    text-align: right;
}

/* Badges */
.badge-status-read {
    color: #3b82f6; /* Blue tick */
}
.badge-status-delivered {
    color: #64748b;
}

.badge-bot {
    background-color: #ede9fe;
    color: #6d28d9;
    font-size: 0.7rem;
    padding: 0.15rem 0.45rem;
    border-radius: 6px;
}

.badge-agent {
    background-color: #dbeafe;
    color: #1e40af;
    font-size: 0.7rem;
    padding: 0.15rem 0.45rem;
    border-radius: 6px;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.25s ease-out;
}

/* Chat Toolbar Popups & Extras */
.chat-filter-chips {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}
.chat-filter-chips::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

.composer-attach-menu {
    position: absolute;
    bottom: 58px;
    left: 12px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 25px rgba(0,0,0,0.12);
    width: 175px;
    padding: 6px 0;
    z-index: 1050;
    display: flex;
    flex-direction: column;
}

.attach-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font-size: 0.86rem;
    font-weight: 500;
    color: #334155;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.attach-item:hover {
    background: #f8fafc;
    color: #ea580c;
}

.attach-item i {
    font-size: 1.15rem;
    width: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.emoji-picker-box {
    position: absolute;
    bottom: 58px;
    left: 110px;
    background: #fff;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 12px 32px rgba(0,0,0,0.16);
    width: 320px;
    height: 380px;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.product-grid-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.product-grid-card:hover {
    border-color: #ea580c;
    box-shadow: 0 4px 14px rgba(234, 88, 12, 0.15);
}

.product-img-box {
    width: 100%;
    height: 100px;
    border-radius: 8px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 8px;
}

.product-img-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
}
