/* ============================================================================
   SZYMDOWS SEARCH — style.css
   ============================================================================ */

/* ── Variables ────────────────────────────────────────────────────────────── */

:root {
    --c-bg:          #ffffff;
    --c-surface:     #ffffff;
    --c-raised:      #f8f9fa;
    --c-hover:       #f1f3f4;
    --c-active:      #e8eaed;

    --c-text:        #202124;
    --c-text-2:      #5f6368;
    --c-text-3:      #9aa0a6;
    --c-link:        #1558d6;
    --c-visited:     #681da8;
    --c-url:         #0d652d;

    --c-accent:      #1a73e8;
    --c-accent-d:    #1558d6;
    --c-accent-bg:   #e8f0fe;

    --c-border:      #dfe1e5;
    --c-ring:        #4285f4;

    --c-mark-bg:     #fef08a;   /* highlight colour */
    --c-mark-text:   #1a1a1a;

    --sh-box:        0 1px 6px rgba(32,33,36,.28), 0 2px 6px rgba(32,33,36,.12);
    --sh-raise:      0 4px 12px rgba(32,33,36,.20), 0 2px 6px rgba(32,33,36,.12);

    --r-pill:        24px;
    --r-sm:          8px;
    --r-xs:          4px;

    --f-body:        'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --f-display:     'DM Serif Display', Georgia, serif;

    --ease:          0.15s ease;
    --ease-spring:   0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-theme="dark"] {
    --c-bg:          #202124;
    --c-surface:     #292a2d;
    --c-raised:      #35363a;
    --c-hover:       #3c4043;
    --c-active:      #4d5055;

    --c-text:        #e8eaed;
    --c-text-2:      #9aa0a6;
    --c-text-3:      #5f6368;
    --c-link:        #8ab4f8;
    --c-visited:     #c58af9;
    --c-url:         #81c995;

    --c-accent:      #8ab4f8;
    --c-accent-d:    #aecbfa;
    --c-accent-bg:   #1a3a5c;

    --c-border:      #3c4043;
    --c-ring:        #8ab4f8;

    --c-mark-bg:     #854d0e;
    --c-mark-text:   #fef9c3;

    --sh-box:        0 1px 6px rgba(0,0,0,.50), 0 2px 6px rgba(0,0,0,.30);
    --sh-raise:      0 4px 14px rgba(0,0,0,.55), 0 2px 6px rgba(0,0,0,.35);
}

/* ── Reset ────────────────────────────────────────────────────────────────── */

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--f-body);
    font-size: 14px;
    line-height: 1.5;
    background: var(--c-bg);
    color: var(--c-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background var(--ease), color var(--ease);
}

/* ── Highlight marks ──────────────────────────────────────────────────────── */

mark {
    background: var(--c-mark-bg);
    color: var(--c-mark-text);
    border-radius: 2px;
    padding: 0 1px;
    font-style: normal;
}

/* ── Search box (shared component) ───────────────────────────────────────── */

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    height: 48px;
    padding: 0 6px 0 18px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-pill);
    transition: box-shadow var(--ease), border-color var(--ease);
    cursor: text;
}

.search-box:hover {
    box-shadow: var(--sh-box);
    border-color: transparent;
}

.search-box:focus-within {
    box-shadow: var(--sh-box);
    border-color: transparent;
}

.search-box.compact {
    height: 44px;
    padding: 0 4px 0 16px;
}

.search-box-icon {
    font-size: 20px;
    color: var(--c-text-3);
    flex-shrink: 0;
    margin-right: 10px;
    pointer-events: none;
    user-select: none;
}

.search-box-input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--f-body);
    font-size: 16px;
    color: var(--c-text);
    caret-color: var(--c-accent);
}

.search-box-input::placeholder { color: var(--c-text-3); }

.search-box-clear {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--c-text-2);
    transition: background var(--ease);
}

.search-box-clear:hover { background: var(--c-hover); }
.search-box-clear .material-symbols-rounded { font-size: 18px; }

.search-box-divider {
    width: 1px;
    height: 22px;
    background: var(--c-border);
    flex-shrink: 0;
    margin: 0 2px;
}

.search-box-submit {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--c-accent);
    transition: background var(--ease);
}

.search-box-submit:hover { background: var(--c-hover); }
.search-box-submit .material-symbols-rounded { font-size: 22px; }

