/* assets/css/panel.css */

body {
    background-color: #f4f6f9;
    font-family: 'Figtree', 'Segoe UI', system-ui, -apple-system, sans-serif;
    padding-bottom: 30px; /* Alt boşluk azaltıldı */
    font-size: 0.92rem; /* Font boyutu optimize edildi */
}

/* KART VE GÖVDE */
.card {
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    border-radius: 8px;
    background-color: #fff;
    margin-bottom: 20px;
}
.card-header {
    background-color: #fff;
    border-bottom: 1px solid #eee;
    padding: 10px 20px 0 20px; /* Üst boşluk azaltıldı */
    border-radius: 8px 8px 0 0 !important;
}
.card-body {
    padding: 20px;
}

/* SEKMELER (TABS) */
.nav-tabs {
    border-bottom: 2px solid #f0f0f0;
    gap: 2px;
}
.nav-tabs .nav-link {
    border: none;
    color: #6c757d;
    font-weight: 600;
    padding: 10px 15px;
    border-radius: 6px 6px 0 0;
    transition: 0.2s;
}
.nav-tabs .nav-link:hover {
    background-color: #f8f9fa;
    color: #333;
}
.nav-tabs .nav-link.active {
    color: #0d6efd;
    background-color: #fff;
    border-bottom: 2px solid #0d6efd;
    margin-bottom: -2px;
}

/* SWITCH DÜZELTMESİ (SVG GÖMÜLÜ) */
.form-check.form-switch {
    display: flex;
    align-items: center;
    padding-left: 2.8em;
    min-height: 22px;
}
.form-switch .form-check-input {
    width: 2.5em;
    height: 1.3em;
    margin-left: -2.8em;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba%280, 0, 0, 0.25%29'/%3e%3c/svg%3e");
    background-position: left center;
    border-radius: 2em;
    cursor: pointer;
    border: 1px solid #adb5bd;
}
.form-switch .form-check-input:checked {
    background-position: right center;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
    background-color: #0d6efd;
    border-color: #0d6efd;
}

