:root {
    --gold-primary: #f59e0b;
    --gold-secondary: #d97706;
    --charcoal-primary: #1a1a2e;
    --charcoal-tertiary: #16213e;
    --text-primary-color: #e0e0e0;
    --text-secondary-color: #a0a0a0;
    --border-color: #2a2a4a;
    --success-color: #22c55e;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--charcoal-primary);
    color: var(--text-primary-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 16px;
    width: 100%;
}

.search-hero {
    text-align: center;
    padding: 32px 0 24px;
}

.search-hero h1 {
    font-size: 2rem;
    color: var(--gold-primary);
    margin-bottom: 8px;
}

.search-hero p {
    color: var(--text-secondary-color);
    font-size: 1rem;
}

.search-container {
    background: var(--charcoal-tertiary);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}

.search-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.search-row input,
.search-row select {
    flex: 1;
    padding: 12px 16px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary-color);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
}

.search-row input:focus,
.search-row select:focus {
    outline: none;
    border-color: var(--gold-primary);
}

.search-row select option {
    background: var(--charcoal-primary);
    color: var(--text-primary-color);
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--gold-primary);
    color: var(--charcoal-primary);
}

.btn-primary:hover {
    background: var(--gold-secondary);
}

.btn-secondary {
    background: rgba(255,255,255,0.1);
    color: var(--text-primary-color);
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.15);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.tab {
    padding: 8px 16px;
    background: none;
    border: none;
    color: var(--text-secondary-color);
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab.active {
    color: var(--gold-primary);
    border-bottom-color: var(--gold-primary);
}

.tab:hover {
    color: var(--text-primary-color);
}

.results-container {
    min-height: 200px;
}

.result-card {
    background: var(--charcoal-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    transition: border-color 0.2s;
}

.result-card:hover {
    border-color: var(--gold-primary);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
}

.result-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary-color);
    flex: 1;
}

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

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

.result-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-secondary-color);
}

.result-meta span i {
    margin-right: 4px;
    width: 14px;
}

.result-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.badge-posted { background: rgba(34,197,94,0.2); color: var(--success-color); }
.badge-closed { background: rgba(239,68,68,0.2); color: var(--error-color); }
.badge-forecast { background: rgba(59,130,246,0.2); color: var(--info-color); }

.match-score {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.match-high { background: rgba(34,197,94,0.2); color: var(--success-color); }
.match-medium { background: rgba(245,158,11,0.2); color: var(--warning-color); }
.match-low { background: rgba(107,114,128,0.2); color: #6b7280; }

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary-color);
}

.empty-state i {
    font-size: 48px;
    color: var(--gold-primary);
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 14px;
    margin-top: 8px;
}

.loading-spinner {
    display: none;
    text-align: center;
    padding: 32px;
}

.loading-spinner.active {
    display: block;
}

.loading-spinner i {
    font-size: 32px;
    color: var(--gold-primary);
    animation: spin 1s linear infinite;
}

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

.foundation-card {
    background: var(--charcoal-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}

.foundation-card .org-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--gold-primary);
}

.foundation-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.foundation-stat {
    text-align: center;
    padding: 8px;
    background: rgba(255,255,255,0.03);
    border-radius: 6px;
}

.foundation-stat .value {
    font-size: 16px;
    font-weight: 700;
    color: var(--gold-primary);
}

.foundation-stat .label {
    font-size: 11px;
    color: var(--text-secondary-color);
}

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    background: var(--charcoal-tertiary);
    border: 1px solid var(--gold-primary);
    border-radius: 8px;
    color: var(--text-primary-color);
    font-size: 14px;
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.draft-section {
    background: var(--charcoal-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
}

.draft-section h3 {
    color: var(--gold-primary);
    font-size: 14px;
    margin-bottom: 12px;
}

.draft-content {
    white-space: pre-wrap;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-primary-color);
}

.disclaimer {
    background: rgba(245,158,11,0.1);
    border: 1px solid rgba(245,158,11,0.3);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 12px;
    color: var(--warning-color);
    margin-top: 12px;
}

.disclaimer i {
    margin-right: 4px;
}

.mode-toggle {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}

.mode-btn {
    padding: 10px 24px;
    background: rgba(255,255,255,0.05);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary-color);
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

.mode-btn.active {
    background: rgba(245,158,11,0.15);
    border-color: var(--gold-primary);
    color: var(--gold-primary);
}

.mode-btn:hover {
    border-color: var(--gold-secondary);
    color: var(--text-primary-color);
}

.mode-btn i {
    margin-right: 6px;
}

.personal-hook {
    text-align: center;
    padding: 16px;
    margin-bottom: 16px;
}

.personal-hook .hook-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gold-primary);
    margin-bottom: 4px;
}

.personal-hook .hook-sub {
    font-size: 0.9rem;
    color: var(--text-secondary-color);
}

.cos-attribution {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin-top: 16px;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    font-size: 11px;
    color: var(--text-secondary-color);
}

.cos-attribution a {
    color: var(--gold-primary);
    text-decoration: none;
}

.cos-attribution a:hover {
    text-decoration: underline;
}

.cos-logo {
    height: 24px;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .search-row {
        flex-direction: column;
    }

    .result-header {
        flex-direction: column;
    }

    .result-meta {
        flex-direction: column;
        gap: 4px;
    }

    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .foundation-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .main-content {
        padding: 16px 12px;
    }

    .search-hero h1 {
        font-size: 1.5rem;
    }

    .mode-toggle {
        flex-direction: column;
        align-items: stretch;
    }

    .mode-btn {
        min-height: 44px;
    }

    .cos-attribution {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .result-actions {
        flex-direction: column;
    }

    .btn {
        min-height: 44px;
    }

    .tab {
        min-height: 44px;
        padding: 8px 12px;
    }
}
