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

:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-color: #dee2e6;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: var(--shadow);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand a {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
}

.navbar-menu {
    display: flex;
    gap: 1.5rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    opacity: 0.9;
    transition: opacity 0.3s;
}

.nav-link:hover {
    opacity: 1;
}

.ad-container {
    max-width: 1200px;
    margin: 1rem auto;
    text-align: center;
    padding: 0 20px;
}

.ad-container iframe,
.ad-container img {
    max-width: 100%;
    height: auto;
}

.main-content {
    min-height: calc(100vh - 200px);
    padding: 2rem 0;
}

.hero-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 4rem 0;
    text-align: center;
    color: white;
}

.search-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

.search-title {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.search-subtitle {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.search-form {
    margin-bottom: 2rem;
}

.search-box {
    display: flex;
    gap: 0.5rem;
    background: white;
    padding: 0.5rem;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.search-input {
    flex: 1;
    border: none;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    border-radius: 50px;
    outline: none;
}

.search-button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.search-button:hover {
    background: #0056b3;
}

.search-icon {
    font-size: 1.2rem;
}

.search-tips {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    color: rgba(255, 255, 255, 0.9);
}

.search-tips a {
    color: white;
    text-decoration: underline;
    font-size: 0.9rem;
}

.recent-searches {
    margin-top: 2rem;
    text-align: left;
}

.recent-searches h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    opacity: 0.9;
}

.recent-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.recent-item {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    color: white;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.3s;
}

.recent-item:hover {
    background: rgba(255, 255, 255, 0.3);
}

.tags-section,
.features-section {
    padding: 3rem 0;
}

.section-title {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    text-align: center;
    color: var(--dark-color);
}

.tags-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.tag-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    border-left: 4px solid var(--primary-color);
    box-shadow: var(--shadow);
    display: flex;
    gap: 1rem;
    text-decoration: none;
    color: var(--dark-color);
    transition: transform 0.3s, box-shadow 0.3s;
}

.tag-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.tag-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.tag-info {
    flex: 1;
}

.tag-name {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.tag-desc {
    font-size: 0.9rem;
    color: var(--secondary-color);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.feature-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: var(--shadow);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

.feature-card p {
    color: var(--secondary-color);
    font-size: 0.9rem;
}

.search-result-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 20px;
}

.result-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.result-query {
    font-size: 2rem;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.result-meta {
    color: var(--secondary-color);
    font-size: 0.9rem;
}

.intent-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    background: var(--light-color);
    margin-left: 0.5rem;
}

.intent-comparison { background: #e3f2fd; color: #1976d2; }
.intent-definition { background: #f3e5f5; color: #7b1fa2; }
.intent-howto { background: #e8f5e9; color: #388e3c; }
.intent-list { background: #fff3e0; color: #f57c00; }

.answer-section {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.answer-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--dark-color);
}

.answer-content {
    line-height: 1.8;
    color: #444;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

.answer-content p {
    margin-bottom: 1rem;
}

.answer-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.answer-content th,
.answer-content td {
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    text-align: left;
}

.answer-content th {
    background: var(--light-color);
    font-weight: bold;
}

.comparison-table-container {
    overflow-x: auto;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
}

.comparison-table th,
.comparison-table td {
    border: 1px solid var(--border-color);
    padding: 1rem;
    text-align: left;
}

.comparison-table th {
    background: var(--light-color);
    font-weight: bold;
}

.suggestions-section {
    background: #fff8e1;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
}

.suggestions-section h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--dark-color);
}

.suggestions-list {
    list-style: none;
    padding: 0;
}

.suggestions-list li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.suggestions-list li::before {
    content: "💡";
    position: absolute;
    left: 0;
}

.sources-section {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.sources-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--dark-color);
}

.sources-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.source-item {
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.source-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.source-title {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

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

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

.source-snippet {
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.source-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--secondary-color);
}

.source-score {
    color: var(--success-color);
}

.tag-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 20px;
}

.tag-header {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    border-left: 5px solid var(--primary-color);
    box-shadow: var(--shadow);
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.tag-icon-large {
    width: 80px;
    height: 80px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: white;
}

.tag-header-info {
    flex: 1;
}

.tag-title {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

.tag-description {
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.tag-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.keyword-tag {
    background: var(--light-color);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    color: var(--dark-color);
    text-decoration: none;
    font-size: 0.85rem;
    transition: background 0.3s;
}

.keyword-tag:hover {
    background: var(--border-color);
}

.tag-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-refresh {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s;
}

.btn-refresh:hover {
    background: #0056b3;
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.content-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
}

.content-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.content-thumbnail {
    width: 100%;
    height: 180px;
    overflow: hidden;
}

.content-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.content-info {
    padding: 1.5rem;
}

.content-title {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.content-title a {
    color: var(--dark-color);
    text-decoration: none;
}

.content-title a:hover {
    color: var(--primary-color);
}

.content-snippet {
    color: var(--secondary-color);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.content-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--secondary-color);
}

.content-score {
    color: var(--danger-color);
}

.empty-state {
    text-align: center;
    padding: 4rem;
    background: white;
    border-radius: 12px;
}

.footer {
    background: var(--dark-color);
    color: white;
    padding: 2rem 0;
    text-align: center;
}

.footer p {
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

.flash-messages {
    max-width: 1200px;
    margin: 1rem auto;
    padding: 0 20px;
}

.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
}

.back-to-top button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: background 0.3s;
}

.back-to-top button:hover {
    background: #0056b3;
}

@media (max-width: 768px) {
    .search-title {
        font-size: 2rem;
    }

    .search-box {
        flex-direction: column;
        border-radius: 12px;
    }

    .search-input,
    .search-button {
        border-radius: 12px;
    }

    .navbar .container {
        flex-direction: column;
        gap: 1rem;
    }

    .tag-header {
        flex-direction: column;
        text-align: center;
    }

    .tag-icon-large {
        margin: 0 auto;
    }

    .content-grid {
        grid-template-columns: 1fr;
    }
}
