/* Genel ayarlar */
* {
    box-sizing: border-box;
}

body {
    touch-action: manipulation;
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 2rem 1rem;
    background-color: #fff;
    overflow-x: hidden; /* sağa sola kaydırmayı engeller */
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    user-select: none; /* Prevent text selection on mobile */
}

.container {
    max-width: 600px;
    margin: auto;
    text-align: center;
    margin-top: 60px; /* header yüksekliği kadar */
}

/* Header ve footer tam genişlik ve sabit */
.header {
    width: 100vw;
    min-width: 100vw;
    left: 0;
    right: 0;
    padding: 5px 10px;
    margin: 0;
    box-sizing: border-box;
    position: fixed;
    top: 0;
    z-index: 1000;
    background: #fff;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background-color: #072e46;
    color: white;
    width: 100%;
    min-height: 60px;
    flex-wrap: wrap;
}

.header-left {
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 1;
}

.logo {
    height: 50px;
    width: auto;
    margin-right: 15px;
    margin-left: 10px;
    flex-shrink: 0;
}

.title-text {
    font-size: 1.1rem;
    font-weight: 300;
    letter-spacing: 0.5px;
    margin-left: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-right {
    display: flex;
    gap: 1rem;
    position: relative;
}

.sub-nav {
    background-color: #fff;
    display: flex;
    justify-content: center;
    padding: 5px 0;
    gap: 20px;
}

.sub-nav a {
    text-decoration: none;
    color: #121212;
    font-weight: bold;
}

/* Footer */
.footer {
    position: static;
    background-color: #072e46;
    color: white;
    padding: 20px 20px;
    text-align: center;
    margin-top: 40px;
    width: 100%;
    font-size: 0.8rem;
    bottom: 0;
    left:0;
    z-index: 1000;
}

.footer a {
    color: white;
    text-decoration: none;
    text-decoration: underline;
}

#footer-info {
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0 auto 8px auto;
    max-width: 700px;
    color: #121212;
    background: #f4f4f4;
    padding: 10px 16px;
    border-radius: 8px;
    text-align: center;
}
#footer-info a { color: #072e46; text-decoration: underline; }

/* Search alanı */
.search-area {
    display: flex;
    justify-content: center;
    margin: 18px 0 8px 0;
    border-color: #072e46;
}

.search-box-group {
    display: flex;
    align-items: center;
    gap: 6px;
    border-color: #072e46;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

#searchBox {
    height: 40px;
    border: 1px solid #072e46;
    border-radius: 6px 0 0 6px;
    padding: 0 12px;
    font-size: 1rem;
    outline: none;
    flex: 1;
    min-width: 0;
    user-select: text; /* Allow text selection in input */
    -webkit-appearance: none; /* Remove iOS styling */
    appearance: none; /* Remove default styling */
    -webkit-border-radius: 6px 0 0 6px; /* iOS border radius fix */
}

#searchBtn {
    height: 40px;
    border: 1px solid #072e46;
    border-left: none;
    border-radius: 0 6px 6px 0;
    background: #072e46;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
    padding: 0 16px;
    white-space: nowrap;
    flex-shrink: 0;
    -webkit-appearance: none;
    appearance: none;
    -webkit-border-radius: 0 6px 6px 0;
}

#searchBtn:hover { background: #003cff; }

/* Ses butonları */
.audio-buttons {
    display: inline-flex;
    gap: 4px;
    margin-left: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.audio-buttons button {
    background-color: #072e46;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s ease;
    min-height: 40px;
    touch-action: manipulation;
}

.audio-buttons button:hover {
    background-color: #003cff;
    transform: translateY(-1px);
}

/* Açıklama */
.how-it-works {
    font-size: 14px;
    font-style: italic;
    margin-bottom: 10px;
}

/* Mevcut stilin devamı */
#suggestions {
    list-style: none;
    padding: 0;
    margin-top: 5px;
    text-align: left;
}

#suggestions li {
    padding: 12px;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    cursor: pointer;
    border-radius: 4px;
    margin-bottom: 2px;
    font-size: 1rem;
    touch-action: manipulation;
    min-height: 44px;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
    user-select: text; /* Allow text selection */
}

#suggestions li:hover {
    background-color: #e9ecef;
}

#results {
    margin-top: 20px;
    text-align: left;
}

