/* Search UI - Mobile-first, minimal */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
    color: #1a1a1a;
    background: #fff;
    min-height: 100vh;
}

#app {
    max-width: 640px;
    margin: 0 auto;
    padding: 1rem;
}

/* Landing state - centered */
#app.landing {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 80vh;
}

#app.landing .search-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

#app.landing h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
}

.search-subtitle {
    font-size: 0.875rem;
    color: #666;
    margin-top: 0.5rem;
}

/* Results state - top aligned */
#app.has-results {
    padding-top: 0;
}

#app.has-results .search-header {
    display: none;
}

#app.has-results #search-form {
    position: sticky;
    top: 0;
    background: #fff;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e5e5e5;
    z-index: 10;
}

/* Search box */
.search-box {
    display: flex;
    gap: 0.5rem;
}

.search-box input {
    flex: 1;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.15s;
}

.search-box input:focus {
    border-color: #0066cc;
}

.search-box button {
    padding: 0 1rem;
    background: #0066cc;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.search-box button:hover {
    background: #0052a3;
}

.search-box button:active {
    background: #004080;
}

/* Filter bar */
#filter-bar {
    padding: 0.75rem 0;
    border-bottom: 1px solid #e5e5e5;
}

.filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #333;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.filter-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #1a7f37;
    cursor: pointer;
}

/* Results */
#results {
    margin-top: 1rem;
}

.results-count {
    font-size: 0.875rem;
    color: #666;
    padding: 0.5rem 0;
}

.result-card {
    display: block;
    padding: 1rem;
    margin-bottom: 0.75rem;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    -webkit-tap-highlight-color: transparent;
}

.result-card:active {
    background: #f5f5f5;
}

.result-title {
    font-size: 1rem;
    font-weight: 600;
    color: #0066cc;
    margin-bottom: 0.25rem;
}

.result-meta {
    font-size: 0.875rem;
    color: #666;
    margin-bottom: 0.5rem;
}

/* Open/closed status indicators */
.status-open {
    color: #1a7f37;
}

.status-closed {
    color: #999;
}

/* Closed tender cards - visually recede */
.result-card.result-closed {
    opacity: 0.7;
}

.result-card.result-closed .result-title {
    color: #666;
}

.result-snippet {
    font-size: 0.875rem;
    color: #333;
    line-height: 1.6;
}

.result-snippet strong {
    background: #fff3cd;
    font-weight: 600;
}

.result-docs {
    margin-top: 0.5rem;
}

.result-doc {
    font-size: 0.8125rem;
    color: #666;
    margin-top: 0.375rem;
    padding-left: 1rem;
    border-left: 2px solid #e5e5e5;
}

.result-doc-name {
    color: #0066cc;
}

/* Load more */
.load-more {
    display: block;
    width: 100%;
    padding: 1rem;
    margin: 1rem 0;
    font-size: 1rem;
    color: #0066cc;
    background: #f5f5f5;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.load-more:hover {
    background: #e5e5e5;
}

.load-more:disabled {
    color: #999;
    cursor: not-allowed;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
}

.empty-state p:first-child {
    font-size: 1.125rem;
    font-weight: 500;
    color: #333;
    margin-bottom: 0.5rem;
}

/* Loading */
#loading {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e5e5e5;
    border-top-color: #0066cc;
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: spin 0.8s linear infinite;
}

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

/* Error */
#error {
    text-align: center;
    padding: 3rem 1rem;
}

.error-title {
    font-size: 1.125rem;
    font-weight: 500;
    color: #cc0000;
    margin-bottom: 0.5rem;
}

.error-detail {
    color: #666;
}

/* Footer */
.search-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.5rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.9);
}

.search-footer a {
    font-size: 0.75rem;
    color: #999;
    text-decoration: none;
}

.search-footer a:hover {
    color: #666;
    text-decoration: underline;
}

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

/* Desktop - slightly larger */
@media (min-width: 640px) {
    #app {
        padding: 2rem;
    }

    #app.landing h1 {
        font-size: 2rem;
    }

    .search-box input {
        padding: 1rem 1.25rem;
        font-size: 1.125rem;
    }
}
