/* Sayfa kenar boşluklarını sıfırlıyoruz ve arka planı ayarlıyoruz */
body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    
    /* Yeni Arka Plan Kodları */
    background-image: url('bg.png');
    background-size: cover; /* Resmi ekranın tamamına boşluk kalmayacak şekilde yayar */
    background-position: center; /* Resmi ekranın tam merkezine hizalar */
    background-repeat: no-repeat; /* Görsel küçükse yan yana veya alt alta tekrar etmesini engeller */
    background-attachment: fixed; /* Sayfayı aşağı kaydırsan bile arka planın sabit kalmasını sağlar */
}

/* Yükleme Ekranı Tasarımı */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: #ffffff;
    z-index: 9999;
    transition: opacity 0.5s ease-out; 
}

/* 1. GIF'i ekranın TAM MERKEZİNE kilitliyoruz. Asla yerinden oynamaz. */
#loading-gif {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); 
    max-width: 500px;
    height: auto;
}

/* 2. Yazıyı merkezin altına alıyoruz ve tam ortalıyoruz */
#loading-text {
    position: absolute;
    top: 50%;
    left: 50%;
    
    /* İŞTE BURASI: 130px değeri ekranın merkezinden ne kadar aşağıda duracağını belirler. 
       Eğer yazıyı GIF'e biraz daha yaklaştırmak istersen bu sayıyı 100px yapabilir,
       uzaklaştırmak istersen 160px yapabilirsin. */
    transform: translate(-50%, 100px); 
    
    font-family: 'Arial Black', Arial, sans-serif;
    font-size: 48px;
    font-weight: bold;
    color: #333333;
    text-align: center;
    white-space: nowrap; /* Noktalar geldiğinde yazının alt satıra düşmesini kesinlikle engeller */
}

/* Noktalar metnin bir parçası olarak davranır */
#dots {
    display: inline;
}

/* --- ANA SAYFA ELEMENTLERİ --- */

/* Sol Üst Logo */
#main-logo {
    position: fixed;
    top: -20px;
    left: 30px;
    height: 160px; /* Logonun büyüklüğünü buradan ayarlayabilirsin */
    cursor: pointer;
    z-index: 100;
}

/* Sağ Alt Asistan Butonu */
#assistant-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 120px; /* Asistan ikonunun boyutu */
    cursor: pointer;
    z-index: 101;
    transition: transform 0.2s; /* Üzerine gelince büyüme efekti için */
}

#assistant-btn:hover {
    transform: scale(1.1); /* Fareyle üzerine gelince hafifçe büyür */
}

/* --- YENİ MERKEZİ SOHBET MODALI --- */
#chat-overlay, #rating-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100vh;
    background-color: rgba(0, 0, 0, 0.6); /* Arka planı karartır */
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

#chat-modal {
    width: 90%;
    max-width: 600px;
    height: 70vh; /* Ekranın %70'ini kaplar */
    background-color: #ffffff;
    border-radius: 20px;
    box-shadow: 0px 20px 50px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Bağlanıyor ve Onay Ekranı Tasarımı */
#chat-connecting, #chat-confirm {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.spinner {
    border: 6px solid #f3f3f3;
    border-top: 6px solid #2b78ff;
    border-radius: 50%;
    width: 60px; height: 60px;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Aktif Sohbet Ekranı */
#chat-active {
    display: flex;
    flex-direction: column;
    height: 100%;
}

#chat-header {
    background-color: #2b78ff;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: sans-serif;
}

#agent-info {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 32px;
    font-weight: bold;
}

#agent-avatar {
    width: 65px; height: 65px;
    border-radius: 50%;
    background-color: white;
    object-fit: cover;
    border: 1px solid white;
}

#close-chat {
    background: none; 
    border: none; 
    color: white;
    font-size: 30px; 
    font-weight: bold; 
    cursor: pointer;
    transition: color 0.2s, transform 0.2s; /* Animasyonların yumuşak olması için eklendi */
}