.cluster {
    background-color: #f8f9fa;
    border-left: 6px solid #072e46;
    padding: 18px;
    margin-bottom: 16px;
    border-radius: 6px;
    border: 2px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(7, 46, 70, 0.1);
    word-wrap: break-word;
    overflow-wrap: break-word;
    position: relative;
    transition: all 0.2s ease;
}

.cluster:hover {
    box-shadow: 0 4px 12px rgba(7, 46, 70, 0.15);
    border-color: #072e46;
    transform: translateY(-1px);
}

.highlight {
    font-weight: normal;
    background-color: rgb(255, 255, 0);
}

.result-word {
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 2px 4px;
    border-radius: 3px;
    touch-action: manipulation;
    user-select: text; /* Allow text selection */
    display: inline-block;
    margin: 1px;
}

.result-word:hover {
    color: #072e46;
    text-decoration: underline;
}

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    top: 85px;
    right: 15px;
    width: 55px;
    height: 28px;
    background-color: #ccc;
    border-radius: 60px;
    display: flex;
    align-items: center;
    padding: 3px;
    box-shadow: inset 0 0 5px rgb(255, 255, 0);
    cursor: pointer;
    border: none;
    z-index: 1001;
    touch-action: manipulation;
}

.toggle-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: transform 0.3s ease;
}

.dark-theme .theme-toggle {
    background-color: #121212;
}

/* Dark mode aktifken */
body.dark-theme {
    background-color: #121212;
    color: #fff;
}

body.dark-theme input,
body.dark-theme textarea {
    background-color: #121212;
    color: white;
    border-color: white;
}

body.dark-theme #searchBox {
    border-color: white;
}

body.dark-theme #searchBtn {
    border-color: white;
}

body.dark-theme .audio-buttons button {
    border: 1px solid white;
}

body.dark-theme #suggestions li {
    background-color: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
}

body.dark-theme #suggestions li:hover {
    background-color: #4a5568;
}

body.dark-theme .cluster {
    background-color: #2d3748;
    border-left: 6px solid #4299e1;
    border: 2px solid #4a5568;
    box-shadow: 0 2px 8px rgba(66, 153, 225, 0.1);
    color: #e2e8f0;
}

body.dark-theme .cluster:hover {
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.15);
    border-color: #4299e1;
}

button {
    padding: 10px 16px;
    border: none;
    background-color: #072e46;
    color: white;
    cursor: pointer;
    border-radius: 6px;
    margin: 5px;
    min-height: 44px;
    touch-action: manipulation;
    font-size: 1rem;
}

button:hover {
    background-color: #072e46;
}

body.dark-theme .footer {
    background-color: #072e46;
}

body.dark-theme .header {
    background-color: #072e46;
    color: #f1f1f1;
}

body.dark-theme #footer-info {
    background-color: #2d3748;
    color: #e2e8f0;
    border: 1px solid #4a5568;
}

body.dark-theme #footer-info a {
    color: #4299e1;
}

body.dark-theme .highlight {
    background-color: #2b6cb0;
    color: white;
}

body.dark-theme .result-word:hover {
    color: #4299e1;
}

/* Kullanım alanı */
.how-to-use {
    margin: 70px auto 18px auto;
    max-width: 700px;
    text-align: left;
    padding: 0 12px;
}

.how-to-use h2 {
    font-size: 1.3rem;
    margin-bottom: 4px;
}

.how-to-use p {
    font-size: 1rem;
    color: #333;
    margin: 0;
}

.no-results {
    font-size: 1.5rem;
    color: #b00;
    text-align: center;
    margin-top: 32px;
}



#pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 24px 0 0 0;
    flex-wrap: wrap;
}
.pagination-btn {
    padding: 8px 14px;
    border: 1px solid #072e46;
    border-radius: 4px;
    background: #072e46;
    color: white;
    cursor: pointer;
    font-size: 1rem;
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation;
    transition: background-color 0.2s;
}
.pagination-btn.active {
    background: #072e46;
    font-weight: bold;
}
.pagination-btn:hover {
    background: #003cff;
}

/* =========================
   RESPONSIVE MEDIA QUERIES
   ========================= */

/* Large screens */
@media (min-width: 1200px) {
    .container {
        max-width: 800px;
    }
    
    .title-text {
        font-size: 1.3rem;
    }
    
    #searchBox {
        font-size: 1.1rem;
    }
    
    #searchBtn {
        font-size: 1.1rem;
    }
}

