/* ============================================
   Moku Search - Google-Style RTL Theme
   Clean, Professional, Responsive
   ============================================ */

   :root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-header: #ffffff;
    --text-primary: #202124;
    --text-secondary: #4d5156;
    --text-muted: #70757a;
    --border-color: #dadce0;
    --border-light: #e8eaed;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 1px 6px rgba(32,33,36,0.1);
    --shadow-lg: 0 2px 12px rgba(32,33,36,0.15);
    --shadow-glow: 0 0 0 2px rgba(26,115,232,0.2);
    --link-color: #1a0dab;
    --link-visited: #681da8;
    --blue-accent: #1a73e8;
    --blue-light: #e8f0fe;
    --txt-btn-home: #303134;
    --btn-home:#e8eaed;
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 50%;
}

[data-theme="dark"] {
    --bg-primary: #202124;
    --bg-secondary: #171717;
    --bg-header: #202124;
    --text-primary: #e8eaed;
    --text-secondary: #bdc1c6;
    --text-muted: #fafcff;
    --border-color: #3c4043;
    --border-light: #2d3139;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 1px 6px rgba(0,0,0,0.4);
    --shadow-lg: 0 2px 12px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 0 2px rgba(138,180,248,0.3);
    --link-color: #8ab4f8;
    --link-visited: #c58af9;
    --blue-accent: #8ab4f8;
    --blue-light: rgba(138,180,248,0.1);
    --txt-btn-home: #e8eaed;
    --btn-home:#303134;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: 'MokuSans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    direction: rtl;
    line-height: 1.6;
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: var(--link-color);
}

a:hover { text-decoration: underline; }
a:visited { color: var(--link-visited); }

/* ===== Theme Toggle ===== */
.theme-toggle {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1000;
}

.theme-toggle button {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
    color: var(--text-secondary);
}

.theme-toggle button:hover {
    box-shadow: var(--shadow-md);
    background: var(--bg-secondary);
}

[data-theme="light"] .dark-icon { display: none; }
[data-theme="dark"] .light-icon { display: none; }

/* ===== Home Page ===== */
.home-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.home-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 640px;
    margin-top: -80px;
}

.logo-area {
    text-align: center;
    margin-bottom: 32px;
}

.logo-img {
    width: 160px;
    height: auto;
    margin-bottom: 8px;
}

.logo-subtitle {
    display: block;
    font-size: 70px;
    color: var(--text-muted);
}

.search-wrapper {
    width: 100%;
    position: relative;
}

.search-box {
    position: relative;
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: all 0.2s;
}

.search-box:hover {
    box-shadow: var(--shadow-lg);
}

.search-box:focus-within {
    box-shadow: var(--shadow-glow), var(--shadow-lg);
    border-color: transparent;
}

.search-input {
    width: 100%;
    padding: 14px 48px 14px 48px;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 16px;
    background: transparent;
    color: var(--text-primary);
    outline: none;
    font-family: inherit;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-icon-wrap {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    display: flex;
}

.search-clear {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: var(--radius-full);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 18px;
    transition: all 0.2s;
}

.search-clear:hover {
    background: var(--bg-secondary);
}

.search-input:not(:placeholder-shown) ~ .search-clear {
    display: flex;
}

.search-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 18px;
}