#close-chat:hover {
    color: #ff3333; /* Mavi arka planda göz yormayacak yumuşak bir kırmızı/pembe tonu */
    transform: scale(1.15); /* Üzerine gelince hafifçe büyüyerek tıklama hissini artırır */
}

#chat-messages {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background-color: #f9f9f9;
    font-family: sans-serif;
}

.message {
    padding: 12px 18px;
    border-radius: 20px;
    max-width: 80%;
    word-wrap: break-word;
    font-size: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.user-msg {
    background-color: #2b78ff; color: white;
    align-self: flex-end;
    border-bottom-right-radius: 5px;
}

.assistant-msg {
    background-color: #ffffff; color: black;
    align-self: flex-start;
    border-bottom-left-radius: 5px;
    border: 1px solid #e0e0e0;
}

#chat-input-area {
    display: flex; padding: 15px; background-color: #ffffff;
    border-top: 1px solid #e0e0e0;
}

#chat-input {
    flex-grow: 1; padding: 12px; border: 1px solid #ccc;
    border-radius: 8px; outline: none; font-size: 15px;
}

#chat-send {
    margin-left: 10px; padding: 10px 20px; background-color: #2b78ff;
    color: white; border: none; border-radius: 8px; cursor: pointer; font-weight: bold;
}

/* Onay Butonları */
#confirm-yes { background-color: #ff3333; color: white; border: none; padding: 12px 25px; border-radius: 8px; cursor: pointer; font-weight: bold; font-size: 15px; }
#confirm-no { background-color: #e0e0e0; color: #333; border: none; padding: 12px 25px; border-radius: 8px; cursor: pointer; font-weight: bold; font-size: 15px; margin-left: 10px; }

/* Puanlama Ekranı */
#rating-modal {
    background: white; padding: 40px; border-radius: 20px;
    text-align: center; max-width: 400px; width: 90%;
    box-shadow: 0px 20px 50px rgba(0,0,0,0.3);
    position: relative; /* Kapatma tuşunun köşeye sabitlenmesi için gerekli */
}

/* Yeni Kapatma Tuşunun Tasarımı */
#close-rating {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 30px;
    font-weight: bold;
    color: #999999;
    cursor: pointer;
    transition: color 0.2s;
}

#close-rating:hover {
    color: #ff3333; /* Üzerine gelince kırmızı olur */
}

#star-rating {
    font-size: 50px; color: #d3d3d3; cursor: pointer;
    display: flex; justify-content: center; gap: 10px; margin-top: 20px;
}

.star:hover, .star.hovered, .star.selected {
    color: #ffcc00; /* Üzerine gelince ve seçilince altın sarısı */
}

#chat-input {
    flex-grow: 1;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 5px;
    outline: none;
}

#chat-send {
    margin-left: 8px;
    padding: 8px 15px;
    background-color: #2b78ff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}

/* --- QR YÜKLEME ALANI TASARIMI --- */
#upload-container {
    padding-top: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: Arial, sans-serif;
    color: #333333;
}

/* --- YENİ QR YÜKLEME ALANI TASARIMI --- */
#drop-area {
    position: absolute; /* Arka plan kutusunun üzerine serbestçe çıkmasını sağlar */
    
    /* Bulutu arka plan kutusunun tam neresine koymak istiyorsan bu değerlerle oyna: */
    top: 52%; /* Yüzdeyi artırdıkça aşağı iner, azalttıkça yukarı çıkar */
    left: 50%; /* Yatayda tam orta */
    transform: translate(-50%, -50%); /* Tam merkeze iğneler, hitbox'ı da beraberinde taşır */
    
    cursor: pointer;
    display: inline-block;
}

