/* ═══════════════════════════════════════════════════
   Falcon Search — falcon.css
   ═══════════════════════════════════════════════════ */

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

:root {
    --blue:       #1a6ff4;
    --blue-dark:  #0a3fa8;
    --blue-hover: #1558c7;
    --text:       #202124;
    --text-2:     #5f6368;
    --text-3:     #70757a;
    --visited:    #1a0dab;
    --border:     #dfe1e5;
    --bg:         #ffffff;
    --bg-2:       #f8f9fa;
    --radius:     8px;
    --shadow:     0 1px 6px rgba(32,33,36,.12);
    --shadow-lg:  0 4px 16px rgba(32,33,36,.2);

    /* Layout */
    --content-width: 760px;   /* main results column */
    --panel-width:   420px;   /* image side panel */
    --left-pad:      160px;   /* space left of results on wide screens */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    font-size: 14px;
    line-height: 1.5;
}

a { text-decoration: none; color: inherit; }

/* ══════════════════════════════════════════════════
   HOME PAGE
══════════════════════════════════════════════════ */

.home-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.home-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    width: 100%;
    max-width: 580px;
    margin-bottom: 4rem;
}

.home-logo svg {
    width: 84px; height: 84px;
    filter: drop-shadow(0 4px 16px rgba(26,111,244,.3));
}

