* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.5;
    margin: 0;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

header {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    text-align: center;
}

header h1 {
    color: #5a3e72;
    margin: 0 0 4px;
    font-size: 1.6em;
}

header p {
    color: #7a5a8a;
    font-size: 0.95em;
    max-width: 500px;
    margin: 0 auto 12px;
}

nav {
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

.nav-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 7px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.nav-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
}

.nav-btn.active {
    background: linear-gradient(135deg, #5a3e72 0%, #4a3e62 100%);
    box-shadow: 0 2px 8px rgba(90, 62, 114, 0.4);
}

main {
    max-width: 1400px;
    margin: 0 auto;
}

.content-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    display: none;
}

.content-section.active {
    display: block;
}

h2 {
    color: #5a3e72;
    border-bottom: 2px solid #667eea;
    padding-bottom: 6px;
    margin: 0 0 14px;
    font-size: 1.3em;
}

.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.overview-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 14px 16px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.overview-card h3 {
    color: #5a3e72;
    margin: 0 0 6px;
    font-size: 1em;
}

.overview-card p {
    margin: 0;
    font-size: 0.9em;
    color: #444;
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.stat-box {
    background: linear-gradient(135deg, #e8f0fe 0%, #d1e0f3 100%);
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    border-left: 3px solid #4a90e2;
}

.stat-number {
    font-size: 1.8em;
    font-weight: bold;
    color: #2c3e50;
    display: block;
}

.stat-label {
    color: #5a5a5a;
    font-size: 0.8em;
    margin-top: 2px;
}

.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    max-width: 600px;
}

.search-bar input {
    flex: 1;
    padding: 9px 12px;
    border: 2px solid #e0d5e7;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.search-bar input:focus {
    outline: none;
    border-color: #667eea;
}

.search-bar button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 9px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    white-space: nowrap;
}

.search-bar button:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.4);
}

.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 12px;
}

.item-card {
    background: white;
    border-radius: 8px;
    padding: 14px 16px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    border-left: 4px solid #667eea;
    transition: all 0.2s ease;
}

.item-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.item-card h3 {
    color: #5a3e72;
    margin: 0 0 6px;
    font-size: 1.1em;
}

.item-meta {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.item-badge {
    background: linear-gradient(135deg, #e8f0fe 0%, #d1e0f3 100%);
    color: #4a90e2;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
}

.claim-type {
    background: linear-gradient(135deg, #f0e8f5 0%, #e0d1ec 100%);
    color: #7a5a8a;
}

.confidence {
    color: #2c3e50;
}

.confidence-5 {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
}

.confidence-4 {
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
    color: #0c5460;
}

.confidence-3 {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeeba 100%);
    color: #856404;
}

.confidence-2 {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
}

.confidence-1 {
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
    color: #666;
}

.item-description {
    color: #555;
    margin: 10px 0;
    line-height: 1.4;
    font-size: 0.9em;
}

.archive-metadata {
    background: linear-gradient(135deg, #e8f8f0 0%, #d1f0e3 100%);
    padding: 8px 12px;
    border-radius: 6px;
    margin: 8px 0;
    font-size: 0.8em;
    line-height: 1.6;
    border-left: 3px solid #28a745;
    color: #2c3e50;
}

.archive-metadata strong {
    color: #1a6b3c;
}

.archive-metadata a {
    color: #1a6b3c;
    word-break: break-all;
}

.revisionism-note {
    background: linear-gradient(135deg, #fff8e1 0%, #ffefbf 100%);
    padding: 8px 12px;
    border-radius: 6px;
    margin: 8px 0;
    font-size: 0.8em;
    line-height: 1.5;
    border-left: 3px solid #e6a700;
    color: #664d00;
}

.revisionism-note strong {
    color: #8a6600;
}

.item-keywords {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.keyword {
    background: #f0e8f5;
    color: #7a5a8a;
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 0.75em;
}

/* Category cards */
.category-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.category-card {
    background: white;
    border-radius: 8px;
    padding: 14px 16px;
    cursor: pointer;
    border: 1px solid #e0d5e7;
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
    display: block;
}

.category-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

.category-card h4 {
    color: #5a3e72;
    margin: 0 0 2px;
    font-size: 1em;
}

.category-card .count {
    font-size: 0.85em;
    color: #888;
    margin-right: 6px;
}

.category-card .subcats {
    font-size: 0.78em;
    color: #999;
    margin-top: 4px;
    line-height: 1.4;
}

/* Recently added */
.recently-added {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
}

.recently-added li {
    padding: 6px 0;
    border-bottom: 1px solid #eee;
    font-size: 0.9em;
}

.recently-added li:last-child {
    border-bottom: none;
}

.recently-added a {
    color: #5a3e72;
    text-decoration: none;
    cursor: pointer;
}

.recently-added a:hover {
    text-decoration: underline;
}

.recently-added .date {
    color: #999;
    font-size: 0.8em;
    margin-left: 8px;
}

/* Global search results */
.global-results {
    margin-bottom: 16px;
}

.global-results .result-count {
    color: #888;
    font-size: 0.85em;
    margin-bottom: 8px;
}

/* Form */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    margin-bottom: 3px;
    color: #5a3e72;
    font-weight: 500;
    font-size: 0.9em;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 10px;
    border: 2px solid #e0d5e7;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.submit-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.2s;
    width: 100%;
}

.submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

footer {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    margin-top: 16px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

footer p {
    color: #7a5a8a;
    margin: 0;
    font-size: 0.85em;
}

.empty-state {
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 24px;
}

@media (max-width: 768px) {
    nav {
        flex-direction: column;
        align-items: center;
    }
    
    .items-grid {
        grid-template-columns: 1fr;
    }
    
    .overview-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-container {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }
    
    .category-cards {
        grid-template-columns: 1fr 1fr;
    }
}