/* main.css – updated responsive, dark-mode, mobile fixes */

/* reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* theme variables */
:root {
    --color-bg: #fffdfa;
    --color-text: #22223b;
    --color-primary: #0e5267;
    --color-link: #2894b3;
    --color-secondary: #125f9a;
    --color-accent: #44d3b0;
    --color-muted: #8d99ae;
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-bg: #181926;
        --color-text: #ececec;
        --color-primary: #0e5267;
        --color-link: #5bc8e8;
        --color-secondary: #125f9a;
        --color-accent: #44d3b0;
        --color-muted: #b0b4bc;
    }
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    font-size: 1rem;
}

/* header */
header {
    position: sticky;
    top: 0;
    z-index: 10;
    /*background: var(--color-primary);*/
    padding: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

/* search form */
header form {
    display: flex;
    width: 100%;
    max-width: 600px;
    gap: 0.5rem;
    flex-wrap: wrap;
}

#query {
    flex: 1;
    min-width: 0;
    padding: 0.6rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--color-muted);
    border-radius: 4px;
    background: var(--color-bg);
    color: var(--color-text);
}

button {
    padding: 0.6rem 1.2rem;
    border: none;
    background: var(--color-secondary);
    color: #fff;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
}

button:hover,
button:focus {
    background: var(--color-accent);
}

/* main container */
.main-content {
    max-width: 1024px;
    margin: 1rem auto;
    padding: 0 1rem;
}

.results,
.recent-queries {
    margin-top: 1rem;
}

/* recent queries list */
.recent-queries h2 {
    margin-bottom: 0.75rem;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 1.25rem;
}

.query-list a {
    display: inline-block;
    margin: 0.25rem;
    padding: 0.35rem 0.6rem;
    background: var(--color-secondary);
    color: #fff;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9rem;
}

/* pagination */
.pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.page-link {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-muted);
    border-radius: 4px;
    background: var(--color-bg);
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.9rem;
}

.page-link.current {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

.page-link.disabled {
    pointer-events: none;
    color: var(--color-muted);
    border-color: var(--color-muted);
}

/* table styling */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

table th,
table td {
    padding: 0.6rem;
    text-align: left;
}

table th {
    background: var(--color-secondary);
    color: #fff;
    font-weight: 600;
}

table tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.03);
}

/* responsive tables: horizontal scroll on mobile */
@media (max-width: 600px) {
    table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        margin-top: 1rem;
    }

    table thead,
    table tbody,
    table tr {
        display: table-row-group;
    }

    table th,
    table td {
        display: table-cell;
        padding: 0.4rem 0.6rem;
        white-space: nowrap;
        vertical-align: middle;
    }

    body {
        font-size: 0.95rem;
    }
}

/* very narrow screens */
@media (max-width: 400px) {
    header {
        padding: 0.5rem;
    }

    #query {
        font-size: 0.9rem;
        padding: 0.5rem;
    }

    button {
        font-size: 0.9rem;
        padding: 0.5rem 0.8rem;
        width: 100%;
    }
}

/* modal */
.modal {
    display: none;
    position: fixed;
    z-index: 999;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
}

.modal-content {
    background: var(--color-bg);
    margin: 10% auto;
    border-radius: 4px;
    width: 80%;
    max-width: 600px;
    animation: slideDown 0.4s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-150px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header,
.modal-footer {
    padding: 0.75rem 1rem;
    background: var(--color-primary);
    color: #fff;
}

.modal-body {
    padding: 1rem;
}

.close {
    float: right;
    font-size: 1.4rem;
    cursor: pointer;
}


/* --------------------------------------------------------------------
   Footer
-------------------------------------------------------------------- */
.footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.5rem 0.3rem;
    padding: 1rem;
    background: var(--color-bg);
    color: var(--color-muted);
    font-size: 0.875rem;
    text-align: center;
}


