/* ==========================================================================
   1. DEĞİŞKENLER VE TEMEL AYARLAR (VARIABLES & BASE)
   ========================================================================== */

:root {
    --bg-color: #f5f5f5; 
    --text-color: #222222; 
    --primary-color: #222222; 
    --primary-dark-color: #111111; 
    --secondary-color: #444444; 
    --border-color: rgba(34, 34, 34, 0.2); 
    --box-shadow-color: rgba(34, 34, 34, 0.08); 
    --section-bg: #F8F8F8; 
    --input-bg: #FFFFFF; 
    --input-border: rgba(34, 34, 34, 0.2); 
    --button-bg: linear-gradient(to right, #222222, #444444); 
    --button-hover-bg: linear-gradient(to right, #111111, #222222); 
    --button-shadow: rgba(34, 34, 34, 0.15); 
    --note-bg: rgba(34, 34, 34, 0.03); 
    --note-border: rgba(34, 34, 34, 0.2); 
    --error-color: #DC3545;
    --error-bg: rgba(220, 53, 69, 0.1);
    --error-border: #DC3545;
    --loading-color: #222222;
    --highlight-color: #444444;
    --disease-color: #111111;
    --severity-low: #444444;
    --severity-medium: #FFB74D; 
    --severity-high: #DC3545;
    --liquid-color: #222222;
}

body.dark-mode {
    --bg-color: #1c1e22; 
    --text-color: #e4e6eb; 
    --primary-color: #58a6ff; 
    --primary-dark-color: #3081f7; 
    --secondary-color: #8b949e; 
    --border-color: rgba(255, 255, 255, 0.15);
    --box-shadow-color: rgba(0, 0, 0, 0.2); 
    --section-bg: #24272c; 
    --input-bg: #2f3338; 
    --input-border: rgba(255, 255, 255, 0.2);
    --button-bg: #58a6ff; 
    --button-hover-bg: #3081f7; 
    --button-shadow: rgba(0, 0, 0, 0.25);
    --note-bg: #2f3338;
    --note-border: rgba(255, 255, 255, 0.15);
    --error-color: #FF6347;
    --error-bg: rgba(255, 99, 71, 0.2);
    --error-border: #FF6347;
    --loading-color: #F0F0F0;
    --highlight-color: #CCCCCC;
    --disease-color: #CCCCCC;
    --severity-low: #888888;
    --severity-medium: #FFCC80; 
    --severity-high: #FF4136;
    --liquid-color: #F0F0F0;
}

body {
    font-family: 'Montserrat', sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.2s ease, color 0.2s ease;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 16px;
}

/* ==========================================================================
   2. ANİMASYONLAR (KEYFRAMES)
   ========================================================================== */

@keyframes fadeInAndFall {
    0% { opacity: 0; transform: translateY(-20px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes gentle-shake {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    25% { transform: translateY(-8px) rotate(-10deg); }
    50% { transform: translateY(0px) rotate(0deg); }
    75% { transform: translateY(-8px) rotate(10deg); }
}

@keyframes pour {
    0% { transform: rotate(0deg); }
    50% { transform: rotate(25deg); }
    100% { transform: rotate(15deg); }
}

@keyframes shake {
    10%, 90% { transform: translate3d(-0.5px, 0, 0); }
    20%, 80% { transform: translate3d(1px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-1.5px, 0, 0); }
    40%, 60% { transform: translate3d(1.5px, 0, 0); }
}

@keyframes liquid-flow {
    0% { height: 0; opacity: 0; }
    10% { opacity: 0.8; }
    50% { height: 35px; opacity: 0.8; }
    100% { height: 60px; opacity: 0; }
}

@keyframes drip {
    0% { transform: translate(-50%, 0); opacity: 0; }
    10% { opacity: 0.9; transform: translate(-50%, 5px); }
    50% { opacity: 0.9; transform: translate(-50%, 30px); }
    100% { transform: translate(-50%, 70px); opacity: 0; }
}

@keyframes splash {
    0% { opacity: 0; transform: translateX(-50%) scale(0); }
    50% { opacity: 0.9; transform: translateX(-50%) scale(1.2); }
    100% { opacity: 0; transform: translateX(-50%) scale(2); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes bounceText {
    0% { transform: translateY(0); }
    100% { transform: translateY(-15px); }
}

@keyframes wave-text {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes continuousSubtleMove {
    0% { transform: translate(0px, 0px) rotate(0deg); }
    25% { transform: translate(8px, -6px) rotate(0.5deg); }
    50% { transform: translate(0px, 8px) rotate(0deg); }
    75% { transform: translate(-8px, -6px) rotate(-0.5deg); }
    100% { transform: translate(0px, 0px) rotate(0deg); }
}

@keyframes wavyPulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 5px 15px rgba(231, 76, 60, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
}

/* ==========================================================================
   3. SAYFA YAPISI (LAYOUT)
   ========================================================================== */

header {
    background: linear-gradient(to right, #222222, #555555, #888888);
    color: var(--bg-color);
    padding: 1.5rem 1rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

header h1 {
    margin: 0;
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    opacity: 1;
    transform: translateY(0);
}

header h1.visible {
    opacity: 1;
    transform: translateY(0);
}

main {
    flex-grow: 1;
    padding: 1rem;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

footer {
    width: 100vw;
    background: var(--section-bg);
    color: var(--text-color);
    box-shadow: 0 -2px 8px var(--box-shadow-color);
    border-top: 1px solid var(--border-color);
    padding: 0.5rem 0;
    position: static;
    left: 0;
    bottom: 0;
    z-index: 10;
}

.footer-content {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 48px;
}

.footer-content p {
    margin: 0;
    font-size: 1rem;
    flex: 1;
    text-align: center;
}

.footer-social {
    position: absolute;
    right: 16px;
    bottom: 8px;
    display: flex;
    gap: 12px;
    z-index: 20;
}

.social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    transition: filter 0.2s, box-shadow 0.2s;
    filter: grayscale(0.3) brightness(0.95);
}

.social-icon img {
    width: 18px;
    height: 18px;
}

.social-icon.linkedin {
    background: #0077b5;
    filter: grayscale(0) brightness(1.1);
}

.social-icon:hover {
    filter: grayscale(0) brightness(1.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}


/* ==========================================================================
   4. BİLEŞENLER (COMPONENTS)
   ========================================================================== */

/* --- Yükleme Ekranı --- */
#loader-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.5s ease-out;
}

#loader-wrapper.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader-content {
    text-align: center;
}

.loader-text {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 20px;
    animation: bounceText 1.5s ease-in-out infinite alternate;
}

.loader-bar-container {
    width: 250px;
    height: 15px;
    background-color: var(--input-border);
    border-radius: 10px;
    margin: 0 auto 15px auto;
    overflow: hidden;
}

.loader-bar {
    width: 0%;
    height: 100%;
    background-color: var(--primary-color);
    border-radius: 10px;
    transition: width 0.1s linear;
}

.loader-percentage {
    font-size: 1rem;
    color: var(--text-color);
    font-weight: 500;
}

/* --- Genel Butonlar --- */
button {
    display: block;
    width: 100%;
    padding: 0.8rem;
    background: var(--button-bg);
    color: var(--bg-color);
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    text-shadow: none;
    box-shadow: 0 0 4px var(--button-shadow);
}

button:hover {
    background: var(--button-hover-bg);
    transform: translateY(-2px);
    box-shadow: 0 0 10px var(--button-shadow);
}

button:active {
    transform: translateY(0px);
    background: var(--button-bg);
    box-shadow: 0 0 2px var(--button-shadow);
}

button:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem var(--box-shadow-color);
}

/* --- Genel Text Alanı --- */
textarea {
    width: calc(100% - 20px);
    min-height: 120px;
    padding: 8px;
    border: 1px solid var(--input-border);
    border-radius: 5px;
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
    resize: vertical;
    background-color: var(--input-bg);
    color: var(--text-color);
    font-family: 'Montserrat', sans-serif;
    box-shadow: inset 0 0 4px var(--border-color);
    transition: background-color 0.5s ease, color 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease;
}

textarea:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem var(--box-shadow-color);
}

textarea::placeholder {
    color: var(--text-color);
    opacity: 0.6;
}

/* --- Başlık ve Animasyonları --- */
#flask-emoji {
    display: inline-block;
    margin-right: 10px;
    font-size: 2.5rem;
    position: relative;
    color: var(--secondary-color);
    overflow: hidden;
    transform-origin: 50% 50%;
}

.pouring-animation {
    animation: pour 1.5s ease-in-out forwards;
}

.liquid {
    position: absolute;
    top: 30%;
    left: 50%;
    width: 10px;
    height: 0;
    background: linear-gradient(to bottom, var(--primary-color), var(--secondary-color));
    border-radius: 0 0 5px 5px;
    transform: translateX(-50%);
    z-index: -1;
    opacity: 0;
    animation: liquid-flow 3s ease-in-out infinite;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}

.droplet {
    position: absolute;
    bottom: -5px;
    left: 50%;
    width: 8px;
    height: 8px;
    background: linear-gradient(to bottom, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    transform: translateX(-50%);
    animation: drip 2.5s ease-in forwards;
    opacity: 0;
    filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.5));
}

.droplet-small {
    width: 5px;
    height: 5px;
    animation-delay: 0.4s;
    animation-duration: 2s;
    left: 45%;
}

.droplet-large {
    width: 10px;
    height: 10px;
    animation-delay: 0.2s;
    animation-duration: 2.5s;
    left: 55%;
}

.splash {
    position: absolute;
    bottom: -20px;
    left: 50%;
    width: 30px;
    height: 8px;
    transform: translateX(-50%);
    opacity: 0;
    animation: splash 2s ease-out forwards;
    animation-delay: 1.8s;
}

.splash::before, .splash::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 4px;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

.splash::before {
    left: -8px;
    transform: rotate(-20deg);
}

.splash::after {
    right: -8px;
    transform: rotate(20deg);
}

/* --- Bölüm (Section) Stilleri --- */
section {
    background-color: var(--section-bg);
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px var(--box-shadow-color);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

section:hover {
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    transform: translateY(0);
}

section h2 {
    color: var(--primary-color);
    margin-top: 0;
    font-size: 1.3rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.4rem;
    margin-bottom: 0.8rem;
}

.hidden-section, .hidden-results, .hidden {
    display: none;
}

.active-section, .active-results {
    display: block;
    animation: fadeIn 0.5s ease-in-out;
}

/* --- Sorgu Tipi Bölümü --- */
#query-type-section h3 {
    font-size: 1.4rem;
    text-align: center;
    margin-bottom: 0.4rem;
    color: var(--primary-color);
}

.query-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-top: 0.8rem;
}

.query-btn {
    padding: 0.7rem 1.2rem;
    background: var(--button-bg);
    color: #FFFFFF;
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
    font-weight: 500;
    width: 100%;
    box-sizing: border-box;
}

.query-btn:hover {
    background-color: var(--input-bg);
    border-color: var(--primary-color);
}

.query-btn.active {
    background: var(--button-bg);
    color: #FFFFFF;
    font-weight: 500;
    box-shadow: 0 0 10px var(--box-shadow-color);
}


/* --- Sonuç Alanları --- */
.results-container {
    background-color: var(--section-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 4px 8px var(--box-shadow-color);
    line-height: 1.6;
    text-align: left;
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-size: 1rem;
}

.loading {
    text-align: center;
    font-size: 1.1rem;
    color: var(--loading-color);
    margin-top: 1.5rem;
}

.error {
    text-align: center;
    font-size: 1.1rem;
    color: var(--error-color);
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: var(--error-bg);
    border: 1px solid var(--error-border);
    border-radius: 8px;
}

.note {
    margin-top: 20px;
    padding: 15px;
    background-color: var(--note-bg);
    border-left: 4px solid var(--secondary-color);
    border-radius: 4px;
    font-size: 0.95rem;
    color: var(--text-color);
    line-height: 1.6;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.note strong {
    color: var(--secondary-color);
    font-weight: 700;
}

/* --- Alt Bilgi Kutuları --- */
.bottom-info-boxes-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 0.8rem;
    margin-top: 1.5rem;
    gap: 1rem;
    background-color: var(--bg-color, #f0f4f8);
}

.info-box.animated-box {
    background-color: var(--section-bg, #ffffff);
    color: var(--text-color, #333333);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 10px;
    padding: 1rem;
    box-shadow: 0 3px 10px var(--box-shadow-color, rgba(0,0,0,0.07));
    width: 90%;
    max-width: 400px;
    text-align: left;
    animation-name: continuousSubtleMove;
    animation-duration: 10s;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
    animation-direction: alternate;
    margin-bottom: 1rem;
}

.info-box.animated-box:last-child {
    margin-bottom: 0;
}

.info-box.animated-box h2 {
    color: var(--primary-color, #007bff);
    margin-top: 0;
    margin-bottom: 0.8rem;
    font-size: 1.2rem;
    border-bottom: 1px solid var(--secondary-color, #6c757d);
    padding-bottom: 0.4rem;
}

.info-box.animated-box p {
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: 0.6rem;
}

.info-box.animated-box p:last-child {
    margin-bottom: 0;
}

.right-animated-box {
    animation-delay: -4s;
}

/* ==========================================================================
   5. SESLİ KOMUT BUTONU
   ========================================================================== */

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon textarea {
    width: 100%;
    padding-right: 50px;
    box-sizing: border-box;
}

.voice-btn {
    position: absolute;
    right: 8px;
    top: 8px;
    transform: translateY(0);
    width: 35px;
    height: 35px;
    padding: 0;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: var(--bg-color);
    border: 2px solid var(--primary-color);
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease, transform 0.3s ease, border-color 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.voice-btn:hover {
    background-color: var(--primary-dark-color);
    transform: scale(1.1);
}

button.voice-btn.listening {
    background-color: #e74c3c !important;
    border-color: #c0392b !important;
    animation: wavyPulse 1.5s ease-out infinite;
}


/* ==========================================================================
   6. RESPONSIVE TASARIM (MEDIA QUERIES)
   ========================================================================== */

@media (max-width: 992px) {
    .info-box.animated-box {
        flex-basis: calc(50% - 1.5rem);
        min-width: 280px;
    }
}

@media (max-width: 768px) {
    .bottom-info-boxes-container {
        flex-direction: column;
        align-items: center;
        padding: 1.5rem 0.8rem;
    }
    .info-box.animated-box {
        flex-basis: 95%;
        width: 95%;
        margin-bottom: 1.2rem;
        padding: 1.2rem;
    }
    .info-box.animated-box:last-child {
        margin-bottom: 0;
    }
    .info-box.animated-box h2 {
        font-size: 1.3rem;
    }
    .info-box.animated-box p {
        font-size: 0.85rem;
    }
}

@media (max-width: 600px) {
    header {
        padding: 1.6rem 1rem 1.2rem 1rem;
        min-height: 70px;
    }
    header h1 {
        font-size: 2.4rem;
        font-weight: 800;
        letter-spacing: 1.5px;
        line-height: 1.2;
    }
    #flask-emoji {
        font-size: 2.1rem;
        margin-right: 16px;
    }
    .footer-content {
        flex-direction: column;
        align-items: stretch;
        min-height: 60px;
    }
    .footer-social {
        right: 12px;
        bottom: 10px;
        gap: 8px;
    }
    .social-icon {
        width: 24px;
        height: 24px;
    }
    .social-icon img {
        width: 15px;
        height: 15px;
    }
    .footer-content p {
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 15px;
    }
    header, main, section {
        padding: 0.8rem;
    }
    header h1, #flask-emoji {
        font-size: 1.1rem;
    }
    section h2 {
        font-size: 1.15rem;
    }
    textarea {
        font-size: 0.8rem;
        min-height: 100px;
    }
    button {
        padding: 0.7rem;
        font-size: 0.9rem;
    }
    #query-type-section h3, .info-box.animated-box h2 {
        font-size: 1.2rem;
    }
    .query-btn {
        font-size: 0.85rem;
    }
    .info-box.animated-box p {
        font-size: 0.8rem;
    }
}