/*! Vitesearch - Fully Optimized CSS (Palm Tree Sway Active | CLS 0 | Fast Mobile FCP/LCP) */

/* ===== 1. FONT OPTIMIZATION ===== */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: local('Inter'), local('Segoe UI'), local('Roboto'), sans-serif;
}

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: #f0fdf4;
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 50%, #f0fdf4 100%) no-repeat fixed;
    color: #334155;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow-x: hidden;
}

/* ===== DARK MODE ===== */
body.dark-mode {
    background: #0f172a;
    color: #e2e8f0;
}

body.dark-mode .search-box-wrapper,
body.dark-mode .premium-ad-banner,
body.dark-mode .content-area,
body.dark-mode .category-card,
body.dark-mode .search-result-item,
body.dark-mode .dark-toggle-btn {
    background: #1e293b;
    border-color: #334155;
}

body.dark-mode .search-input { color: #e2e8f0; }
body.dark-mode .search-input::placeholder { color: #94a3b8; }
body.dark-mode .search-btn { background: #0f766e; color: #fff; }
body.dark-mode .top-header-bar { border-bottom-color: #1e293b; }
body.dark-mode .nav-tab { color: #94a3b8; }

body.dark-mode .nav-tab.active,
body.dark-mode h1.logo-text,
body.dark-mode .lang-link,
body.dark-mode .ad-destination-url,
body.dark-mode footer a,
body.dark-mode .search-result-item .result-url,
body.dark-mode .listing-item .listing-url {
    color: #2dd4bf;
}

body.dark-mode .nav-tab.active { border-bottom-color: #2dd4bf; }
body.dark-mode .lang-link.active-lang { background: #2dd4bf; color: #0f172a !important; }
body.dark-mode .premium-ad-banner { border-left-color: #2dd4bf; }
body.dark-mode .ad-main-link,
body.dark-mode .listing-item .listing-name,
body.dark-mode .search-result-item .result-title { color: #67e8f9; }
body.dark-mode .ad-body-text,
body.dark-mode .listing-item .listing-desc,
body.dark-mode .search-result-item .result-desc { color: #cbd5e1; }

body.dark-mode .category-card:hover,
body.dark-mode .search-result-item:hover {
    background: #334155;
    border-color: #2dd4bf;
}

body.dark-mode .category-card .cat-name { color: #e2e8f0; }
body.dark-mode .category-card .cat-count,
body.dark-mode .footer-left { color: #94a3b8; }
body.dark-mode .listing-item { border-bottom-color: #334155; }
body.dark-mode .back-btn { background: #334155; color: #e2e8f0; }
body.dark-mode .back-btn:hover { background: #475569; }
body.dark-mode footer { background: rgba(15, 23, 42, 0.8); border-top-color: #1e293b; }
body.dark-mode .skeleton-line { background: #334155; }

/* ===== HEADER & NAV ===== */
.top-header-bar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    border-bottom: 1px solid rgba(15, 118, 110, 0.08);
    flex-wrap: wrap;
    gap: 8px;
    min-height: 50px;
}

.top-nav-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.nav-tab {
    font-size: 14px;
    color: #64748b;
    text-decoration: none;
    padding: 6px 12px;
    font-weight: 500;
    border-radius: 20px;
    cursor: pointer;
    background: transparent;
    border: none;
}

.nav-tab:hover { background: rgba(15, 118, 110, 0.08); }
.nav-tab.active { font-weight: 600; color: #0f766e; background: rgba(15, 118, 110, 0.12); }
.nav-tab.desktop-only { display: none; }

.dark-toggle-btn {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(15, 118, 110, 0.25);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 18px;
    cursor: pointer;
}

@media (min-width: 768px) {
    .nav-tab.desktop-only { display: inline-block; }
    .top-nav-tabs { gap: 8px; }
    .nav-tab { padding: 6px 16px; }
}

/* ===== MAIN WRAPPER ===== */
.engine-viewport-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 20px 40px 20px;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 20px;
    min-height: 58px; /* Layout Space Reserved for CLS Guard */
}

/* ===== PALM TREE SWAY ANIMATION (GPU Hardware Accelerated) ===== */
.date-palm-tree {
    font-size: 36px;
    display: inline-block !important;
    transform-origin: bottom center !important;
    will-change: transform;
    transform: translateZ(0); /* Offloads rendering to Mobile GPU */
    animation: gentleSway 3.5s ease-in-out infinite alternate;
    -webkit-user-select: none;
    user-select: none;
}

.tree-right {
    animation-delay: 1.75s;
}

@keyframes gentleSway {
    0% {
        transform: rotate(-4deg) scale(1) translateZ(0);
    }
    100% {
        transform: rotate(4deg) scale(1.02) translateZ(0);
    }
}

h1.logo-text {
    font-size: 48px;
    font-weight: 800;
    color: #115e59;
    letter-spacing: -1.5px;
    margin: 0;
    padding: 0;
    line-height: 1.2;
    min-height: 58px;
}

/* ===== SEARCH BOX ===== */
.search-box-wrapper {
    width: 100%;
    max-width: 620px;
    min-height: 52px;
    background: #fff;
    border-radius: 28px;
    padding: 4px 4px 4px 20px;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 12px rgba(15, 118, 110, 0.05);
    border: 1px solid rgba(15, 118, 110, 0.25);
}

.search-input {
    flex: 1;
    border: 0;
    outline: 0;
    font-size: 16px;
    color: #1e293b;
    padding: 10px 0;
    background: transparent;
    min-width: 0;
    font-family: inherit;
}

.search-btn {
    background: #0f766e;
    color: #fff;
    border: 0;
    padding: 10px 24px;
    border-radius: 22px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
}

.lang-row {
    margin-top: 16px;
    font-size: 13px;
    color: #475569;
    text-align: center;
    flex-wrap: wrap;
    display: flex;
    justify-content: center;
    gap: 2px;
    min-height: 24px;
}

.lang-link {
    color: #0f766e;
    text-decoration: none;
    cursor: pointer;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 4px;
}

.lang-link.active-lang {
    background: #0f766e;
    color: #fff !important;
    font-weight: 700;
}

/* ===== RESULTS LAYER (Zero CLS Pure Fade Animation) ===== */
.results-canvas-layer {
    width: 100%;
    max-width: 820px;
    margin-top: 20px;
    display: none;
    flex-direction: column;
    gap: 20px;
    will-change: opacity;
    animation: fadeInResults .20s ease forwards;
}

@keyframes fadeInResults {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

.results-canvas-layer.visible {
    display: flex;
}

/* ===== AD BANNER (CLS Reserved Space) ===== */
.premium-ad-banner {
    width: 100%;
    background: #ffffff;
    border: 1px solid rgba(15, 118, 110, 0.2);
    border-left: 5px solid #0f766e;
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 4px 15px rgba(15, 118, 110, 0.05);
    text-align: left;
    min-height: 160px;
    height: 160px;
    overflow-y: auto;
}

/* ===== SKELETON LOADING ===== */
.ad-skeleton {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 0;
    min-height: 140px;
}

.skeleton-line {
    background: #e2e8f0;
    border-radius: 4px;
}

.skeleton-badge { width: 60px; height: 14px; }
.skeleton-title { width: 70%; height: 20px; }
.skeleton-url { width: 40%; height: 14px; }
.skeleton-desc { width: 90%; height: 16px; }

.ad-badge {
    font-size: 9px;
    font-weight: 700;
    color: #fff;
    background: #0f766e;
    padding: 2px 8px;
    border-radius: 3px;
    text-transform: uppercase;
    display: inline-block;
    margin-bottom: 6px;
}

.ad-main-link {
    font-size: 18px;
    color: #1a0dab;
    text-decoration: none;
    font-weight: 600;
    display: block;
}

.ad-destination-url {
    font-size: 13px;
    color: #0f766e;
    display: block;
    margin-top: 2px;
}

.ad-body-text {
    font-size: 14px;
    color: #475569;
    margin-top: 6px;
    line-height: 1.5;
}

/* ===== CONTENT AREA ===== */
.content-area {
    width: 100%;
    background: #fff;
    border-radius: 12px;
    border: 1px solid rgba(15, 118, 110, 0.15);
    padding: 24px;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.content-area .empty-state {
    text-align: center;
    color: #94a3b8;
    padding: 20px;
}

.content-area .empty-state .empty-icon { font-size: 48px; }
.content-area .empty-state .empty-text { font-size: 16px; margin-top: 8px; }

/* ===== CATEGORIES GRID ===== */
.categories-grid {
    display: none;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    width: 100%;
}

@media (min-width: 480px) { .categories-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 640px) { .categories-grid { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 768px) { .categories-grid { grid-template-columns: repeat(6, 1fr); } }

.category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 8px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    text-align: center;
}

.category-card:hover {
    background: #f1f5f9;
    border-color: #0f766e;
}

.category-card .cat-icon { font-size: 28px; }
.category-card .cat-name { font-size: 13px; font-weight: 600; color: #1e293b; margin-top: 4px; }
.category-card .cat-count { font-size: 11px; color: #94a3b8; margin-top: 2px; }

/* ===== LISTINGS ===== */
.listings-container {
    display: none;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

.listing-item {
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 14px;
}

.listing-item:last-child { border-bottom: 0; padding-bottom: 0; }
.listing-item .listing-name { font-size: 17px; color: #1a0dab; text-decoration: none; font-weight: 500; display: block; }
.listing-item .listing-url { font-size: 13px; color: #0f766e; display: block; margin-top: 2px; word-break: break-all; }
.listing-item .listing-desc { font-size: 14px; color: #4b5563; line-height: 1.5; margin-top: 4px; }

.back-btn {
    display: inline-block;
    background: #e2e8f0;
    border: 0;
    border-radius: 20px;
    padding: 8px 18px;
    font-size: 14px;
    font-weight: 500;
    color: #1e293b;
    cursor: pointer;
    font-family: inherit;
    margin-bottom: 16px;
    align-self: flex-start;
}

/* ===== SEARCH RESULTS ===== */
.search-results-list {
    display: none;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

.search-result-item {
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.search-result-item .result-title { font-size: 17px; color: #1a0dab; text-decoration: none; font-weight: 500; display: block; }
.search-result-item .result-url { font-size: 13px; color: #0f766e; display: block; margin-top: 2px; word-break: break-all; }
.search-result-item .result-desc { font-size: 14px; color: #4b5563; line-height: 1.5; margin-top: 4px; }

.search-label {
    font-size: 16px;
    color: #64748b;
    margin-bottom: 12px;
    text-align: center;
    width: 100%;
}

.search-label strong { color: #0f766e; }

/* ===== FOOTER ===== */
footer {
    width: 100%;
    border-top: 1px solid rgba(15, 118, 110, 0.08);
    background: rgba(255, 255, 255, 0.4);
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 50px;
}

.footer-left { font-size: 13px; color: #64748b; }
.footer-right { display: flex; gap: 16px; flex-wrap: wrap; }
footer a { color: #0f766e; font-size: 13px; text-decoration: none; font-weight: 500; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .engine-viewport-wrapper { padding: 10px 12px 30px 12px; }
    h1.logo-text { font-size: 32px; min-height: 42px; }
    .date-palm-tree { font-size: 24px; }
    .search-box-wrapper { padding: 4px 4px 4px 14px; border-radius: 24px; }
    .search-input { font-size: 15px; padding: 8px 0; }
    .search-btn { padding: 8px 16px; font-size: 14px; border-radius: 20px; }
    .top-header-bar { padding: 8px 12px; }
    .nav-tab { font-size: 13px; padding: 4px 10px; }
    .categories-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .category-card { padding: 12px 6px; }
    .category-card .cat-icon { font-size: 22px; }
    .category-card .cat-name { font-size: 12px; }
    .content-area { padding: 16px; }
    .listing-item .listing-name { font-size: 15px; }
    footer { flex-direction: column; text-align: center; gap: 6px; }
    .footer-right { justify-content: center; }
    .premium-ad-banner { min-height: 150px; height: 150px; padding: 12px 16px; }
    .ad-skeleton { min-height: 120px; }
}

@media (max-width: 400px) {
    .categories-grid { grid-template-columns: repeat(2, 1fr); }
    h1.logo-text { font-size: 26px; min-height: 36px; }
    .date-palm-tree { font-size: 20px; }
}