/* FORM ELEMANLARI */
.form-label {
    font-weight: 600;
    color: #34495e;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
}
.form-control, .form-select {
    font-size: 0.9rem;
    padding: 0.6rem 0.8rem;
    border-color: #dee2e6;
    border-radius: 6px;
}
.form-text { font-size: 0.8rem; color: #8898aa; }

/* REQ YILDIZI */
.req-star { color: #dc3545; margin-left: 3px; font-weight: bold; }

/* SİHİRBAZ ADIMLARI */
.step-indicator { display: flex; justify-content: space-between; margin-bottom: 25px; position: relative; padding: 0 20px; }
.step-indicator::before { content: ''; position: absolute; top: 14px; left: 20px; right: 20px; height: 2px; background: #e9ecef; z-index: 0; }
.step { position: relative; z-index: 1; background: #fff; width: 30px; height: 30px; border-radius: 50%; border: 2px solid #e9ecef; display: flex; align-items: center; justify-content: center; font-weight: bold; color: #adb5bd; font-size: 12px; transition: 0.3s; }
.step.active { border-color: #0d6efd; color: #0d6efd; background: #e7f1ff; box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1); }
.step.completed { background: #0d6efd; color: #fff; border-color: #0d6efd; }
/* ========================================================== */
/* 6. MESAJLAŞMA MODÜLÜ (TEMİZ VE ÇAKIŞMASIZ)                 */
/* ========================================================== */

.chat-container { 
    display: grid; 
    grid-template-columns: 300px 1fr; 
    gap: 0; 
    height: calc(100vh - 140px);
    min-height: 500px; 
    border: 1px solid #e0e0e0; 
    border-radius: 12px; 
    overflow: hidden; 
    background: white; 
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
}

/* --- SOL TARA (KİŞİ LİSTESİ) --- */
.chat-sidebar { 
    background: #fcfcfc; 
    border-right: 1px solid #e0e0e0; 
    display: flex; flex-direction: column; overflow: hidden; 
}
.chat-sidebar-header { 
    padding: 15px; border-bottom: 1px solid #eee; background: #fff; flex-shrink: 0; 
}

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

.contact-item { 
    padding: 15px; border-bottom: 1px solid #f9f9f9; cursor: pointer; 
    display: flex; align-items: center; gap: 12px; 
    text-decoration: none; color: var(--text); position: relative; transition: 0.2s;
}
.contact-item:hover { background: #f1f4f8; }
.contact-item.active { background: #eef6fc; border-left: 4px solid #0d6efd; }

.contact-avatar { 
    width: 42px; height: 42px; background: #e0e0e0; border-radius: 50%; 
    display: flex; align-items: center; justify-content: center; 
    font-weight: 700; color: #555; flex-shrink: 0; font-size: 14px; position: relative;
}
.role-badge-icon { 
    position: absolute; bottom: -2px; right: -4px; 
    color: white; font-size: 9px; padding: 2px 4px; border-radius: 4px; border: 1px solid #fff;
}

.contact-info { flex: 1; min-width: 0; }
.contact-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #2c3e50; }
.contact-role { font-size: 11px; color: #888; display: block; margin-top: 2px; }

/* --- SAĞ TARAF (SOHBET) --- */
.chat-main { display: flex; flex-direction: column; background: #fff; overflow: hidden; position: relative; }

.chat-header { 
    padding: 0 20px; height: 65px; border-bottom: 1px solid #eee; 
    background: #fff; display: flex; align-items: center; gap: 15px; flex-shrink: 0; z-index: 10;
}

.chat-messages { 
    flex: 1; padding: 20px; overflow-y: auto; background-color: #f0f2f5; 
    display: flex; flex-direction: column; gap: 10px; 
}

.message-bubble { 
    max-width: 75%; padding: 10px 14px; border-radius: 12px; position: relative; 
    font-size: 14px; line-height: 1.5; word-wrap: break-word; box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.message-sent { align-self: flex-end; background: #d1e7dd; color: #111; border-bottom-right-radius: 2px; }
.message-received { align-self: flex-start; background: #fff; color: #333; border-bottom-left-radius: 2px; }

.msg-time { font-size: 10px; color: rgba(0,0,0,0.45); text-align: right; margin-top: 4px; display: block; }
.msg-file-attach { display: flex; align-items: center; gap: 8px; margin-top: 8px; background: rgba(0,0,0,0.05); padding: 8px 12px; border-radius: 6px; text-decoration: none; color: #333; font-size: 12px; font-weight: 600; }

/* Yazma Alanı */
.chat-input-area { 
    padding: 15px; border-top: 1px solid #eee; background: #fff; 
    display: flex; gap: 10px; align-items: center; flex-shrink: 0; 
}
.chat-textarea { 
    flex: 1; border: 1px solid #ddd; border-radius: 24px; padding: 12px 20px; 
    resize: none; height: 46px; outline: none; font-family: inherit; font-size: 14px; 
    background: #f9f9f9 !important; color: #333 !important;
}
.chat-textarea:focus { background: #fff !important; border-color: #0d6efd !important; }

/* Butonlar */
.btn-new-chat { 
    width: 100%; background-color: #0d6efd !important; color: #fff !important; 
    border: none; padding: 12px; border-radius: 8px; cursor: pointer; 
    font-weight: 600; font-size: 13px; display: flex; align-items: center; justify-content: center; gap: 8px; 
}
.btn-new-chat:hover { background-color: #0b5ed7 !important; }

.btn-send { 
    background-color: #0d6efd !important; color: white !important; 
    width: 50px !important; height: 46px !important; border-radius: 12px !important; 
    border: none; display: flex; align-items: center; justify-content: center; cursor: pointer; 
}
.btn-send:hover { background-color: #0b5ed7 !important; transform: scale(1.05); }
.btn-send i { font-size: 18px !important; color: white !important; }

.file-btn { 
    background-color: #f0f2f5 !important; color: #606770 !important; 
    width: 46px !important; height: 46px !important; border-radius: 12px !important; 
    border: none; cursor: pointer; display: flex; align-items: center; justify-content: center;
}

.unread-badge { 
    background-color: #dc3545 !important; color: white !important; 
    font-size: 10px; font-weight: bold; padding: 2px 6px; border-radius: 10px; 
}

/* Mobil */
.mobile-back-btn { display: none; margin-right: 10px; color: #0d6efd; font-size: 18px; text-decoration: none; }
@media (max-width: 768px) {
    .chat-container { grid-template-columns: 1fr; height: calc(100vh - 100px); border: none; }
    .chat-container.chat-active .chat-sidebar { display: none; }
    .chat-container.chat-active .chat-main { display: flex; width: 100%; height: 100%; }
    .chat-container:not(.chat-active) .chat-sidebar { display: flex; width: 100%; height: 100%; }
    .chat-container:not(.chat-active) .chat-main { display: none; }
    .mobile-back-btn { display: inline-flex; }
}

/* ========================================================== */
/* 7. MODAL (PENCERE) DÜZENLEMELERİ                           */
/* ========================================================== */

/* Bootstrap Çakışmasını Önlemek İçin İsim Değişti: .custom-modal */
.custom-modal {
    display: none;
    position: fixed;
    z-index: 2050; /* Bootstrap modalından yüksek */
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 480px;
    background-color: #fff;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    padding: 25px;
    border: 1px solid rgba(0,0,0,0.1);
    height: auto !important; /* Yüksekliği içeriğe göre ayarla */
    max-height: 85vh; /* Taarsa kaydırma olsun */
    overflow: visible; /* Dropdown dışarı taşabilsin diye */
}

.custom-overlay {
    display: none;
    position: fixed;
    z-index: 2040;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.custom-modal h4 { margin-top: 0; font-size: 18px; font-weight: 700; color: #111; margin-bottom: 5px; }
.custom-modal p { color: #666; font-size: 13px; margin-bottom: 20px; }

/* Arama Alanı */
.search-wrapper {
    position: relative; /* Sonuçlar buna göre hizalanacak */
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 12px 40px 12px 15px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    box-sizing: border-box;
}
.search-input:focus { border-color: #0d6efd; }

.clear-search-btn {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: #999; cursor: pointer; font-size: 16px; display: none;
}

/* Arama Sonuçları (Taşmayı Önler ve Hizalar) */
.search-results-container {
    position: absolute;
    top: 100%; left: 0; width: 100%;
    background: white;
    border: 1px solid #e5e7eb;
    border-top: none;
    border-bottom-left-radius: 8px; border-bottom-right-radius: 8px;
    max-height: 250px; overflow-y: auto;
    z-index: 2060;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    display: none;
    box-sizing: border-box;
    margin-top: 2px;
}

.search-result-item {
    padding: 12px 15px; border-bottom: 1px solid #f3f4f6; cursor: pointer;
    display: flex; align-items: center; transition: 0.1s;
}
.search-result-item:hover { background-color: #f8f9fa; }
.search-result-item:last-child { border-bottom: none; }