/* mcat-web styles */
:root {
    --bg: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --text: #e6edf3;
    --text-muted: #8b949e;
    --accent: #58a6ff;
    --accent-hover: #79b8ff;
    --border: #30363d;
    --success: #3fb950;
    --tag-bg: #388bfd26;
    --tag-text: #58a6ff;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* Navbar */
.navbar {
    background: var(--bg-secondary);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

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

.search-form {
    display: flex;
    gap: 0.5rem;
    flex: 1;
    max-width: 400px;
}

.search-form input {
    flex: 1;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    font-size: 1rem;
}

.search-form input:focus {
    outline: none;
    border-color: var(--accent);
}

.search-form button {
    padding: 0.5rem 1rem;
    background: var(--accent);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
}

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

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
}

/* Page header */
.page-header {
    margin-bottom: 2rem;
    display: flex;
    align-items: baseline;
    gap: 1rem;
}

.page-header h1 {
    font-size: 2rem;
}

.page-header .count {
    color: var(--text-muted);
}

/* Tags bar */
.tags-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.tag {
    padding: 0.25rem 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 20px;
    font-size: 0.875rem;
    color: var(--text-muted);
    transition: all 0.2s;
}

.tag:hover, .tag.active {
    background: var(--tag-bg);
    color: var(--tag-text);
    text-decoration: none;
}

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

.item-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.item-card:hover {
    border-color: var(--accent);
}

.item-card a {
    display: block;
    padding: 1.5rem;
    color: inherit;
}

.item-card a:hover {
    text-decoration: none;
}

.item-card h2 {
    font-size: 1.125rem;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.item-card .meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.item-card .tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-pill {
    padding: 0.125rem 0.5rem;
    background: var(--tag-bg);
    color: var(--tag-text);
    border-radius: 12px;
    font-size: 0.75rem;
}

.empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-muted);
    padding: 3rem;
}

/* Item detail */
.item-detail {
    max-width: 800px;
}

.item-detail header {
    margin-bottom: 2rem;
}

.item-detail h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.meta-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.source-link {
    display: inline-block;
}

.item-detail .tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.summary-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    white-space: pre-wrap;
    font-family: inherit;
    line-height: 1.8;
}

.summary-content h1, .summary-content h2, .summary-content h3 {
    margin: 1.5rem 0 1rem;
}

.summary-content h1:first-child, .summary-content h2:first-child {
    margin-top: 0;
}

.summary-content ul, .summary-content ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.summary-content li {
    margin: 0.5rem 0;
}

.actions {
    display: flex;
    gap: 1rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg);
}

.btn-primary:hover {
    background: var(--accent-hover);
    text-decoration: none;
    color: var(--bg);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--border);
    text-decoration: none;
}

/* Ask page */
.ask-page header {
    margin-bottom: 2rem;
}

.ask-page h1 {
    margin-bottom: 0.5rem;
}

.back-link {
    color: var(--text-muted);
}

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

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group textarea {
    width: 100%;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
}

.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.answer-box {
    background: var(--bg-secondary);
    border: 1px solid var(--success);
    border-radius: 8px;
    padding: 1.5rem;
}

.answer-box h2 {
    color: var(--success);
    margin-bottom: 1rem;
}

.answer-content {
    line-height: 1.8;
}

.error-box {
    background: var(--bg-secondary);
    border: 1px solid #f85149;
    border-radius: 8px;
    padding: 1rem;
    color: #f85149;
}

/* Footer */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 1rem 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 1rem;
    }
    
    .search-form {
        max-width: none;
        width: 100%;
    }
    
    .items-grid {
        grid-template-columns: 1fr;
    }
    
    .container {
        padding: 1rem;
    }
}
