:root {
    --bg-color: #f8fafc; 
    --text-color: #1e293b; 
    --sidebar-bg: rgba(255, 255, 255, 0.85); 
    --input-bg: rgba(255, 255, 255, 0.9);
    --border-color: rgba(0, 0, 0, 0.1);
    --accent-color: #3b82f6; 
    --accent-hover: #2563eb;
    --gradient-start: #e2e8f0; 
    --gradient-end: #f8fafc; 
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    --bg-color: #111112;
    --text-color: #f8fafc;
    --sidebar-bg: rgba(15, 15, 17, 0.9);
    --input-bg: rgba(20, 21, 23, 0.95);
    --border-color: rgba(51, 65, 85, 0.5);
    --accent-color: #60a5fa;
    --accent-hover: #93c5fd;
    --gradient-start: #111112;
    --gradient-end: #1e1f21;
    --glass-bg: rgba(15, 15, 17, 0.85);
    --glass-border: rgba(255, 255, 255, 0.15);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    background-image: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--text-color);
    display: flex;
    height: 100vh;
    overflow: hidden;
    transition: background-color 0.3s, color 0.3s, background-image 1s ease-in-out;
}

body::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: inherit;
    filter: brightness(0.7); /* Removed blur, perfectly clear image */
    z-index: -1;
    opacity: 0;
    transition: opacity 1s ease-in-out, filter 0.3s;
}
html[data-theme="dark"] body::before {
    filter: brightness(0.4); /* Darken image in dark mode to keep text readable */
}
body.bg-active::before {
    opacity: 1; 
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: var(--sidebar-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    transition: transform 0.3s ease;
    border-right: 1px solid var(--border-color);
    padding: 20px;
    z-index: 10;
    display: flex;
    flex-direction: column;
}
.sidebar.collapsed {
    transform: translateX(-100%);
    position: absolute;
}
.sidebar-header {
    margin-bottom: 20px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent-color);
}
#history-list {
    list-style: none;
    overflow-y: auto;
    flex: 1;
}
.history-item {
    padding: 10px 15px;
    margin-bottom: 8px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}
.history-item:hover {
    background: var(--accent-color);
    color: white;
    transform: translateX(5px);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    z-index: 5;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
}

.icon-btn {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    font-size: 20px;
    color: var(--text-color);
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
}
.icon-btn:hover {
    background-color: var(--accent-color);
    color: white;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    margin-left: 15px;
    color: var(--text-color); 
    text-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Chat & Welcome Area */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    overflow-y: auto;
    scroll-behavior: smooth;
    justify-content: center; /* Centered initially */
    transition: justify-content 0.5s;
}
html.has-results .chat-container {
    justify-content: flex-start;
}

.welcome-screen {
    text-align: center;
    animation: fadeIn 1s ease-out;
}
.welcome-screen h2 {
    font-size: 42px; 
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 20px;
    line-height: 1.2;
    text-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.result-content {
    width: 100%;
    max-width: 900px; /* Daha esnek, geniş sınırlar */
    line-height: 1.8;
    animation: slideUp 0.5s ease-out;
}
.hidden { display: none !important; }

/* Glass Panel for AI Response */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    color: var(--text-color);
    font-size: 16px;
}
.glass-panel h2 {
    margin-bottom: 20px;
    color: var(--accent-color);
    font-size: 28px;
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 10px;
    display: inline-block;
}

/* Loading Animation */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}
.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}
#loading-text {
    font-size: 18px;
    font-weight: 500;
    transition: opacity 0.3s ease;
}

/* Flex Bottom Input Area */
.input-area {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 10px 20px 20px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 20;
    transition: all 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
    flex-shrink: 0;
}
/* When first opened, input area is pushed up */
html:not(.has-results) .input-area {
    margin-bottom: 25vh;
}

.input-wrapper {
    display: flex;
    align-items: center;
    background-color: var(--input-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 40px;
    padding: 5px 10px 5px 25px;
    width: 100%;
    border: 1px solid var(--glass-border); 
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}
.input-wrapper:focus-within {
    border-color: var(--accent-color); 
    box-shadow: 0 15px 35px rgba(59, 130, 246, 0.2);
    transform: translateY(-2px);
}

.input-wrapper input {
    flex: 1;
    background: none;
    border: none;
    padding: 15px 0;
    font-size: 18px;
    color: var(--text-color);
    outline: none;
}
.input-wrapper input::placeholder {
    color: #94a3b8;
}

.send-btn {
    background: var(--accent-color);
    color: white;
    font-size: 20px;
    margin-left: 10px;
    transition: all 0.3s;
    border: none;
}
.send-btn:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
    color: white;
}

.signature {
    margin-top: 15px; 
    font-size: 10px;
    color: var(--text-color);
    opacity: 0.6;
    letter-spacing: 1px;
    text-align: center;
    font-weight: 600;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .glass-panel {
        padding: 20px;
    }
    .welcome-screen h2 {
        font-size: 28px;
    }
    .glass-panel h2 {
        font-size: 22px;
    }
    .input-wrapper input {
        font-size: 16px;
        padding: 12px 0;
    }
    .input-wrapper {
        padding: 5px 10px 5px 15px;
    }
    .sidebar {
        width: 100%;
        max-width: 300px;
    }
}