/* ==========================================================================
   Temel Stiller ve Değişkenler
   ========================================================================== */
:root {
    --primary-color: #0D8ABC;
    --secondary-color: #0A6C9A;
    --background-color: #f4f7fa;
    --text-color: #333;
    --card-background: #ffffff;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --border-radius: 12px;
    --success-color: #4CAF50;
    --warning-color: #FF9800;
    --danger-color: #F44336;
    --light-gray: #e9ecef;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

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

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: color 0.3s ease;
}

a:hover {
    color: var(--secondary-color);
}

ul {
    list-style: none;
}

.section-title {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 30px;
    text-align: center;
    border-bottom: 3px solid var(--light-gray);
    padding-bottom: 15px;
}

/* ==========================================================================
   Header ve Navigasyon
   ========================================================================== */
.header {
    background-color: var(--card-background);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

.logo-img {
    height: 80px;
}

.nav-menu ul {
    display: flex;
}

.nav-menu li a {
    display: flex;
    align-items: center;
    padding: 15px 8px; /* DÜZENLENDİ: Yatay boşluk hassas ayarlandı */
    color: #555;
    font-weight: 500;
    font-size: 15px; /* DÜZENLENDİ: Yazı tipi boyutu büyütüldü */
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    white-space: nowrap; /* Metnin alt satıra kaymasını engeller */
}

.nav-menu li a .fas {
    margin-right: 5px; /* DÜZENLENDİ: İkon ve yazı arası boşluk azaltıldı */
    color: var(--primary-color);
}

.nav-menu li a:hover,
.nav-menu li a.active {
    color: var(--primary-color);
    background-color: #f0f8ff;
    border-bottom-color: var(--primary-color);
}

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

.profile-img {
    height: 45px;
    width: 45px;
    border-radius: 50%;
    margin-right: 10px;
    border: 2px solid var(--primary-color);
}

.user-name {
    font-weight: 600;
}

.mobile-menu-btn {
    display: none;
    font-size: 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary-color);
}

/* ==========================================================================
   Ana İçerik ve Bölümler
   ========================================================================== */
.main-content .section {
    display: none; /* JavaScript ile kontrol edilecek */
    padding: 40px 0;
    animation: fadeIn 0.5s ease-in-out;
}

.main-content .section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Ana Sayfa
   ========================================================================== */
.welcome-card {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 40px;
    border-radius: var(--border-radius);
    text-align: center;
    margin-bottom: 40px;
}