.home-title {
    font-size: 2.6rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--blue), var(--blue-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.home-sub { color: var(--text-3); font-size: .95rem; margin-top: -.5rem; }

.home-form { width: 100%; }

.home-search-box {
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 0 8px 0 18px;
    gap: 8px;
    box-shadow: var(--shadow);
    background: var(--bg);
    transition: box-shadow .2s, border-color .2s;
}
.home-search-box:focus-within {
    border-color: transparent;
    box-shadow: var(--shadow-lg), 0 0 0 2px rgba(26,111,244,.2);
}
.home-search-icon { color: var(--text-3); flex-shrink: 0; width: 20px; height: 20px; }

.home-input {
    flex: 1; border: none; outline: none;
    font-size: 1rem; padding: 14px 0;
    color: var(--text); background: transparent;
}
.home-input::placeholder { color: var(--text-3); }

.home-btn {
    background: var(--blue); color: white;
    border: none; border-radius: 20px;
    padding: 10px 22px; font-size: .9rem;
    font-weight: 600; cursor: pointer;
    white-space: nowrap; transition: background .15s;
}
.home-btn:hover { background: var(--blue-hover); }

.home-tabs-hint {
    display: flex; gap: 1.5rem;
    color: var(--text-3); font-size: .85rem;
}

.home-footer {
    position: fixed; bottom: 1.2rem;
    color: var(--text-3); font-size: .8rem;
}

/* ══════════════════════════════════════════════════
   RESULTS PAGE SHELL
══════════════════════════════════════════════════ */

.results-page { display: flex; flex-direction: column; min-height: 100vh; }

/* ── Header ── */
.results-header {
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    position: sticky; top: 0; z-index: 200;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 10px 24px;
    max-width: calc(var(--left-pad) + var(--content-width) + 48px);
    /* no centering on header — logo always left-aligns */
}

.results-logo {
    display: flex; align-items: center;
    gap: 8px; font-size: 1.2rem;
    font-weight: 700; color: var(--blue);
    flex-shrink: 0;
}
.logo-text { display: none; }
@media (min-width: 500px) { .logo-text { display: inline; } }

.results-search-form { flex: 1; max-width: 580px; }

.results-search-box {
    display: flex; align-items: center;
    border: 1px solid var(--border);
    border-radius: 24px; overflow: hidden;
    box-shadow: var(--shadow); background: var(--bg);
    transition: box-shadow .2s, border-color .2s;
}
.results-search-box:focus-within {
    box-shadow: var(--shadow-lg), 0 0 0 2px rgba(26,111,244,.18);
    border-color: transparent;
}

.search-icon { color: var(--text-3); margin-left: 14px; flex-shrink: 0; }

.results-input {
    flex: 1; border: none; outline: none;
    padding: 10px 12px; font-size: 1rem;
    color: var(--text); background: transparent;
}

.results-search-btn {
    background: var(--blue); color: white;
    border: none; padding: 10px 18px;
    font-size: .875rem; font-weight: 600;
    cursor: pointer; white-space: nowrap;
    transition: background .15s;
}
.results-search-btn:hover { background: var(--blue-hover); }

/* ── Tab bar ── */
.tab-bar {
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.tab-bar-inner {
    display: flex;
    padding: 0 24px;
    /* align tabs so they start at the same left edge as results */
    padding-left: calc(var(--left-pad) + 24px);
}

.tab {
    display: flex; align-items: center; gap: 6px;
    padding: 10px 14px;
    font-size: .875rem; color: var(--text-2);
    border-bottom: 3px solid transparent;
    transition: color .15s; white-space: nowrap;
}
.tab:hover { color: var(--blue); }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }

/* ── Page wrapper: results + panel ── */
.page-wrapper {
    display: flex;
    flex: 1;
    /* Center the results column with generous left padding */
    padding-left: var(--left-pad);
}

.results-col {
    width: var(--content-width);
    max-width: var(--content-width);
    flex-shrink: 0;
    padding: 20px 24px 60px;
}

/* Panel column — hidden by default, slides in when active */
.img-panel {
    width: 0;
    overflow: hidden;
    transition: width .25s ease;
    flex-shrink: 0;
}

.img-panel.open {
    width: var(--panel-width);
    border-left: 1px solid var(--border);
}

.img-panel-sticky {
    position: sticky;
    top: 110px; /* below header + tab bar */
    width: var(--panel-width);
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    padding: 20px;
}

/* Responsive: on small screens collapse left-pad */
@media (max-width: 1100px) {
    :root { --left-pad: 40px; }
}
@media (max-width: 800px) {
    :root { --left-pad: 0px; }
    .tab-bar-inner { padding-left: 16px; }
    .results-col { padding: 16px; }
}

/* ══════════════════════════════════════════════════
   RESULTS CONTENT
══════════════════════════════════════════════════ */

.results-meta {
    color: var(--text-3); font-size: .8rem;
    margin-bottom: 1.2rem;
}
.results-time { margin-left: 4px; }

.error-banner {
    display: flex; align-items: flex-start;
    gap: 12px; padding: 16px;
    background: #fce8e6; border-radius: var(--radius);
    color: #c5221f; font-size: .9rem;
}

.no-results { color: var(--text-2); font-size: 1rem; padding: 2rem 0; }

/* ── Web results ── */
.web-results { display: flex; flex-direction: column; gap: 1.5rem; }

.web-result-url {
    font-size: .78rem; color: var(--text-3);
    margin-bottom: 2px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.web-result-title {
    display: block; font-size: 1.1rem;
    color: var(--visited); font-weight: 400;
    line-height: 1.3; margin-bottom: 4px;
}
.web-result-title:hover { text-decoration: underline; }
.web-result-snippet { color: var(--text-2); font-size: .875rem; line-height: 1.58; }

/* ── Image grid ── */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 6px;
}

/* When panel is open, tighten the grid a bit */
.img-panel.open ~ * .image-grid,
.has-panel .image-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
}

.image-tile {
    display: block; border: none; background: none;
    padding: 0; cursor: pointer;
    border-radius: 6px; overflow: hidden;
    transition: transform .15s, box-shadow .15s;
    outline: none;
}
.image-tile:hover    { transform: scale(1.03); box-shadow: var(--shadow-lg); }
.image-tile.selected { outline: 3px solid var(--blue); outline-offset: 2px; }

.image-tile-inner {
    width: 100%; aspect-ratio: 4/3;
    overflow: hidden; background: var(--bg-2);
}
.image-tile-inner img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
    transition: opacity .2s;
}

/* ── Image panel ── */
.img-panel-img-wrap {
    position: relative;
    background: var(--bg-2);
    border-radius: var(--radius);
    overflow: hidden;
    min-height: 200px;
    display: flex; align-items: center; justify-content: center;
}
.img-panel-img-wrap img {
    width: 100%; max-height: 340px;
    object-fit: contain; display: block;
}

.img-panel-spinner {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-2);
}
.img-panel-spinner.hidden { display: none; }

.spinner-icon {
    animation: spin 1s linear infinite;
    color: var(--blue);
}
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.img-panel-close {
    position: absolute; top: 8px; right: 8px;
    background: rgba(0,0,0,.5); color: white;
    border: none; border-radius: 50%;
    width: 28px; height: 28px;
    font-size: 1.2rem; line-height: 28px;
    cursor: pointer; z-index: 10;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s;
}
.img-panel-close:hover { background: rgba(0,0,0,.75); }

