﻿:root { 
    --bg: #ffffff; 
    --text: #1a1a1a; 
    --cyan: #00acc1; 
    --orange: #ff9800; 
    --footer-bg: #1a1c1e; 
    --footer-text: #9aa0a6; 
    --sidebar-width: 300px;
}

[data-theme="dark"] { 
    --bg: #121212; 
    --text: #e0e0e0; 
    --footer-bg: #0f1011; 
    --footer-text: #70757a;
}

body { 
    margin: 0; 
    font-family: 'Segoe UI', sans-serif; 
    background: var(--bg); 
    color: var(--text); 
    transition: background-color 0.3s ease, color 0.3s ease; 
    display: flex; 
    flex-direction: column; 
    min-height: 100vh; 
    overflow-x: hidden; 
}

/* --- NAVİGASYON VE LOGO --- */
.top-nav { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 35px 3% 20px 3%; 
}

#site-logo {
    cursor: pointer;
    display: flex;
    align-items: center;
    user-select: none;
}

#site-logo h2 {
    display: flex;
    align-items: center;
    margin: 0;
    font-size: 30px; 
    font-weight: 800;
    color: var(--text);
    transition: 0.3s ease;
}

.logo-icon {
    font-size: 42px; 
    color: var(--cyan);
    margin-right: 15px; 
    filter: drop-shadow(0 0 8px rgba(0, 172, 193, 0.4));
    transition: 0.4s ease;
}

.brand-text { letter-spacing: -0.5px; }
.brand-hub { color: var(--cyan); font-weight: 300; margin-left: 4px; }

#site-logo:hover .logo-icon {
    transform: rotate(15deg) scale(1.1);
    filter: drop-shadow(0 0 15px var(--cyan));
}

#site-logo:hover h2 { transform: translateX(5px); }

/* --- MENÜ İKONU --- */
.menu-icon {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
    z-index: 1001;
}

.menu-icon span { 
    display: block; 
    width: 35px; 
    height: 4px; 
    background: var(--text); 
    margin: 5px 0; 
    border-radius: 2px;
    transition: 0.3s ease;
}

/* --- ARAMA ALANI --- */
.search-area { display: flex; flex-direction: column; align-items: center; padding: 5px 0; }
.search-wrapper { position: relative; width: 85%; max-width: 550px; display: flex; align-items: center; }
.search-icon { position: absolute; left: 15px; font-size: 16px; color: var(--cyan); display: flex; align-items: center; }

#category-search { 
    width: 100%; padding: 12px 15px 12px 45px; 
    border-radius: 30px; border: 2px solid var(--cyan); 
    background: transparent; color: var(--text); outline: none; font-size: 15px; 
}

#selection-status { font-size: 12px; color: #888; margin-top: 5px; font-weight: 600; }
.main-divider { height: 2px; background: var(--cyan); width: 100%; margin-top: 10px; }
#active-badges { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 5px; min-height: 10px; }
.badge { background: var(--cyan); color: white; padding: 4px 10px; border-radius: 20px; font-size: 11px; cursor: pointer; }

/* --- ANA İÇERİK --- */
.main-content { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    padding: 0 20px; 
    justify-content: flex-start; 
    position: relative; 
}

#content-container { text-align: center; max-width: 650px; width: 100%; margin-top: 20px; }

#fact-category {
    display: inline-block;
    background: rgba(0, 172, 193, 0.1);
    color: var(--cyan);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 10px;
    border: 1px solid var(--cyan);
}

#fact-title { margin: 5px 0 10px 0; font-size: 32px; font-weight: 800; }
#fact-text { margin: 10px 0; font-size: 18px; line-height: 1.6; font-weight: 400; opacity: 0.9; }

#image-area { 
    width: 100%; max-width: 480px; min-height: 280px; margin: 0 auto 10px auto; 
    border-radius: 20px; overflow: hidden; background: #e0e0e0; display: flex; align-items: center; justify-content: center; 
}
[data-theme="dark"] #image-area { background: #252525; }
#fact-image { width: 100%; height: 100%; object-fit: cover; display: block; }
#fact-image[src=""] { opacity: 0; }