.btn {
    padding: 8px 17px;
    border-radius: 7px;
    text-decoration: none;
    font-weight: 700;
    transition: all 0.2s ease;
    font-size: 14px;
    background: var(--btn-home) !important;
    color: var(--txt-btn-home) !important;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    border: 1px solid(#ffffff00) !important;
}

.btn:hover {
    background: var(--btn-home)!important;
    border-color: #888888 !important;
}

/* ===== Suggestions Dropdown ===== */
.suggestions-box {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    overflow: hidden;
    display: none;
}

.suggestions-box.active {
    display: block;
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 15px;
    color: var(--text-primary);
    transition: background 0.1s;
}

.suggestion-item:hover {
    background: var(--bg-secondary);
}

.suggestion-item .sugg-icon {
    color: var(--text-muted);
    flex-shrink: 0;
}

/* ===== Header ===== */
.site-header {
    background: var(--bg-header);
    padding: 12px 28px;
    margin-top: 30px !important;
    position: sticky;
    top: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.header-logo {
    flex-shrink: 0;
}

.header-logo img {
    height: 49px;
    width: auto;
}

.header-search-form {
    flex: 1;
    min-width: 250px;
    max-width: 600px;
}

.header-search-wrap {
    position: relative;
    width: 100%;
}

.header-search-input {
    width: 100%;
    padding: 10px 42px 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 15px;
    background: var(--bg-primary);
    color: var(--text-primary);
    outline: none;
    font-family: inherit;
    transition: all 0.2s;
}

.header-search-input:focus {
    box-shadow: var(--shadow-glow);
    border-color: transparent;
}

.header-search-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.header-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.header-btn {
    background: transparent;
    border: none;
    padding: 8px 12px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    color: #5f6368;
    cursor: pointer;
    transition: background 0.2s;
}

.header-btn:hover {
    background: rgba(0,0,0,0.05);
}

/* ===== Tabs ===== */
.search-tabs {
    display: flex;
    gap: 0;
    padding: 0 28px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-header);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.search-tabs::-webkit-scrollbar {
    height: 0;
}

.tab-item {
    padding: 12px 16px 10px;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: inherit;
}

.tab-item:hover {
    color: var(--text-primary);
}

.tab-item.active {
    color: var(--blue-accent);
    border-bottom-color: var(--blue-accent);
    font-weight: 500;
}

.tab-item svg {
    width: 16px;
    height: 16px;
}

/* ===== Results ===== */
.results-main {
    max-width: 700px;
    margin: 0 auto;
    padding: 12px 28px 40px;
}

.results-info {
    padding: 13px 0 16px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.user-info-text {
    font-size: 12px;
    color: var(--text-muted);
}

.recent-searches {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 10px 0;
}

.recent-searches .label {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 28px;
}

.recent-tag {
    font-size: 12px;
    color: var(--text-secondary) !important;
    padding: 4px 12px;
    border-radius: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.recent-tag:hover {
    background: var(--blue-light);
    border-color: var(--blue-accent);
    color: var(--blue-accent);
    text-decoration: none;
}

/* ===== Result Item ===== */
.result-item {
    margin-bottom: 24px;
    padding: 4px 0;
}

.result-item.ad-item {
    background: var(--blue-light);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(26,115,232,0.15);
}

.ad-badge {
    display: inline-block;
    padding: 1px 6px;
    background: var(--blue-accent);
    color: #fff;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.result-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 12px;
}

.favicon-img {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    flex-shrink: 0;
    object-fit: contain;
}

.site-name {
    color: var(--text-primary);
    font-weight: 500;
}

.result-url-display {
    color: var(--text-muted);
    font-style: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    direction: ltr;
    text-align: right;
}

.result-title {
    font-size: 18px;
    font-weight: 400;
    margin-bottom: 4px;
    line-height: 1.35;
}

.result-title a {
    color: var(--link-color);
}

.result-title a:visited {
    color: var(--link-visited);
}

.result-snippet {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.result-divider {
    height: 1px;
    background: var(--border-light);
    margin: 16px 0;
    opacity: 0.5;
}

/* ===== Pagination ===== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 40px 0 20px;
}

.pagination a,
.pagination span {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    text-decoration: none;
    transition: all 0.2s;
    color: var(--link-color);
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
}

.pagination a:hover {
    background: var(--blue-light);
    text-decoration: none;
}

.pagination .active {
    background: var(--blue-accent);
    color: #fff;
    border-color: var(--blue-accent);
    pointer-events: none;
}

/* ===== No Results ===== */
.no-results {
    text-align: center;
    padding: 60px 20px;
}

.no-results svg {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
    opacity: 0.4;
    margin-bottom: 16px;
}

.no-results h3 {
    font-weight: 400;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.no-results p {
    color: var(--text-muted);
    font-size: 13px;
}

/* ===== Footer ===== */
.footer-note {
    text-align: center;
    padding: 20px;
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .site-header {
        padding: 10px 16px;
        gap: 12px;
    }
    
    .header-search-form {
        order: 3;
        flex: 100%;
        max-width: 100%;
    }
    
    .header-actions {
        gap: 4px;
    }
    
    .header-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .search-tabs {
        padding: 0 12px;
    }
    
    .tab-item {
        padding: 10px 10px 8px;
        font-size: 12px;
    }
    
    .results-main {
        padding: 10px 14px 30px;
        max-width: 100%;
    }
    
    .result-title {
        font-size: 16px;
    }
    
    .search-input {
        font-size: 15px;
        padding: 12px 44px 12px 40px;
    }
    
    .home-container {
        margin-top: -40px;
        padding: 0 16px;
    }
}

@media (max-width: 480px) {
    .site-header {
        padding: 8px 10px;
        gap: 8px;
        margin-top: 1px !important;
    }
    .header-logo {
        position: static;
        transform: none;
        order: 1;
        width: 100%;
        text-align: center;
    }
    .header-logo img {
        height: 49px;
    }
    
    .header-btn {
        padding: 5px 8px;
        font-size: 11px;
    }
    
    .search-tabs {
        gap: 0;
    }
    
    .tab-item {
        padding: 8px 8px 6px;
        font-size: 11px;
    }
    .results-info {
        flex-direction: column;
        gap: 4px;
        font-size: 11px;
    }
    
    .result-title {
        font-size: 15px;
    }
    
    .result-snippet {
        font-size: 12px;
    }
    
    .pagination a,
    .pagination span {
        padding: 6px 10px;
        font-size: 12px;
    }
}
.suggestions-box {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: 24px;
    margin-top: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 1000;
    display: none;
    overflow: hidden;
}

.suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
    transition: background 0.2s;
}

.suggestion-item:hover,
.suggestion-item.active {
    background: var(--bg-secondary);
}

.header-search-wrap {
    position: relative;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.95);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.loading-spinner-custom {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
}

.loading-spinner-custom .dot {
    width: 14px;
    height: 14px;
    background: #1a73e8;
    border-radius: 50%;
    animation: bounce 0.6s ease-in-out infinite;
}

.loading-spinner-custom .dot:nth-child(1) { animation-delay: 0s; }
.loading-spinner-custom .dot:nth-child(2) { animation-delay: 0.15s; }
.loading-spinner-custom .dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-18px); }
}

@media (prefers-color-scheme: dark) {
    .loading-overlay { background: rgba(0,0,0,0.95); }
    .loading-spinner-custom .dot { background: #1a73e8; }
}



.search-input:not(:placeholder-shown) ~ .search-clear,
.header-search-input:not(:placeholder-shown) ~ .search-clear {
    display: block;
}

.place-meta-tag {
    display: inline-block;
    padding: 3px 10px;
    background: transparent;
    color: var(--text-primary);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
    margin-bottom: 4px;
    border: 1px solid var(--border-light);
}

.neshan-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    color: var(--text-primary);
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 500;
    border: 1px solid var(--border-light);
}