/**
 * Truesearch - Clean, Compact Search Engine Style
 * Left-aligned, minimal whitespace design
 */

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

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-hover: #f1f3f4;
    --text-primary: #202124;
    --text-secondary: #5f6368;
    --text-muted: #9aa0a6;
    --border-color: #dfe1e5;
    --border-focus: #4285f4;
    --accent: #1a73e8;
    --accent-hover: #1557b0;
    --link: #1a0dab;
    --link-visited: #681da8;
    --url-color: #006621;
    --shadow-light: 0 1px 6px rgba(32, 33, 36, 0.1);
    --shadow-medium: 0 2px 10px rgba(32, 33, 36, 0.15);
    --radius: 20px;
    --radius-sm: 6px;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --padding-page: 16px;
}

html {
    font-size: 15px;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.4;
    min-height: 100vh;
}

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

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px var(--padding-page);
    border-bottom: 1px solid var(--border-color);
}

.logo {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.logo:hover {
    color: var(--accent);
}

.nav {
    display: flex;
    gap: 16px;
}

.nav-link {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.15s;
}

.nav-link:hover {
    color: var(--accent);
}

/* Main */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Home View - Centered Search */
.home-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--padding-page);
    padding-bottom: 80px;
}

.brand {
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    margin-bottom: 6px;
}

.tagline {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 24px;
    letter-spacing: 0.3px;
}

/* Search Form */
.search-form {
    width: 100%;
    max-width: 540px;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 8px 14px;
    transition: all 0.2s;
    box-shadow: var(--shadow-light);
}

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

.search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.95rem;
    font-family: var(--font-sans);
    color: var(--text-primary);
    background: transparent;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: none;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.15s;
    margin-left: 10px;
}

.search-button:hover {
    background: var(--accent-hover);
}

.stats {
    margin-top: 16px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Results View - Left Aligned, Compact */
.results-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 800px;
    width: 100%;
    padding: 12px var(--padding-page);
}

.results-header {
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.search-form-inline {
    margin-bottom: 8px;
}

.search-box-inline {
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 6px 12px;
    transition: all 0.2s;
    max-width: 480px;
}

.search-box-inline:focus-within {
    background: var(--bg-primary);
    box-shadow: var(--shadow-light);
    border-color: var(--border-focus);
}

.search-input-inline {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.875rem;
    font-family: var(--font-sans);
    color: var(--text-primary);
    background: transparent;
}

.search-button-inline {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.15s;
}

.search-button-inline:hover {
    color: var(--accent);
}

.results-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Results List - Compact */
.results-list {
    flex: 1;
}

.result-item {
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid #eee;
}

.result-item:last-child {
    border-bottom: none;
}

.result-url {
    font-size: 0.75rem;
    color: var(--url-color);
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-title {
    font-size: 1rem;
    margin-bottom: 2px;
    line-height: 1.3;
}

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

.result-title a:visited {
    color: var(--link-visited);
}

.result-title a:hover {
    text-decoration: underline;
}

.result-description {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* No Results */
.no-results {
    text-align: left;
    padding: 24px 0;
    color: var(--text-secondary);
}

.no-results h3 {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.no-results p {
    font-size: 0.8rem;
}

/* Pagination - Left Aligned */
.pagination {
    display: flex;
    justify-content: flex-start;
    gap: 6px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.page-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--accent);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
}

.page-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--accent);
}

.page-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Footer - Left Aligned */
.footer {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 10px;
    padding: 10px var(--padding-page);
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.footer a {
    color: var(--text-secondary);
    text-decoration: none;
}

.footer a:hover {
    color: var(--accent);
}

.separator {
    opacity: 0.3;
}

/* Loading State */
.loading {
    text-align: left;
    padding: 24px 0;
    color: var(--text-muted);
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Utility */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .brand {
        font-size: 2.2rem;
    }

    .search-form {
        max-width: 100%;
    }

    .results-view {
        padding: 10px var(--padding-page);
    }
}