/* --- TEMA VE BUTONLAR --- */
.theme-bar { width: 100%; height: 40px; margin-top: 10px; }
.theme-switch { position: absolute; right: 25px; top: 15px; width: 70px; height: 36px; z-index: 100; }
.theme-switch input { display: none; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: #333; border-radius: 34px; transition: 0.4s; display: flex; align-items: center; justify-content: space-around; padding: 0 5px; }
.slider:before { position: absolute; content: ""; height: 28px; width: 28px; left: 4px; top: 4px; background: white; border-radius: 50%; transition: 0.4s; z-index: 5; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
input:checked + .slider { background: var(--cyan); }
input:checked + .slider:before { transform: translateX(34px); }

.icon-sun { color: #fbc02d; font-size: 14px; }
.icon-moon { color: #81d4fa; font-size: 14px; }

.action-container { margin: 20px 0; display: flex; flex-direction: column; align-items: center; gap: 15px; }
#action-btn { padding: 14px 50px; font-size: 18px; font-weight: 800; border-radius: 50px; border: none; cursor: pointer; background: #1a1a1a; color: white; transition: 0.3s ease; }
[data-theme="dark"] #action-btn { background: #ffffff; color: #121212; }
#action-btn:hover { transform: scale(1.03); box-shadow: 0 10px 20px -8px var(--cyan); }

.extra-buttons { display: flex; gap: 10px; }
.extra-buttons button { display: none; padding: 10px 20px; border-radius: 20px; border: 2px solid var(--cyan); background: transparent; color: var(--text); cursor: pointer; font-weight: bold; font-size: 14px; transition: 0.3s ease; align-items: center; justify-content: center; }
.extra-buttons button:hover { box-shadow: 0 0 15px var(--cyan); background: rgba(0, 172, 193, 0.1); transform: translateY(-2px); }

#speak-btn.speaking { background: var(--orange) !important; color: white !important; border-color: transparent !important; animation: pulse-orange 1.5s infinite; box-shadow: 0 0 15px var(--orange) !important; }

@keyframes pulse-orange {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 152, 0, 0.4); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(255, 152, 0, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 152, 0, 0); }
}

#copy-btn:hover { background: var(--cyan); color: white; }

/* --- KATEGORİ ARŞİVİ --- */
.category-archive { 
    width: 100%; max-width: 1200px; margin: 120px auto 40px auto; padding: 20px 0; border-top: 2px solid var(--cyan); 
}
.category-archive h3 { text-align: center; color: var(--cyan); margin-bottom: 25px; font-size: 1.2rem; }
.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 15px; padding: 10px; }

.archive-item { font-size: 14px; color: var(--text); text-decoration: none !important; cursor: pointer; display: flex; align-items: center; transition: 0.2s; }
.archive-item::before { content: "•"; color: var(--cyan); margin-right: 8px; font-weight: bold; display: inline-block; }
.archive-item span { text-decoration: underline; text-underline-offset: 3px; }

/* --- KATEGORİ DETAY - EKSİKSİZ VE ORTALANMIŞ --- */
#category-detail-view { position: fixed; top: 0; left: 0; width: 100%; height: 100vh; background: var(--bg); z-index: 2000; overflow-y: auto; padding: 20px; box-sizing: border-box; }

.detail-header { 
    max-width: 1000px; 
    margin: 0 auto 30px auto; 
    display: grid;
    grid-template-columns: 80px 1fr 80px; /* Kenarlar eşit tutularak merkezleme sağlanır */
    align-items: center; 
    position: relative; 
    border-bottom: 2px solid var(--cyan); 
    padding: 15px 0; 
    min-height: 60px;
}

/* Başlık alanı */
#selected-cat-title {
    grid-column: 2;
    margin: 0;
    font-size: clamp(20px, 5vw, 28px);
    text-align: center;
    word-break: break-word;
    font-weight: 800;
}

/* Geri butonu */
.back-btn { 
    grid-column: 3;
    justify-self: end;
    background: var(--cyan); 
    color: white; 
    border: none; 
    padding: 8px 16px; 
    border-radius: 20px; 
    cursor: pointer; 
    font-weight: bold;
    white-space: nowrap; 
    flex-shrink: 0; 
}

/* Simetriyi korumak için hayali sol boşluk */
.detail-header::before {
    content: "";
    grid-column: 1;
    width: 80px;
}

.archive-fact-card { 
    background: #eeeeee; 
    border-radius: 20px; 
    padding: 25px; 
    margin: 0 auto 35px auto; 
    text-align: center; 
    border: 1px solid #dddddd; 
    max-width: 600px; 
}
[data-theme="dark"] .archive-fact-card { background: #222222; border: 1px solid #333333; }

.archive-fact-card img { 
    width: 100%; 
    max-width: 450px; 
    height: auto;
    max-height: 300px; 
    border-radius: 15px; 
    margin: 0 auto 20px auto; 
    display: block; 
    object-fit: cover; 
}

/* --- FOOTER --- */
.footer-area { 
    background: var(--footer-bg); 
    padding: 40px 20px; 
    text-align: center; 
    margin-top: auto; 
    width: 100%; 
    border-top: 1px solid rgba(255, 255, 255, 0.08); 
}
.legal-box { 
    max-width: 900px; 
    margin: 0 auto; 
    display: flex; 
    flex-direction: column; 
    gap: 15px; 
}
.footer-brand { 
    font-size: 14px; 
    font-weight: 700; 
    color: var(--cyan); 
    text-transform: uppercase; 
}
.disclaimer-box { 
    font-size: 12px; 
    color: var(--footer-text); 
    line-height: 1.8; 
    max-width: 700px; 
    margin: 10px auto 0 auto; 
    padding: 15px; 
    background: rgba(0, 0, 0, 0.2); 
    border-radius: 12px; 
}

/* --- SAĞ SIDEBAR --- */
#sidebar {
    position: fixed;
    top: 0;
    right: calc(-1 * var(--sidebar-width));
    width: var(--sidebar-width);
    height: 100%;
    background: var(--bg);
    z-index: 3000;
    transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -10px 0 30px rgba(0,0,0,0.1);
    padding: 30px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    border-left: 1px solid rgba(0, 172, 193, 0.2);
}
#sidebar.active { right: 0; }
#sidebar-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
    z-index: 2900; display: none; opacity: 0; transition: 0.3s;
}
#sidebar-overlay.active { display: block; opacity: 1; }

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}
.close-btn { font-size: 28px; cursor: pointer; color: var(--text); }
.sidebar-section { margin-bottom: 35px; text-align: left; }
.sidebar-section h3 {
    font-size: 14px;
    text-transform: uppercase;
    color: var(--cyan);
    letter-spacing: 1.5px;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(0, 172, 193, 0.1);
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    text-decoration: none;
    padding: 10px 0;
    font-size: 16px;
    transition: 0.3s;
}
.sidebar-link:hover { color: var(--cyan); transform: translateX(-5px); }

.fade-in { animation: fadeInEffect 0.6s ease forwards; }
@keyframes fadeInEffect { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* MOBİL ÖZEL */
@media (max-width: 480px) {
    .detail-header {
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding-bottom: 10px;
    }
    .detail-header::before { display: none; }
    #selected-cat-title { order: 1; font-size: 22px; }
    .back-btn { order: 2; align-self: center; padding: 6px 20px; }
}