/* Tablet landscape */
@media (max-width: 1024px) {
    body {
        padding: 1.5rem 0.8rem;
    }
    
    .container {
        margin-top: 80px;
    }
    
    .header {
        padding: 8px 15px;
    }
    
    .logo {
        height: 45px;
        margin-right: 12px;
    }
    
    .title-text {
        font-size: 1rem;
    }
}

/* Tablet portrait and small laptops */
@media (max-width: 768px) {
    body {
        padding: 1rem 0.5rem;
    }
    
    .container {
        margin-top: 70px;
    }
    
    .header {
        padding: 8px 12px;
        min-height: 65px;
    }
    
    .logo {
        height: 40px;
        margin-right: 10px;
        margin-left: 5px;
    }
    
    .title-text {
        font-size: 0.9rem;
        margin-left: 5px;
    }
    
    .theme-toggle {
        top: 75px;
        right: 12px;
        width: 50px;
        height: 25px;
    }
    
    .toggle-thumb {
        width: 19px;
        height: 19px;
        font-size: 12px;
    }
    
    .search-box-group {
        flex-direction: column;
        gap: 8px;
    }
    
    #searchBox {
        border-radius: 6px;
        border: 1px solid #072e46;
        height: 45px;
        font-size: 1rem;
    }
    
    #searchBtn {
        border-radius: 6px;
        border: 1px solid #072e46;
        height: 45px;
        width: 100%;
    }
    
    .audio-buttons {
        margin-left: 0;
        margin-top: 8px;
        width: 100%;
        justify-content: center;
    }
    
    .audio-buttons button {
        flex: 1;
        max-width: 200px;
    }
    
    .cluster {
        padding: 15px 12px;
        margin-bottom: 14px;
        border-left: 5px solid #072e46;
        box-shadow: 0 2px 6px rgba(7, 46, 70, 0.08);
    }
    
    #footer-info {
        padding: 15px 12px;
        font-size: 0.85rem;
    }
}

/* Mobile phones */
@media (max-width: 480px) {
    body {
        padding: 0.8rem 0.3rem;
    }
    
    .container {
        margin-top: 65px;
        padding: 0 10px;
    }
    
    .header {
        padding: 6px 10px;
        min-height: 60px;
        flex-wrap: nowrap;
    }
    
    .header-left {
        flex: 1;
        min-width: 0;
    }
    
    .logo {
        height: 35px;
        margin-right: 8px;
        margin-left: 3px;
    }
    
    .title-text {
        font-size: 0.8rem;
        margin-left: 3px;
        max-width: calc(100vw - 150px);
    }
    
    .theme-toggle {
        top: 70px;
        right: 8px;
        width: 45px;
        height: 22px;
    }
    
    .toggle-thumb {
        width: 16px;
        height: 16px;
        font-size: 10px;
    }
    
    .how-it-works {
        font-size: 13px;
        padding: 0 5px;
        text-align: center;
    }
    
    .search-area {
        margin: 15px 0 8px 0;
    }
    
    .search-box-group {
        gap: 10px;
        padding: 0 5px;
    }
    
    #searchBox {
        height: 48px;
        padding: 0 15px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    #searchBtn {
        height: 48px;
        font-size: 1rem;
        padding: 0 20px;
    }
    
    #suggestions {
        margin: 0 5px;
    }
    
    #suggestions li {
        padding: 15px 12px;
        font-size: 1rem;
        min-height: 48px;
    }
    
    #results {
        margin: 15px 5px 0 5px;
    }
    
    .cluster {
        padding: 12px 10px;
        margin-bottom: 10px;
        font-size: 0.95rem;
    }
    
    .audio-buttons button {
        padding: 12px 16px;
        font-size: 0.9rem;
        min-height: 48px;
    }
    
    #footer-info {
        margin: 0 5px 8px 5px;
        padding: 12px 10px;
        font-size: 0.8rem;
        line-height: 1.4;
    }
    
    .footer {
        padding: 15px 10px;
        font-size: 0.75rem;
    }
    
    #pagination {
        gap: 6px;
        margin: 20px 5px 0 5px;
    }
    
    .pagination-btn {
        padding: 10px 12px;
        min-width: 40px;
        min-height: 48px;
        font-size: 0.9rem;
    }
    
    button {
        min-height: 48px;
        padding: 12px 16px;
        font-size: 1rem;
    }
}