.welcome-card h1 {
    font-size: 2.8rem;
    margin-bottom: 10px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.dashboard-card {
    background: var(--card-background);
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.card-icon {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 15px;
    color: white;
    font-size: 2rem;
}

.dashboard-card h3 {
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.card-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.card-link {
    display: inline-block;
    padding: 8px 20px;
    background: var(--primary-color);
    color: white;
    border-radius: 20px;
    font-weight: 500;
}

.card-link:hover {
    background: var(--secondary-color);
    color: white;
}

.info-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.info-card {
    background: #e7f3f8;
    padding: 25px;
    border-radius: var(--border-radius);
    text-align: center;
    border-left: 5px solid var(--primary-color);
}

.info-card .fas {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

/* ==========================================================================
   Genel Kayıt Kartları (Ziyaret, Reçete, Rapor vb.)
   ========================================================================== */
.records-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
}

.record-card {
    background: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.3s ease;
}

.record-card:hover {
    transform: scale(1.02);
}

.record-header {
    background: #e7f3f8;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--light-gray);
}

.record-header h3 {
    color: var(--primary-color);
    font-size: 1.2rem;
}

.record-header h3 .fas {
    margin-right: 10px;
}

.record-date, .test-date {
    font-weight: 500;
    color: #555;
    font-size: 0.9rem;
}

.record-body {
    padding: 20px;
}

.record-body p {
    margin-bottom: 8px;
}

.btn-download {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 15px;
    display: inline-flex;
    align-items: center;
}

.btn-download .fas {
    margin-right: 8px;
}

/* Reçete Kartları için Özel Stiller */
.badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
}
.badge-active { background-color: var(--success-color); }
.badge-expired { background-color: var(--danger-color); }

.medicine-list {
    margin-top: 15px;
    border-top: 1px solid var(--light-gray);
    padding-top: 15px;
}
.medicine-list ul li {
    padding-left: 15px;
    position: relative;
}
.medicine-list ul li::before {
    content: '\f48e';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: var(--primary-color);
    position: absolute;
    left: 0;
    top: 2px;
}

/* ==========================================================================
   Hastalıklarım (Zaman Tüneli)
   ========================================================================== */
.disease-timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}
.disease-timeline::after {
    content: '';
    position: absolute;
    width: 4px;
    background-color: var(--light-gray);
    top: 0;
    bottom: 0;
    left: 20px;
}
.disease-card {
    padding: 10px 40px;
    position: relative;
    margin-left: 20px;
    margin-bottom: 20px;
}
.disease-status {
    position: absolute;
    left: -18px;
    top: 22px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 4px solid var(--background-color);
    z-index: 1;
}
.disease-status.active { background-color: var(--warning-color); }
.disease-status.resolved { background-color: var(--success-color); }

.disease-content {
    background: var(--card-background);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}
.disease-notes {
    background: #f9f9f9;
    padding: 10px;
    border-radius: 8px;
    margin-top: 10px;
    font-style: italic;
    border-left: 3px solid var(--primary-color);
}
.badge-warning { background-color: var(--warning-color); }
.badge-success { background-color: var(--success-color); }

/* ==========================================================================
   Tahlillerim
   ========================================================================== */
.test-card {
    background: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 20px;
}
.test-header {
    background: #e7f3f8;
    padding: 15px 20px;
}
.test-body { padding: 0; }
.test-table {
    width: 100%;
    border-collapse: collapse;
}
.test-table th, .test-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--light-gray);
}
.test-table thead {
    background: #f8f9fa;
}
.test-table tbody tr:last-child td {
    border-bottom: none;
}
.test-table tbody tr:nth-child(even) {
    background-color: #fcfcfc;
}
.status-normal { color: var(--success-color); font-weight: bold; }
.status-high { color: var(--danger-color); font-weight: bold; }
.status-low { color: #f39c12; font-weight: bold; }

/* ==========================================================================
   Radyoloji
   ========================================================================== */
.radiology-image {
    width: 100%;
    height: 150px;
    background: var(--light-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: #ccc;
    border-radius: 8px;
    margin-bottom: 15px;
}
   
/* ==========================================================================
   Kriz Bilgileri
   ========================================================================== */
.emergency-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}
.emergency-card {
    background: var(--card-background);
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border-left: 5px solid var(--primary-color);
}
.emergency-card.alert-card {
    background-color: #fff3cd;
    border-color: #ffeeba;
    text-align: center;
}
.emergency-card.alert-card .fas { font-size: 2.5rem; color: #856404; margin-bottom: 10px; }
.blood-type {
    font-size: 3rem;
    font-weight: 700;
    color: var(--danger-color);
    text-align: center;
}
.allergy-badge {
    background: #6c757d;
    color: white;
    padding: 3px 8px;
    border-radius: 5px;
    margin-right: 5px;
    font-size: 0.8em;
}

/* ==========================================================================
   Randevu
   ========================================================================== */
.appointment-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}
.appointment-form-card, .appointments-list-card {
    background: var(--card-background);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--light-gray);
    border-radius: 8px;
    font-size: 1rem;
}
.btn-submit {
    width: 100%;
    padding: 15px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-submit:hover { background: var(--secondary-color); }

.appointment-item {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--light-gray);
}
.appointment-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}
.appointment-date {
    text-align: center;
    margin-right: 20px;
    background: var(--primary-color);
    color: white;
    border-radius: var(--border-radius);
    padding: 10px;
    width: 65px;
    flex-shrink: 0;
}
.appointment-date .day {
    font-size: 1.8rem;
    font-weight: 700;
    display: block;
}
.appointment-date .month {
    font-size: 0.9rem;
    display: block;
}
.appointment-details { flex-grow: 1; }
.appointment-details h4 { font-size: 1.2rem; }
.appointment-details p { color: #666; font-size: 0.9rem; margin: 2px 0; }
.appointment-item.past .appointment-details { opacity: 0.6; }
.appointment-item.past .appointment-date { background: #6c757d; }
.btn-cancel {
    background: var(--danger-color);
    color: white;
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.footer {
    background: #343a40;
    color: white;
    text-align: center;
    padding: 20px 0;
    margin-top: 40px;
}

/* ==========================================================================
   Mobil Uyumluluk (Responsive)
   ========================================================================== */
@media (max-width: 1200px) {
    .nav-menu ul {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 70px;
        left: 0;
        width: 100%;
        background: var(--card-background);
        box-shadow: var(--shadow);
    }
    .nav-menu.show ul {
        display: flex;
    }
    .nav-menu li a {
        padding: 15px 20px;
        border-bottom: 1px solid var(--light-gray);
    }
    .mobile-menu-btn {
        display: block;
    }
    .user-profile {
        display: none; /* Mobilde gizle, isteğe bağlı */
    }
}

@media (max-width: 992px) {
    .appointment-container {
        grid-template-columns: 1fr;
    }
    .disease-timeline::after {
        left: 20px;
    }
    .disease-card {
        margin-left: 0;
        padding-left: 60px;
    }
    .disease-status {
        left: 6px;
    }
}

@media (max-width: 768px) {
    .section-title { font-size: 2rem; }
    .welcome-card h1 { font-size: 2.2rem; }
    .header-content {
        padding: 10px 20px;
    }
}


/* ==========================================================================
   YENİ EKLENEN GEMINI SOHBET ARAYÜZÜ STİLLERİ (TAMAMEN YENİLENDİ)
   ========================================================================== */

#yapay-zeka {
    padding: 40px 0 0 0; /* Alttaki input bar için padding'i sıfırla */
}

#chatInterface {
    display: flex;
    flex-direction: column;
    height: 75vh; /* Sayfa içinde daha uygun bir yükseklik */
    position: relative;
    overflow: hidden;
    max-width: 900px;
    margin: 0 auto;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    background: #fff;
}

#chatInterface .chat-container {
    flex: 1;
    overflow-y: auto;
    width: 100%;
    margin: 0 auto;
    padding: 20px 20px 140px 20px;
    scroll-behavior: smooth;
}