.footer {
    border-top: 1px solid var(--color-muted);
}

/* links */
a {
    color: var(--color-link);
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}

.footer a:hover,
.footer a:focus {
    color: var(--color-secondary);
}

/* small superscripts */
.footer sup {
    position: relative;
    top: -0.4em;
    font-size: 0.6em;
}

/* icons (e.g. telegram) */
.footer img {
    vertical-align: middle;
    margin: 0 0.25rem;
    width: 1em;
    height: auto;
}


.autocomplete-selected {
    background-color: rgba(0, 0, 255, 0.4) !important;
}

.autocomplete-suggestion {
    font-weight: normal;
    font-family: tahoma;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
}

.autocomplete-suggestion strong {
    font-weight: normal;
    color: #98dffd;
}

.extra_suggestions {
    margin-top: 15px;
    font-size: small;
}

.extra_suggestions div {
    margin-top: 5px;
    font-size: small;
}

.footer {
    font-family: verdana;
    font-size: x-small;
    margin-left: 15px;
    margin-top: 15%;
}

hr {
    margin-left: -15px !important;
}

.frm_container {
    font-family: Verdana;
    font-size: large;
    margin-left: 15px;
    margin-bottom: 15px;
}

.frm_container form,
.frm_container form div {
    display: inline;
}

.frm_container button {
    display: inline;
    vertical-align: middle;
}

.cBtn {
    -moz-box-shadow: inset 0px 1px 0px 0px #dcecfb;
    -webkit-box-shadow: inset 0px 1px 0px 0px #dcecfb;
    box-shadow: inset 0px 1px 0px 0px #dcecfb;
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #bddbfa), color-stop(1, #386bea));
    background: -moz-linear-gradient(top, #bddbfa 5%, #386bea 100%);
    background: -webkit-linear-gradient(top, #bddbfa 5%, #386bea 100%);
    background: -o-linear-gradient(top, #bddbfa 5%, #386bea 100%);
    background: -ms-linear-gradient(top, #bddbfa 5%, #386bea 100%);
    background: linear-gradient(to bottom, #bddbfa 5%, #386bea 100%);
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#bddbfa', endColorstr='#80b5ea', GradientType=0);
    background-color: #bddbfa;
    -moz-border-radius: 6px;
    -webkit-border-radius: 6px;
    border-radius: 6px;
    border: 1px solid #386bea;
    display: inline-block;
    cursor: pointer;
    color: #ffffff;
    font-family: Arial;
    font-size: 15px;
    font-weight: bold;
    padding: 6px 24px;
    text-decoration: none;
    text-shadow: 0px 1px 0px #528ecc;
}

.cBtn:hover {
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #80b5ea), color-stop(1, #bddbfa));
    background: -moz-linear-gradient(top, #80b5ea 5%, #bddbfa 100%);
    background: -webkit-linear-gradient(top, #80b5ea 5%, #bddbfa 100%);
    background: -o-linear-gradient(top, #80b5ea 5%, #bddbfa 100%);
    background: -ms-linear-gradient(top, #80b5ea 5%, #bddbfa 100%);
    background: linear-gradient(to bottom, #80b5ea 5%, #bddbfa 100%);
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#80b5ea', endColorstr='#bddbfa', GradientType=0);
    background-color: #80b5ea;
}

.cBtn:active {
    position: relative;
    top: 1px;
}


.noresult, .didyoumean {
    margin-left: 15px;
}

.noresult::before {
    content: 'No result for: ';
}

.noresult::after {
    content: ' :(';
}

.pos {
    font-size: small;
}

div.dhtmlx_window_active, div.dhx_modal_cover_dv {
    position: fixed !important;
}

.pn2descbtn {
    cursor: pointer;
    color: inherit;
    margin: 0px;
    margin-right: 3px;
    font-family: verdana !
}


/* legacy commented rule preserved */
/* // table td:nth-child(2) { font-family: Verdana; } */