#upload-image-visual {
    width: 750px; /* Görselin ekrandaki genişliği. Gözüne küçük gelirse 400px yapabilirsin */
    height: auto;
    display: block;
    transition: transform 0.2s ease; /* Üzerine gelince tatlı bir büyüme efekti ekliyoruz */
    z-index: 100;

    pointer-events: none; /* Farenin görseli algılamasını tamamen kapatır, sanki orada yokmuş gibi davranır */
    user-select: none; /* Seçilip vurgulanmasını engeller */
    -webkit-user-drag: none; /* Sürüklemeyi ekstra bir güvenlik olarak CSS seviyesinde de yasaklar */
    -moz-user-drag: none
}

/* Fareyle üzerine gelince görsel hafifçe büyüsün */
#drop-area:hover #upload-image-visual {
    transform: scale(1.05);
}

/* Dosya seçici tam olarak görselin üzerini kaplıyor ama tamamen şeffaf */
#qr-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}
/* Dosya seçme butonunu tamamen görünmez yapıp kutunun boyutuna yayıyoruz. 
   Böylece kutunun neresine tıklanırsa tıklansın dosya seçme ekranı açılır. */
#qr-input {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

#error-msg {
    color: #ff3333;
    font-weight: bold;
    margin-top: -175px;
    background-color: #ffe6e6;
    padding: 10px 20px;
    z-index: 101;
    border-radius: 8px;
    border: 1px solid #ff9999;
}

/* --- BAŞLIK GÖRSELİ TASARIMI --- */
#upload-text-visual {
    width: 1200px; /* Kendi görseline göre bu boyutu ayarlayabilirsin */
    max-width: 90vw;
    height: auto;
    display: block; /* Altındaki boşluğu temizler */
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

/* --- YENİ SARMALAYICI KUTU --- */
#upload-wrapper {
    position: relative; /* İçindeki nesnelerin buna göre hizalanmasını sağlar */
    display: inline-block;
    margin-top: 50px;
}

/* --- SAYFA YUMUŞAK GEÇİŞ ANİMASYONU --- */
#home-page {
    animation: fadeIn 0.8s ease-in-out;
}

@keyframes fadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

/* --- ALT BİLGİ YAZISI --- */
#footer-text {
    position: fixed;
    bottom: 15px; /* Ekranın en altından ne kadar yukarıda duracağı */
    left: 50%;
    transform: translateX(-50%); /* Tam merkeze hizalar */
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; /* Yumuşak ve modern bir font */
    font-size: 13px; /* Küçük ve zarif durması için */
    color: #666666; /* Çok sert bir siyah yerine yumuşak bir gri */
    opacity: 0.7; /* Göz yormaması için hafif saydamlaştırdık */
    pointer-events: none; /* Yazının yanlışlıkla seçilmesini veya tıklanmasını engeller */
    z-index: 50;
    margin: 0;
}

/* --- TOYOU SAYFASI KEDİ GÖRSELİ --- */
#toggle-cat {
    width: 900px; /* Kapalı görselin genişliği */
    max-width: 90vw;
    height: auto;
    cursor: pointer;
    /* Hem büyüme hem de genişleme efektini yumuşatıyoruz */
    transition: transform 0.2s ease
}

#toggle-cat:hover {
    transform: scale(1.05);
}

/* Kedi açık duruma geçtiğinde bu kod devreye girecek */
#toggle-cat.open-state {
    width: 1850px; /* Uzun görsel için yeni genişlik. Kendi görseline göre bunu artırabilir veya azaltabilirsin */
}

/* --- YAZIYOR... (TYPING INDICATOR) ANİMASYONU --- */
.typing-indicator {
    background-color: #ffffff;
    align-self: flex-start;
    border-bottom-left-radius: 5px;
    border: 1px solid #e0e0e0;
    padding: 15px 20px;
    border-radius: 20px;
    display: flex;
    gap: 5px;
    align-items: center;
    width: fit-content;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background-color: #999999;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

/* Noktaların sırayla zıplaması için gecikme (delay) süreleri */
.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
.typing-indicator span:nth-child(3) { animation-delay: 0s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}