/* ── Theme button ─────────────────────────────────────────────────────────── */

.theme-btn {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border: 1px solid var(--c-border);
    border-radius: 50%;
    background: var(--c-raised);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--c-text-2);
    transition: background var(--ease), border-color var(--ease), color var(--ease), box-shadow var(--ease);
}

.theme-btn:hover {
    background: var(--c-hover);
    border-color: var(--c-ring);
    color: var(--c-accent);
    box-shadow: 0 1px 4px rgba(32,33,36,.2);
}

.theme-btn:active { background: var(--c-active); }
.theme-btn .material-symbols-rounded { font-size: 20px; }

/* ============================================================================
   HOMEPAGE
   ============================================================================ */

.page-home {
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-height: 100vh;
}

/* Subtle dot-grid background — purely decorative */
.page-home::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: radial-gradient(circle, var(--c-border) 1px, transparent 1px);
    background-size: 28px 28px;
    opacity: 0.5;
    pointer-events: none;
    z-index: 0;
}

[data-theme="dark"] .page-home::before { opacity: 0.18; }

.home-header,
.home-main,
.home-footer { position: relative; z-index: 1; }

.home-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 16px 20px;
}

.home-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 20px 72px;
}

/* ── Logo ─────────────────────────────────────────────────────────────────── */

.home-logo-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin-bottom: 36px;
    animation: fadeUp 0.45s ease both;
}

.home-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(26,115,232,0.25));
    transition: transform var(--ease-spring);
}

.home-logo:hover { transform: scale(1.06); }

.home-title {
    font-family: var(--f-display);
    font-size: 52px;
    font-weight: 400;
    letter-spacing: -0.5px;
    line-height: 1;
    color: var(--c-text);
}

.home-title-accent { color: var(--c-accent); }

/* ── Home search form ─────────────────────────────────────────────────────── */

.home-form {
    width: 100%;
    max-width: 584px;
    animation: fadeUp 0.45s 0.07s ease both;
}

/* ── Action buttons ───────────────────────────────────────────────────────── */

.home-btns {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 24px;
}

.home-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    background: var(--c-raised);
    border: 1px solid var(--c-border);
    border-radius: var(--r-xs);
    font-family: var(--f-body);
    font-size: 14px;
    color: var(--c-text);
    cursor: pointer;
    white-space: nowrap;
    transition: box-shadow var(--ease), border-color var(--ease), background var(--ease);
}

.home-action-btn .material-symbols-rounded { font-size: 16px; }

.home-action-btn:hover {
    border-color: transparent;
    box-shadow: var(--sh-box);
}

.home-action-btn:active { background: var(--c-hover); }

/* ── Stats ────────────────────────────────────────────────────────────────── */

.home-stats {
    margin-top: 28px;
    font-size: 13px;
    color: var(--c-text-2);
    animation: fadeUp 0.45s 0.14s ease both;
}

/* ── Home footer ──────────────────────────────────────────────────────────── */

.home-footer {
    padding: 14px 20px;
    text-align: center;
    font-size: 13px;
    color: var(--c-text-2);
    border-top: 1px solid var(--c-border);
    background: var(--c-raised);
}

/* ============================================================================
   RESULTS PAGE
   ============================================================================ */

.page-results {
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-height: 100vh;
}

/* ── Results header ───────────────────────────────────────────────────────── */

.results-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.results-header-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 24px;
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
}

.results-logo-link {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    flex-shrink: 0;
}

.results-logo-img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.results-logo-text {
    font-family: var(--f-display);
    font-size: 22px;
    font-weight: 400;
    color: var(--c-text);
    white-space: nowrap;
}

.results-search-form {
    flex: 1;
    min-width: 0;
    max-width: 600px;
}

/* ── Results main ─────────────────────────────────────────────────────────── */

.results-main {
    padding: 0 24px 60px;
}

.results-content {
    max-width: 652px;
    padding-top: 20px;
    /* Align results under the search bar left edge */
    margin-left: max(24px, calc(50% - 476px));
}

/* ── Result count ─────────────────────────────────────────────────────────── */

.results-count {
    font-size: 13px;
    color: var(--c-text-3);
    margin-bottom: 22px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--c-border);
}

/* ── Result list ──────────────────────────────────────────────────────────── */

.results-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ── Individual result ────────────────────────────────────────────────────── */