#chatInterface .chat-container::-webkit-scrollbar {
    width: 8px;
}

#chatInterface .chat-container::-webkit-scrollbar-thumb {
    background-color: #c5c5d2;
    border-radius: 4px;
}

#chatInterface .message {
    margin-bottom: 20px;
    display: flex;
    animation: fadeIn 0.3s ease;
}

#chatInterface .message.user {
    justify-content: flex-end;
}

#chatInterface .message-content {
    max-width: 70%;
    padding: 15px 20px;
    border-radius: 15px;
    word-wrap: break-word;
    white-space: pre-wrap;
    line-height: 1.5;
}

#chatInterface .message.user .message-content {
    background: linear-gradient(135deg, #0D8ABC 0%, #0A6C9A 100%);
    color: white;
    border-bottom-right-radius: 5px;
}

#chatInterface .message.ai .message-content {
    background: #f1f1f1;
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 5px;
}

#chatInterface .message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 5px;
}

#chatInterface .typing-indicator {
    padding: 15px;
    background: #f7f7f8;
    border-radius: 15px;
    width: fit-content;
    margin-bottom: 20px;
    margin-left: 20px;
    display: none;
}

#chatInterface .typing-indicator.active {
    display: block;
}

#chatInterface .typing-indicator span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    margin: 0 2px;
    animation: bounce 1.4s infinite ease-in-out;
}

#chatInterface .typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
#chatInterface .typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

#chatInterface .input-container {
    position: absolute;
    bottom: 0;
    width: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 1rem;
    background-color: #ffffff;
    border-top: 1px solid #e5e5e5;
    display: flex;
    flex-wrap: wrap; /* Dosya etiketinin üste çıkması için */
    align-items: center; 
    gap: 0.5rem;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    z-index: 1000;
}

#chatInterface .input-container input[type="text"] {
    /* *** MOBİL HATA DÜZELTMESİ (1) *** */
    flex-grow: 1;     /* Boşluğu doldur */
    flex-shrink: 1;   /* Gerekirse küçül */
    flex-basis: 0;    /* Hesaplamaya 0'dan başla */
    min-width: 0;     /* Sınırsız küçülebil */
    
    /* Eski stiller */
    padding: 0.75rem 1rem;
    font-size: 1rem;
    color: var(--text-color);
    background-color: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 0.375rem;
    transition: border-color 0.2s;
}

#chatInterface .input-container input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 138, 188, 0.1);
}

#chatInterface .input-container button {
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
    /* *** MOBİL HATA DÜZELTMESİ (2) *** */
    flex-shrink: 0; /* Butonlar küçülmesin */
}