/* Very small screens (iPhone SE and similar) */
@media (max-width: 360px) {
    body {
        padding: 0.5rem 0.2rem;
    }
    
    .container {
        margin-top: 60px;
        padding: 0 5px;
    }
    
    .header {
        padding: 4px 8px;
        min-height: 55px;
    }
    
    .title-text {
        font-size: 0.7rem;
        max-width: calc(100vw - 100px);
    }
    
    .logo {
        height: 28px;
        margin-right: 4px;
    }
    
    .theme-toggle {
        width: 35px;
        height: 18px;
        right: 4px;
        top: 65px;
    }
    
    .toggle-thumb {
        width: 12px;
        height: 12px;
        font-size: 8px;
    }
    
    .how-it-works {
        font-size: 12px;
        padding: 0 3px;
        line-height: 1.3;
    }
    
    .search-box-group {
        padding: 0 2px;
        gap: 8px;
    }
    
    #searchBox {
        height: 46px;
        padding: 0 12px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    #searchBtn {
        height: 46px;
        padding: 0 15px;
        font-size: 0.9rem;
    }
    
    #suggestions {
        margin: 0 2px;
    }
    
    #suggestions li {
        padding: 12px 8px;
        font-size: 0.9rem;
        min-height: 46px;
    }
    
    #results {
        margin: 15px 2px 0 2px;
    }
    
    .cluster {
        padding: 10px 6px;
        font-size: 0.85rem;
        border-left: 3px solid #072e46;
        box-shadow: 0 1px 3px rgba(7, 46, 70, 0.05);
        margin-bottom: 10px;
    }
    
    .result-word {
        font-size: 0.85rem;
        padding: 1px 2px;
    }
    
    #footer-info {
        margin: 0 2px 6px 2px;
        padding: 8px 6px;
        font-size: 0.7rem;
        line-height: 1.3;
    }
    
    .footer {
        padding: 12px 8px;
        font-size: 0.7rem;
    }
    
    #pagination {
        margin: 15px 2px 0 2px;
        gap: 3px;
    }
    
    .pagination-btn {
        padding: 6px 8px;
        min-width: 32px;
        min-height: 42px;
        font-size: 0.8rem;
    }
    
    .audio-buttons button {
        padding: 10px 12px;
        font-size: 0.8rem;
        min-height: 46px;
    }
}

/* Landscape orientation adjustments */
@media (max-height: 500px) and (orientation: landscape) {
    .container {
        margin-top: 55px;
    }
    
    .header {
        min-height: 50px;
        padding: 5px 10px;
    }
    
    .logo {
        height: 30px;
    }
    
    .title-text {
        font-size: 0.8rem;
    }
    
    .theme-toggle {
        top: 55px;
        width: 40px;
        height: 20px;
    }
    
    .toggle-thumb {
        width: 14px;
        height: 14px;
        font-size: 10px;
    }
    
    body {
        padding: 0.5rem 0.3rem;
    }
}

/* Dark theme responsive adjustments */
@media (max-width: 480px) {
    body.dark-theme #suggestions li {
        background-color: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    body.dark-theme .cluster {
        background-color: #2d3748;
        border-left: 5px solid #4299e1;
        border: 2px solid #4a5568;
        box-shadow: 0 2px 6px rgba(66, 153, 225, 0.08);
        color: #e2e8f0;
    }
}

/* Focus states for accessibility */
@media (hover: none) and (pointer: coarse) {
    button:focus,
    input:focus,
    .theme-toggle:focus {
        outline: 2px solid #4299e1;
        outline-offset: 2px;
    }
    
    #suggestions li:focus {
        outline: 2px solid #4299e1;
        outline-offset: 1px;
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    .header {
        padding-top: env(safe-area-inset-top, 10px);
    }
    
    body {
        padding-bottom: env(safe-area-inset-bottom, 2rem);
    }
    
    #searchBox:focus {
        transform: translateZ(0); /* Force hardware acceleration */
    }
    
    /* Fix iOS zoom on input focus */
    @media screen and (max-device-width: 768px) {
        #searchBox {
            font-size: 16px !important;
        }
    }
}