html, body {
  height: 100%;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;           /* yatay kaymayı kesinlikle engelle */
  overflow-y: scroll;          /* scrollbar hep görünsün -> layout shift önler */
  scrollbar-gutter: stable;    /* modern tarayıcılarda yatay kayma önler */
}
*, *::before, *::after { box-sizing: inherit; }
.chat-container {

    display: flex;
    flex-direction: column;
    height: 90vh;
}
.no-active-chat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start; /* <-- ortadan değil üstten başlasın */
    padding-top: 50px; /* yukarıdan boşluk */
    text-align: center;
    color: #666;
    font-style: italic;
    height: 100%;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.header {
    color: rgb(0, 0, 0);
    text-align: center;
}

.container {
    max-width: 1100px;
    margin: 20px auto;
    padding: 0 15px;
}

/* Ana İçerik ve Sohbet Düzeni */
.main-content {
    display: flex;
    gap: 20px;
}

/* Sohbet Listesi */
.chat-list-container {
    width: 350px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    padding: 20px;
    flex-shrink: 0;
    height: 70vh;
    overflow-y: auto;
}

.chat-list-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.chat-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-list-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s;
    border-radius: 8px;
}

.chat-list-item:hover {
    background-color: #f5f5f5;
}

.chat-list-item.active {
    background-color: #e3f2fd;
    border-left: 3px solid #3f51b5;
}

.profile-pic {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.chat-info {
    flex: 1;
    margin-left: 12px;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Taşmayı önlemek için */
}

.username {
    font-weight: bold;
    margin-bottom: 4px;
    color: #1a1a1a;
}

.product-title {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 4px;
}

.last-message {
    color: #666;
    font-size: 0.9em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.last-date {
    font-size: 0.8em;
    color: #999;
    white-space: nowrap;
}

.no-chats {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
}

/* Sohbet Kutusu */
.chat-container {
    flex-grow: 1;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    height: 70vh;
    overflow: hidden;
}

.chat-header {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #ddd;
    background-color: #f9f9f9;
}

.back-button {
    font-size: 1.2rem;
    color: #555;
    margin-right: 15px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 5px;
}

.back-button:hover {
    color: #3f51b5;
}

.chat-title {
    flex-grow: 1;
    margin: 0;
    font-size: 1.5rem;
    color: #333;
}

.user-info {
    display: flex;
    align-items: center;
}

.chat-header .profile-pic {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 8px;
}

.chat-header .username {
    font-weight: bold;
    color: #444;
}

/* Mesajlar Bölümü */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-message {
    margin-bottom: 12px;
    max-width: 70%;
    display: flex;
    flex-direction: column;
}

.chat-message.sent {
    margin-left: auto;
    align-items: flex-end;
}

.chat-message.received {
    margin-right: auto;
    align-items: flex-start;
}

.message-text {
    display: inline-block;
    padding: 10px 15px;
    border-radius: 18px;
    background-color: #e3f2fd;
    word-wrap: break-word;
    max-width: 100%;
}

.chat-message.sent .message-text {
    background-color: #3f51b5;
    color: white;
    border-bottom-right-radius: 5px;
}

.chat-message.received .message-text {
    background-color: #e5e5ea;
    color: black;
    border-bottom-left-radius: 5px;
}

.message-time {
    font-size: 0.7em;
    color: #999;
    margin-top: 4px;
    padding: 0 5px;
}

/* Tarih Ayırıcı */
.date-divider {
    text-align: center;
    color: #999;
    font-size: 0.8em;
    margin: 16px 0;
    position: relative;
}

.date-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background-color: #eee;
    z-index: 1;
}

.date-divider span {
    background-color: white;
    padding: 0 12px;
    position: relative;
    z-index: 2;
}

/* Mesaj Formu */
.chat-form {
    display: flex;
    padding: 15px;
    border-top: 1px solid #ddd;
    background-color: #f9f9f9;
}

#message-input {
    flex-grow: 1;
    border: 1px solid #ccc;
    border-radius: 20px;
    padding: 12px 15px;
    font-size: 1rem;
    margin-right: 10px;
    outline: none;
    transition: border-color 0.3s;
}

#message-input:focus {
    border-color: #3f51b5;
}

#send-button {
    background-color: #3f51b5;
    color: white;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#send-button:hover {
    background-color: #303f9f;
}

/* Yükleme ve Durum Mesajları */
.loading-spinner {
    text-align: center;
    padding: 20px;
    color: #666;
    border: 4px solid rgba(0, 0, 0, 0.1);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border-left-color: #3f51b5;
    animation: spin 1s ease infinite;
    align-self: center;
    margin-top: 50px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.no-messages {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
}

.error {
    text-align: center;
    padding: 20px;
    color: #d32f2f;
    background-color: #ffebee;
    border-radius: 8px;
    margin: 20px;
}

/* Responsive Tasarım */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    
    .chat-list-container {
        width: 100%;
        height: 40vh;
    }
    
    .chat-container {
        height: 80vh;
    }
    
    .chat-message {
        max-width: 85%;
    }
}

/* Loading spinner */
.loading-spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #3f51b5;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.ilan-baslik {
  font-size: 0.8rem;
  color: #666;
  margin-top: 4px;
}

.chat-title-info {
  flex-grow: 1;
  margin: 0 15px;
}