/* Google Fonts'tan Poppins yazı tipini import edelim */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap');

/* Genel sayfa stilleri */
html, body { height: 100%; overflow: hidden; }
body { 
    font-family: 'Poppins', sans-serif; 
    margin: 0; 
    padding: 0; 
    background: linear-gradient(135deg, #1a2639, #2a3b55); 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    min-height: 100%; 
    box-sizing: border-box; 
    transition: background 0.5s ease; 
}

/* Açık mod */
body.light-mode { background: linear-gradient(135deg, #f0f4f8, #d9e2ec); }
body.light-mode #chat-container { background: #ffffff; }
body.light-mode #chat-box { background: #f5f8fa; border-color: #d9e2ec; }
body.light-mode .message.bot-message div { background: linear-gradient(135deg, #e6ecef, #d9e2ec); color: #2a3b55; }
body.light-mode .message.user-message div { background: linear-gradient(135deg, #007bff, #0056b3); }
body.light-mode .timestamp { color: #6c757d; }
body.light-mode #input-area { background: #ffffff; border-color: #d9e2ec; }
body.light-mode #user-input { background: #f5f8fa; border-color: #ced4da; color: #2a3b55; }
body.light-mode #user-input:focus { border-color: #007bff; }
body.light-mode #control-bar { background: #ffffff; border-color: #d9e2ec; }
body.light-mode .mode-select { color: #2a3b55; background: #f5f8fa; }

/* Sohbet kutusunun ana taşıyıcısı */
#chat-container { 
    width: 100%; 
    max-width: 800px; 
    height: 90vh; 
    background: #2a3b55; 
    border-radius: 20px; 
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.4); 
    display: flex; 
    flex-direction: column; 
    overflow: hidden; 
    margin: 15px; 
    transition: background 0.5s ease; 
}

/* Başlık Stili */
#chat-title { 
    text-align: center; 
    font-size: 1.8em; 
    color: #ffffff; 
    margin: 20px 0; 
    font-weight: 600; 
    padding: 0 10px; 
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3); 
    transition: color 0.5s ease; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 10px; 
}
body.light-mode #chat-title { color: #2a3b55; text-shadow: none; }
.header-logo {
    height: 40px;
}

/* Mesajların görüneceği alan */
#chat-box {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    background: #34495e;
    border-top: 1px solid #465c71;
    border-bottom: 1px solid #465c71;
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.5s ease-in;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Webkit scrollbar stili */
#chat-box::-webkit-scrollbar { width: 8px; }
#chat-box::-webkit-scrollbar-track { background: #2a3b55; border-radius: 10px; }
#chat-box::-webkit-scrollbar-thumb { background: #7f8c8d; border-radius: 10px; }
#chat-box::-webkit-scrollbar-thumb:hover { background: #95a5a6; }
body.light-mode #chat-box::-webkit-scrollbar-track { background: #e9ecef; }
body.light-mode #chat-box::-webkit-scrollbar-thumb { background: #adb5bd; }

/* Genel mesaj stilleri */
.message { 
    margin-bottom: 20px; 
    max-width: 80%; 
    line-height: 1.5; 
    display: flex; 
    align-items: flex-start; 
    word-wrap: break-word; 
    animation: slideIn 0.4s ease-out; 
}
@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Bot mesajlarının stilleri */
.message.bot-message { 
    color: #ecf0f1; 
    align-self: flex-start; 
    margin-right: auto; 
    position: relative; 
    padding-left: 40px; 
}

/* Bot mesajı içeriği */
.message.bot-message div { 
    background: linear-gradient(135deg, #3d566e, #34495e); 
    padding: 15px 20px; 
    border-radius: 15px; 
    max-width: 100%; 
    position: relative; 
    min-height: 30px; 
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3); 
    transition: background 0.5s ease; 
}
body.light-mode .message.bot-message div { background: linear-gradient(135deg, #e6ecef, #d9e2ec); color: #2a3b55; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1); }
.message.bot-message p { margin: 0; margin-bottom: 18px; }
.message.bot-message::before {
    content: '';
    background: url('https://github.com/kyrosil/kyrosilrewards/raw/main/indir.png') no-repeat center center;
    background-size: cover;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    position: absolute;
    left: 0;
    top: 0;
}
/* Varsayılan veya dinamik avatarları gizle */
.message.bot-message img:not([class="header-logo"]) {
    display: none;
}

/* Kullanıcı mesajlarının stilleri */
.message.user-message {
    align-self: flex-end;
    margin-left: auto;
}

/* Kullanıcı mesaj içeriği */
.message.user-message div { 
    background: linear-gradient(135deg, #3498db, #2980b9); 
    color: #fff; 
    border-radius: 15px; 
    padding: 15px 20px; 
    max-width: 100%; 
    position: relative; 
    min-height: 30px; 
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3); 
    transition: background 0.5s ease; 
}
body.light-mode .message.user-message div { background: linear-gradient(135deg, #007bff, #0056b3); }
.message.user-message p { margin: 0; margin-bottom: 18px; }

/* Saat Damgası Stili */
.timestamp { 
    display: block; 
    font-size: 0.7em; 
    text-align: right; 
    position: absolute; 
    bottom: 5px; 
    right: 12px; 
    width: calc(100% - 24px); 
    opacity: 0.7; 
    transition: color 0.5s ease; 
}
body.light-mode .timestamp { color: #6c757d; }

/* Fotoğraf önizleme alanı */
#image-preview {
    margin: 15px 0;
    padding: 0 20px;
    transition: opacity 0.3s ease;
}
#image-preview img {
    border-radius: 15px;
    border: 2px solid #465c71;
    transition: border-color 0.5s ease;
}
body.light-mode #image-preview img { border-color: #ced4da; }
#send-photo-button { margin-top: 8px; }

/* Yazı yazma alanı */
#input-area { 
    display: flex; 
    padding: 15px 20px; 
    background: #2a3b55; 
    border-top: 1px solid #465c71; 
    align-items: center; 
    gap: 10px; 
    flex-wrap: wrap; 
    transition: background 0.5s ease, border-color 0.5s ease; 
}
body.light-mode #input-area { background: #ffffff; border-color: #d9e2ec; }

/* Yazı yazma kutusu */
#user-input { 
    flex-grow: 1; 
    padding: 12px 18px; 
    border: 1px solid #465c71; 
    border-radius: 25px; 
    font-size: 0.95rem; 
    line-height: 1.4; 
    outline: none; 
    background: #34495e; 
    color: #ecf0f1; 
    transition: border-color 0.2s ease, background 0.5s ease, color 0.5s ease; 
}
body.light-mode #user-input { background: #f5f8fa; border-color: #ced4da; color: #2a3b55; }
#user-input:focus { border-color: #3498db; }

/* Butonlar */
.action-button { 
    padding: 10px 20px; 
    background: linear-gradient(135deg, #3498db, #2980b9); 
    color: #fff; 
    border: none; 
    border-radius: 25px; 
    cursor: pointer; 
    font-size: 0.9rem; 
    font-weight: 500; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    transition: transform 0.2s ease, background 0.3s ease, box-shadow 0.3s ease; 
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3); 
}
.action-button:hover { 
    transform: scale(1.05); 
    background: linear-gradient(135deg, #2980b9, #3498db); 
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5); 
}
.action-button:active { 
    transform: scale(0.98); 
}

/* Kontrol çubuğu */
#control-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: #2a3b55;
    border-top: 1px solid #465c71;
    transition: background 0.5s ease, border-color 0.5s ease;
}
body.light-mode #control-bar { background: #ffffff; border-color: #d9e2ec; }

/* Kontrol butonları */
.control-button {
    padding: 8px 16px;
    background: linear-gradient(135deg, #34495e, #2a3b55);
    color: #ecf0f1;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: transform 0.2s ease, background 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}
.control-button:hover { 
    transform: scale(1.05); 
    background: linear-gradient(135deg, #2a3b55, #34495e); 
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5); 
}
body.light-mode .control-button { background: linear-gradient(135deg, #e6ecef, #d9e2ec); color: #2a3b55; }

/* Model seçici */
.mode-select {
    padding: 8px 16px;
    background: #34495e;
    border: 1px solid #465c71;
    border-radius: 20px;
    font-size: 0.9rem;
    color: #ecf0f1;
    transition: background 0.5s ease, border-color 0.5s ease, color 0.5s ease;
}
body.light-mode .mode-select { background: #f5f8fa; border-color: #ced4da; color: #2a3b55; }

/* Mobil Uyumluluk (max-width: 600px) */
@media (max-width: 600px) {
    body { 
        padding: 5px; 
        align-items: stretch; 
    }
    #chat-container { 
        height: 100%; 
        max-height: none; 
        border-radius: 10px; 
        margin: 0; 
        box-shadow: none; 
    }
    #chat-box { 
        padding: 10px; 
        margin: 5px 0; 
    }
    .message { 
        max-width: 85%; 
        margin-bottom: 15px; 
        font-size: 0.9rem; 
    }
    .message.bot-message div, .message.user-message div { 
        padding: 12px 18px; 
        border-radius: 12px; 
    }
    #input-area { 
        padding: 8px 10px; 
        gap: 5px; 
        align-items: center; 
    }
    #user-input { 
        padding: 6px 10px; 
        font-size: 0.8rem; 
    }
    .action-button { 
        padding: 5px 10px; 
        font-size: 0.7rem; 
    }
    #chat-title { 
        font-size: 1.2em; 
        margin: 10px 0; 
    }
    .timestamp { 
        font-size: 0.6em; 
        bottom: 2px; 
        right: 6px; 
    }
    #control-bar {
        flex-direction: column; /* Üst ve alt gruplar için */
        align-items: stretch;
        padding: 5px 10px; 
        gap: 5px;
    }
    #control-bar .top-controls {
        display: flex;
        justify-content: space-between;
        width: 100%;
    }
    #control-bar .bottom-controls {
        display: flex;
        justify-content: center; /* KyrosilRewards SUPER ortalı */
        width: 100%;
    }
    .control-button {
        padding: 4px 8px; 
        font-size: 0.65rem; 
        flex: 1;
        margin: 0 2px;
        text-align: center;
    }
    .mode-select {
        padding: 4px 8px;
        font-size: 0.65rem;
        width: 100%; /* Alt satırda tam genişlik */
        max-width: 200px; /* Çok geniş olmasın */
        margin: 0 auto; /* Ortalamak için */
        text-align: center;
    }
    .header-logo {
        height: 25px;
    }
    .message.bot-message {
        padding-left: 30px;
    }
    .message.bot-message::before {
        width: 20px;
        height: 20px;
    }
}

/* Web için stil (600px üzeri) - Orijinal düzen korunuyor */
@media (min-width: 601px) {
    #control-bar {
        flex-direction: row;
        justify-content: space-between;
    }
    #control-bar .top-controls,
    #control-bar .bottom-controls {
        display: flex;
        align-items: center;
    }
}
