/*
 * MYBHEG Kurumsal İletişim Paneli - Özel Stiller
 */

:root {
    --brand-primary: #1a2a6c;
    /* Deep Navy Blue */
    --brand-secondary: #004e92;
    --bg-color: #f4f7f6;
    --sidebar-width: 80px;
    --chatlist-width: 350px;
    --border-color: #e5e7eb;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --msg-received-bg: #ffffff;
    --msg-sent-bg: #1a2a6c;
    --msg-sent-text: #ffffff;
}

body {
    background-color: var(--bg-color);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text-main);
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* =========================================
   Column 1: Narrow Sidebar
========================================= */
.sidebar-nav {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 1.5rem;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 10;
    flex-shrink: 0;
}

.sidebar-logo {
    color: #fff;
    font-weight: 800;
    font-size: 0.8rem;
    text-align: center;
    margin-bottom: 2rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    letter-spacing: 1px;
}

.nav-item {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.nav-item:hover,
.nav-item.active {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.2);
}

/* =========================================
   Column 2: Chat List
========================================= */
.chat-list-pane {
    width: var(--chatlist-width);
    background-color: #ffffff;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 5;
    flex-shrink: 0;
}

.list-header {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.list-header h5 {
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--brand-primary);
}

.search-box {
    background-color: var(--bg-color);
    border: none;
    border-radius: 20px;
    padding: 0.5rem 1rem;
    padding-left: 2.5rem;
    width: 100%;
    font-size: 0.9rem;
}

.search-icon {
    position: absolute;
    left: 25px;
    top: 76px;
    color: var(--text-muted);
}

.conversations {
    flex-grow: 1;
    overflow-y: auto;
}

.chat-list-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
}

.chat-list-item:hover {
    background-color: #f9fafb;
}

.chat-list-item.active {
    background-color: #eff6ff;
    border-left: 4px solid var(--brand-primary);
}

.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--brand-primary);
    background-image: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-right: 1rem;
    flex-shrink: 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    position: relative;
}

.online-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background-color: #10b981;
    /* Emerald green */
    border: 2px solid #ffffff;
    border-radius: 50%;
}

.chat-info {
    flex-grow: 1;
    min-width: 0;
}

.chat-name-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.25rem;
}

.chat-name {
    font-weight: 600;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.chat-snippetRow {
    display: flex;
    align-items: center;
}

.chat-snippet {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
}

.unread-dot {
    width: 10px;
    height: 10px;
    background-color: var(--brand-primary);
    border-radius: 50%;
    margin-left: 0.5rem;
}

.tag-badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    border-radius: 12px;
    margin-left: 0.5rem;
    background-color: #e5e7eb;
    color: var(--text-muted);
}


/* =========================================
   Column 3: Main Chat & CRM
========================================= */
.main-content {
    flex-grow: 1;
    display: flex;
    background-color: #e4efe9;
    /* subtle texture background */
    background-image:
        radial-gradient(at 40% 20%, hsla(28, 100%, 74%, 0) 0px, transparent 50%),
        radial-gradient(at 80% 0%, hsla(189, 100%, 56%, 0) 0px, transparent 50%),
        radial-gradient(at 0% 50%, hsla(355, 100%, 93%, 0.5) 0px, transparent 50%),
        radial-gradient(at 80% 50%, hsla(340, 100%, 76%, 0) 0px, transparent 50%),
        radial-gradient(at 0% 100%, hsla(22, 100%, 77%, 0) 0px, transparent 50%),
        radial-gradient(at 80% 100%, hsla(242, 100%, 70%, 0) 0px, transparent 50%),
        radial-gradient(at 0% 0%, hsla(343, 100%, 76%, 0) 0px, transparent 50%);
}

.chat-window {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 400px;
}

.chat-header {
    height: 70px;
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 2;
}

.header-user-info {
    display: flex;
    align-items: center;
}

.status-badge {
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.status-ai {
    background-color: #d1fae5;
    color: #065f46;
}

.status-manual {
    background-color: #fee2e2;
    color: #991b1b;
}

.messages-area {
    flex-grow: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message-bubble {
    max-width: 65%;
    padding: 0.85rem 1.15rem;
    border-radius: 14px;
    position: relative;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.06);
    font-size: 0.95rem;
    line-height: 1.4;
    word-break: break-word;
    white-space: pre-wrap;
    animation: fadeInBubble 0.3s ease-out forwards;
}

@keyframes fadeInBubble {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.msg-received {
    align-self: flex-start;
    background-color: var(--msg-received-bg);
    border-bottom-left-radius: 0;
}

.msg-received::after {
    content: '';
    position: absolute;
    left: -10px;
    bottom: 0;
    width: 0;
    height: 0;
    border-right: 10px solid var(--msg-received-bg);
    border-top: 10px solid transparent;
    border-bottom: 0 solid transparent;
}

.msg-sent {
    align-self: flex-end;
    background-color: var(--msg-sent-bg);
    color: var(--msg-sent-text);
    border-bottom-right-radius: 0;
}

.msg-sent::after {
    content: '';
    position: absolute;
    right: -10px;
    bottom: 0;
    width: 0;
    height: 0;
    border-left: 10px solid var(--msg-sent-bg);
    border-top: 10px solid transparent;
    border-bottom: 0 solid transparent;
}

.msg-time {
    display: block;
    font-size: 0.65rem;
    opacity: 0.7;
    margin-top: 0.25rem;
    text-align: right;
}

.chat-input-area {
    padding: 1rem 1.5rem;
    background-color: #ffffff;
    border-top: 1px solid var(--border-color);
}

.input-container {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.message-input {
    border-radius: 24px;
    padding: 0.85rem 1.25rem;
    background-color: var(--bg-color);
    border: 1px solid transparent;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.message-input:focus {
    border-color: rgba(26, 42, 108, 0.4);
    /* brand-primary with opacity */
    box-shadow: 0 0 0 4px rgba(26, 42, 108, 0.1), inset 0 1px 2px rgba(0, 0, 0, 0.01);
    background-color: #ffffff;
}

.btn-send {
    background-color: var(--brand-primary);
    color: white;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background-color 0.2s;
}

.btn-send:hover {
    background-color: var(--brand-secondary);
    color: white;
    transform: scale(1.05);
}

/* =========================================
   CRM Sidebar (Collapsible)
========================================= */
.crm-sidebar {
    width: 300px;
    background-color: #ffffff;
    border-left: 1px solid var(--border-color);
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.3s ease, border 0.3s ease, opacity 0.2s ease;
    flex-shrink: 0;
}

.crm-sidebar-inner {
    padding: 1.5rem;
    width: 300px;
    /* Sabit genişlik, daralma anında içeriğin ezilmemesi için */
}

.crm-sidebar.collapsed {
    width: 0;
    border-left-color: transparent;
    opacity: 0;
}

.crm-header {
    font-weight: 700;
    color: var(--brand-primary);
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    border-bottom: 2px solid var(--bg-color);
    padding-bottom: 0.5rem;
}

.crm-card {
    background-color: #ffffff;
    /* White background for card */
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.crm-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.06);
}

.info-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem;
}

.info-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.info-value {
    font-weight: 500;
    font-size: 0.95rem;
}

.toggle-switch-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-top: 1rem;
}

.form-switch .form-check-input {
    width: 2.5em;
    height: 1.25em;
}

.form-switch .form-check-input:checked {
    background-color: #dc3545;
    /* Red for intervention lock */
    border-color: #dc3545;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}