/* ===== Base ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

@font-face {
    font-family: "KurdFont";
    src: url("font.ttf") format("truetype");
    -webkit-tap-highlight-color: transparent;
}

* {
    font-family: "KurdFont", sans-serif;
    box-sizing: border-box;
}

:root {
    --bg: #ffffff;
    --surface: #f3f3f3;
    --primary: #2563eb;
    --ku2fa: #ff0000;
    --fa2ku: #e1e1e1;
    --ku2ku: #006837;
    --text: #212121;
    --text-sub: #181818;
    --border: #ffffff;
    --tools: #212121;
    --radius: 16px;
    --transition: .25s ease;
}

[data-theme="dark"] {
    --bg: #212121;
    --surface: #1d1d1d;
    --text: #ffffff;
    --text-sub: #f2f2f2;
    --tools: #f2f2f2;
    --border: #1d1d1d;
}

html,
body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    transition: background var(--transition), color var(--transition);
    overflow-x: hidden;
    overflow-y: scroll;
    scrollbar-width: none;
    -ms-overflow-style: none;
    touch-action: manipulation;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
    display: none;
}

button svg use {
    fill: var(--tools) !important;
}

div svg use {
    fill: var(--tools) !important;
}

/* ===== Pages ===== */
.page {
    display: none;
    min-height: 100vh;
    animation: fadeIn .3s ease;
}

.page.active {
    display: flex;
    flex-direction: column;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Theme Toggle ===== */
.theme-toggle {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 999;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: background var(--transition), transform .2s;
}

.theme-toggle:hover {
    transform: scale(1.1);
}

/* ===== Home Page ===== */
.home-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    gap: 40px;
}

.logo-wrap {
    text-align: center;
}

.logo-icon {
    font-size: 4rem;
    margin-bottom: 12px;
    display: block;
}

.app-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 6px;
}

.app-sub {
    font-size: .95rem;
    color: var(--text-sub);
}

.btn-group-wrap {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    max-width: 400px;
}

.dict-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 22px;
    border: none;
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform .2s, box-shadow .2s;
    text-align: right;
    position: relative;
    overflow: hidden;
}

.dict-btn::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    border-radius: 0 var(--radius) var(--radius) 0;
}

.btn-ku2fa::before {
    background: var(--ku2fa);
}

.btn-fa2ku::before {
    background: var(--fa2ku);
}

.btn-ku2ku::before {
    background: var(--ku2ku);
}

.dict-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, .12);
}

.dict-btn:active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 1.4rem;
}

.btn-label {
    flex: 1;
}

.dict-btn .bi-arrow-left-short {
    font-size: 1.4rem;
    color: var(--text-sub);
}

/* ===== Search Page ===== */
.search-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--surface);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .06);
    position: sticky;
    top: 0;
    z-index: 10;
}

.back-btn {
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: var(--bg);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background .2s;
    flex-shrink: 0;
}

.back-btn:hover {
    background: var(--border);
}

.search-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-sub);
}

/* ===== Search Box ===== */
.search-wrap {
    padding: 20px 16px 12px;
}

.search-box-container {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 2px solid transparent;
    transition: border-color .2s, box-shadow .2s;
}

.search-box-container:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(92, 107, 192, .15);
}

.search-icon {
    position: absolute;
    right: 16px;
    color: var(--text);
    font-size: 1.1rem;
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 5px 8px 5px 8px;
    border: none;
    background: transparent;
    font-size: 1.1rem;
    color: var(--text);
    outline: none;
    font-family: inherit;
    direction: rtl;
}

.search-input::placeholder {
    color: var(--text-sub);
}

.kurdish-keys {
    display: none;
    flex-wrap: wrap;
    justify-content: center;
    border: none;
    user-select: none;
    gap: 6px;

}

.kkey {
    min-width: 40px;
    height: 40px;
    border: 2px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font-size: 1.2rem;
    margin-top: 10px;
    cursor: pointer;
    transition: background .2s, border-color .2s, transform .1s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kkey:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.kkey:active {
    transform: scale(.92);
}

.kkey-toggle {
    position: absolute;
    left: 12px;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: var(--bg);
    color: var(--text-sub);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: background .2s;
}

.kkey-toggle.active {
    background: var(--primary);
    border-color: var(--primary);
}

.kurdish-keys.visible {
    display: flex;
}

.clear-btn {
    position: absolute;
    left: 12px;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: var(--bg);
    color: var(--text-sub);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: background .2s;
}

.clear-btn:hover {
    background: var(--surface);
    color: #fff;
}

.clear-btn.visible {
    display: flex;
}

/* ===== Results ===== */
.results-area {
    padding: 8px 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.result-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    animation: slideUp .2s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-content {
    flex: 1;
    min-width: 0;
}

.card-word {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.card-trans {
    font-size: .95rem;
    color: var(--text-sub);
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.copy-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: var(--bg);
    color: var(--text-sub);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: background .2s, color .2s;
    flex-shrink: 0;
}

.copy-btn:hover {
    background: var(--surface);
    color: #fff;
}

.copy-btn.copied {
    background: #43a047;
    color: #fff;
}

/* ===== States ===== */
.state-msg {
    text-align: center;
    padding: 48px 16px;
    color: var(--text-sub);
    font-size: .95rem;
}

.state-msg .state-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    display: block;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    margin: 48px auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

footer {
    margin-top: 0px;
    opacity: .7;
    font-size: 14px;
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
    .app-title {
        font-size: 1.6rem;
    }

    .dict-btn {
        padding: 15px 18px;
        font-size: .98rem;
    }

    .search-input {
        font-size: 1rem;
    }

    .card-word {
        font-size: 1rem;
    }
}