#chatInterface .input-container button:hover:not(:disabled) {
    background-color: var(--secondary-color);
}

#chatInterface .input-container button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* YENİ: Dosya Ekleme Butonu Stilleri */
#chatInterface .btn-attach {
    background: transparent;
    border: none;
    color: #555;
    font-size: 1.2rem;
    padding: 0.75rem;
    cursor: pointer;
    transition: color 0.2s;
    /* *** MOBİL HATA DÜZELTMESİ (3) *** */
    flex-shrink: 0; /* Butonlar küçülmesin */
}

#chatInterface .btn-attach:hover {
    color: var(--primary-color);
}

/* YENİ: Dosya Seçim Etiketi Stilleri (script.js'de oluşturulur) */
#chatInterface .file-tag {
    background: #f0f0f0;
    padding: 5px 10px;
    border-radius: 5px;
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    animation: fadeIn 0.3s;

    /* *** MOBİL HATA DÜZELTMESİ (4) *** */
    /* Etiketi kendi satırına zorla ve üste al */
    width: 100% !important; 
    order: -1; 
    margin-bottom: 0.5rem;
}

#chatInterface .file-tag span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90%;
}

#chatInterface .file-tag button {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #999;
    cursor: pointer;
    padding: 0 5px;
    height: auto; 
}

#chatInterface .file-tag button:hover {
    color: #333;
}

/* YENİ: Mesaj içindeki kullanıcı tarafından yüklenen resim stili */
#chatInterface .message-content img.user-upload {
    max-width: 100%;
    max-height: 300px;
    border-radius: 10px;
    margin-top: 10px;
    cursor: pointer;
}

/* YENİ: Mesaj içindeki kullanıcı tarafından yüklenen PDF stili */
#chatInterface .user-upload-pdf {
    background-color: rgba(255,255,255,0.1); /* Arka planı hafifçe ayır */
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    padding: 15px;
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

#chatInterface .user-upload-pdf .fas {
    font-size: 1.8rem;
    color: #fff; 
    opacity: 0.8;
}

#chatInterface .user-upload-pdf span {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#chatInterface .user-upload-pdf small {
    color: #eee;
    margin-left: auto; /* Boyutu sağa yasla */
    flex-shrink: 0;
}
/* BİTİŞ: YENİ STİLLER */


#chatInterface .controls {
    position: absolute;
    top: 0.5rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    z-index: 100;
}

#chatInterface .controls button {
    padding: 0.5rem 1rem;
    background-color: #f7f7f8;
    color: var(--text-color);
    border: 1px solid #e5e5e5;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

#chatInterface .controls button:hover {
    background-color: #e9ecef;
    border-color: var(--primary-color);
}

#chatInterface .stats {
    position: absolute;
    bottom: 80px; /* Input container'a göre ayarlandı */
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: #666;
    background: white;
    padding: 5px 15px;
    border-radius: 15px;
    border: 1px solid #e5e5e5;
}

@media (max-width: 768px) {
    #chatInterface .message-content {
        max-width: 85%;
    }
    #chatInterface .controls {
        flex-wrap: wrap;
        right: 0.5rem;
        gap: 0.25rem;
        top: 0.25rem;
    }
    #chatInterface .controls button {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
    }
    #chatInterface .stats {
        /* Dosya etiketi eklendiğinde input bar'ın yüksekliği artabilir */
        bottom: 120px; 
    }
    
    #chatInterface .input-container {
        padding: 0.5rem;
        /* *** MOBİL HATA DÜZELTMESİ (5) *** */
        gap: 0.25rem; /* Aralığı azalt */
    }

    #chatInterface .input-container input[type="text"] {
        /* *** MOBİL HATA DÜZELTMESİ (6) *** */
        padding: 0.7rem 0.8rem; /* Dolguyu dikeyde artır */
        font-size: 0.9rem;
    }
    
    /* "Gönder" butonu */
    #chatInterface .input-container button#sendButton {
         /* *** MOBİL HATA DÜZELTMESİ (7) *** */
        padding: 0.7rem 0.8rem; /* Metin kutusuyla aynı dikey dolgu */
    }
    
    /* "Ataç" butonu */
    #chatInterface .btn-attach {
         /* *** MOBİL HATA DÜZELTMESİ (8) *** */
        padding: 0.7rem; /* Metin kutusuyla aynı dikey dolgu */
        font-size: 1rem; /* İkonu biraz küçült */
    }
}