/* ============================================================
   WhatsApp SaaS — Global CSS
   Bootstrap 5 üzerine özel stiller
   ============================================================ */

/* Sidebar */
#sidebar {
    width: 240px;
    min-height: 100vh;
    flex-shrink: 0;
    transition: width .2s ease;
}

#sidebar .nav-link {
    font-size: 14px;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 2px;
    transition: background .15s;
}

#sidebar .nav-link:hover {
    background: rgba(255,255,255,.08);
}

#sidebar .nav-link.active {
    background: rgba(255,255,255,.15) !important;
}

#page-content {
    min-height: 100vh;
}

/* ============================================================
   Chat Arayüzü
   ============================================================ */

/* Konuşma listesi */
.conversation-list {
    height: calc(100vh - 120px);
    overflow-y: auto;
    border-right: 1px solid #dee2e6;
}

.conversation-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background .15s;
}

.conversation-item:hover,
.conversation-item.active {
    background: #f0f7ff;
}

.conversation-item .contact-name {
    font-weight: 600;
    font-size: 14px;
}

.conversation-item .last-message {
    font-size: 12px;
    color: #6c757d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-item .time {
    font-size: 11px;
    color: #adb5bd;
}

/* Mesaj alanı */
.chat-area {
    height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8f9fa;
}

/* Mesaj baloncukları */
.message-bubble {
    max-width: 65%;
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
}

.message-bubble.out {
    align-self: flex-end;
    align-items: flex-end;
}

.message-bubble.in {
    align-self: flex-start;
    align-items: flex-start;
}

.bubble-content {
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.message-bubble.out .bubble-content {
    background: #dcf8c6;
    border-bottom-right-radius: 3px;
}

.message-bubble.in .bubble-content {
    background: #ffffff;
    border-bottom-left-radius: 3px;
    box-shadow: 0 1px 2px rgba(0,0,0,.08);
}

.bubble-time {
    font-size: 11px;
    color: #adb5bd;
    margin-top: 3px;
    padding: 0 4px;
}

.bubble-status {
    font-size: 11px;
    color: #adb5bd;
}

.bubble-status.read {
    color: #53bdeb;
}

/* Mesaj gönderme alanı */
.chat-input-area {
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #dee2e6;
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chat-input-area textarea {
    resize: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    max-height: 120px;
}

/* ============================================================
   QR Modal
   ============================================================ */
#qrCode {
    display: block;
    margin: 0 auto;
    max-width: 220px;
    border: 8px solid #fff;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,.1);
}

.qr-spinner {
    width: 220px;
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    background: #f8f9fa;
    border-radius: 8px;
}

/* ============================================================
   Dashboard İstatistik Kartları
   ============================================================ */
.stat-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    transition: transform .15s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

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

/* ============================================================
   Genel
   ============================================================ */
.table th {
    font-size: 13px;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.badge-status-active    { background: #d1fae5; color: #065f46; }
.badge-status-suspended { background: #fee2e2; color: #991b1b; }
.badge-status-connected { background: #d1fae5; color: #065f46; }
.badge-status-disconnected { background: #f3f4f6; color: #6b7280; }

/* Mobil */
@media (max-width: 768px) {
    #sidebar {
        position: fixed;
        z-index: 1000;
        left: -240px;
    }
    #sidebar.show {
        left: 0;
    }
    #page-content {
        width: 100%;
    }

    /* Chat mobil */
    .chat-messages {
        height: calc(100vh - 220px);
    }

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

    /* Ana içerik padding azalt */
    main.p-4 {
        padding: 8px !important;
    }

    /* Chat kartı tam ekran */
    .card[style*="calc(100vh - 140px)"] {
        height: calc(100vh - 110px) !important;
        border-radius: 0 !important;
    }

    /* Stat kartları */
    .stat-card .fs-4 {
        font-size: 1.2rem !important;
    }
}