.img-panel-meta { padding-top: 12px; }

.img-panel-title {
    font-size: .95rem; font-weight: 600;
    color: var(--text); line-height: 1.4;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 3; -webkit-box-orient: vertical;
    overflow: hidden;
}

.img-panel-size { font-size: .78rem; color: var(--text-3); margin-bottom: 12px; }

.img-panel-actions {
    display: flex; gap: 8px; margin-bottom: 10px;
    flex-wrap: wrap;
}

.img-panel-btn-primary,
.img-panel-btn-secondary {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px; border-radius: 6px;
    font-size: .82rem; font-weight: 600;
    cursor: pointer; transition: background .15s, border-color .15s;
}
.img-panel-btn-primary {
    background: var(--blue); color: white;
    border: 1px solid var(--blue);
}
.img-panel-btn-primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); }

.img-panel-btn-secondary {
    background: var(--bg); color: var(--text);
    border: 1px solid var(--border);
}
.img-panel-btn-secondary:hover { background: var(--bg-2); border-color: #aaa; }

.img-panel-source {
    font-size: .75rem; color: var(--text-3);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── Video results ── */
.video-results { display: flex; flex-direction: column; gap: 1rem; }

.video-card {
    display: flex; gap: 14px; padding: 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg);
    transition: box-shadow .15s, border-color .15s;
}
.video-card:hover { box-shadow: var(--shadow); border-color: #c5cae9; }

.video-thumb {
    position: relative;
    width: 200px; min-width: 200px;
    aspect-ratio: 16/9;
    border-radius: 6px; overflow: hidden;
    background: #111; flex-shrink: 0;
}
.video-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-thumb-placeholder {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    background: #111; color: #555;
}
.video-duration {
    position: absolute; bottom: 6px; right: 6px;
    background: rgba(0,0,0,.8); color: white;
    font-size: .72rem; font-weight: 600;
    padding: 2px 5px; border-radius: 3px;
}

.video-info { flex: 1; overflow: hidden; }
.video-title {
    font-size: 1rem; color: var(--visited);
    font-weight: 500; line-height: 1.3;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.video-card:hover .video-title { text-decoration: underline; }
.video-channel { font-size: .8rem; color: var(--text-2); margin-bottom: 4px; }
.video-snippet { font-size: .83rem; color: var(--text-2); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.video-source  { font-size: .75rem; color: var(--text-3); margin-top: 6px; }

@media (max-width: 560px) {
    .video-thumb { width: 130px; min-width: 130px; }
}

/* ── News results ── */
.news-results { display: flex; flex-direction: column; gap: .75rem; }

.news-card {
    display: flex; gap: 14px; padding: 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--bg);
    align-items: flex-start;
    transition: box-shadow .15s, border-color .15s;
}
.news-card:hover { box-shadow: var(--shadow); border-color: #c5cae9; }

.news-thumb {
    width: 100px; min-width: 100px; height: 70px;
    object-fit: cover; border-radius: 5px;
    background: var(--bg-2); flex-shrink: 0;
}
.news-content { flex: 1; overflow: hidden; }
.news-source { font-size: .75rem; color: var(--blue); font-weight: 600; margin-bottom: 4px; }
.news-title {
    font-size: 1rem; font-weight: 500;
    color: var(--text); line-height: 1.3; margin-bottom: 5px;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}
.news-card:hover .news-title { color: var(--blue); }
.news-snippet { font-size: .83rem; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.news-date    { font-size: .75rem; color: var(--text-3); margin-top: 5px; }

/* ── Pagination ── */
.pagination {
    display: flex; align-items: center;
    justify-content: center; gap: 1rem;
    margin-top: 2.5rem; padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}
.page-btn {
    padding: 9px 20px;
    border: 1px solid var(--border);
    border-radius: 6px; color: var(--blue);
    font-size: .875rem; font-weight: 500;
    background: var(--bg);
    transition: background .15s, border-color .15s;
}
.page-btn:hover { background: var(--bg-2); border-color: var(--blue); }
.page-num { color: var(--text-3); font-size: .875rem; }