.result-item {
    display: flex;
    flex-direction: column;
    padding: 16px 0 16px 0;
    border-bottom: 1px solid transparent;
    position: relative;
    transition: background var(--ease);
}

/* Subtle left accent on hover */
.result-item::before {
    content: '';
    position: absolute;
    left: -14px;
    top: 20px;
    bottom: 20px;
    width: 3px;
    background: var(--c-accent);
    border-radius: 2px;
    opacity: 0;
    transform: scaleY(0.4);
    transition: opacity var(--ease), transform var(--ease);
}

.result-item:hover::before {
    opacity: 1;
    transform: scaleY(1);
}

/* Source line */
.result-source {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.result-favicon {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    object-fit: contain;
    flex-shrink: 0;
}

.result-favicon-fallback {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    background: linear-gradient(135deg, var(--c-accent), var(--c-accent-d));
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.result-source-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 1px;
}

.result-domain {
    font-size: 14px;
    font-weight: 500;
    color: var(--c-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.result-url {
    font-size: 12px;
    color: var(--c-url);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

/* Title */
.result-title {
    font-size: 20px;
    line-height: 1.35;
    margin-bottom: 5px;
}

.result-title a {
    color: var(--c-link);
    text-decoration: none;
    font-weight: 400;
}

.result-title a:hover { text-decoration: underline; }
.result-title a:visited { color: var(--c-visited); }

/* Description */
.result-desc {
    font-size: 14px;
    line-height: 1.65;
    color: var(--c-text-2);
}

/* ── Pagination ───────────────────────────────────────────────────────────── */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 2px;
    padding: 40px 0 20px;
}

.pg-btn {
    padding: 8px 14px;
    border: none;
    background: transparent;
    border-radius: var(--r-xs);
    font-family: var(--f-body);
    font-size: 14px;
    font-weight: 500;
    color: var(--c-accent);
    cursor: pointer;
    transition: background var(--ease);
}

.pg-btn:hover:not(:disabled) { background: var(--c-accent-bg); }
.pg-btn:disabled { color: var(--c-text-3); cursor: default; }

.pg-num {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 500;
    color: var(--c-accent);
    cursor: pointer;
    transition: background var(--ease);
    user-select: none;
}

.pg-num:hover { background: var(--c-accent-bg); }
.pg-num.active { background: var(--c-accent); color: #fff; cursor: default; }

/* ── No results ───────────────────────────────────────────────────────────── */

.no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 64px 20px;
    text-align: center;
}

.no-results-icon-wrap {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--c-raised);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
}

.no-results-icon-wrap .material-symbols-rounded { font-size: 34px; color: var(--c-text-3); }
.no-results h2 { font-size: 20px; font-weight: 400; }
.no-results p  { font-size: 14px; color: var(--c-text-2); }

/* ── Results footer ───────────────────────────────────────────────────────── */

.results-footer {
    padding: 14px 20px;
    text-align: center;
    font-size: 13px;
    color: var(--c-text-2);
    border-top: 1px solid var(--c-border);
    background: var(--c-raised);
}

/* ── Loading ──────────────────────────────────────────────────────────────── */

.loading-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 24px 0;
    color: var(--c-text-2);
    font-size: 14px;
}

.loading-dots { display: flex; gap: 4px; }

.loading-dots span {
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--c-accent);
    animation: ldBounce 1.1s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.11s; }
.loading-dots span:nth-child(3) { animation-delay: 0.22s; }

/* ── Animations ───────────────────────────────────────────────────────────── */

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes ldBounce {
    0%, 80%, 100% { transform: scale(0.55); opacity: 0.4; }
    40%           { transform: scale(1);    opacity: 1; }
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .home-title { font-size: 40px; }
    .home-btns  { flex-direction: column; align-items: stretch; }
    .home-action-btn { justify-content: center; }

    .results-content  { margin-left: auto; }
    .results-header-inner { gap: 10px; padding: 10px 16px; }
    .results-logo-text { font-size: 18px; }
    .result-title { font-size: 18px; }
    .result-item::before { display: none; } /* hide accent bar on mobile */
}

@media (max-width: 480px) {
    .home-title { font-size: 32px; }
    .home-logo  { width: 60px; height: 60px; }
    .result-title { font-size: 17px; }
    .results-logo-text { display: none; }
    .results-main { padding: 0 16px 40px; }
}
