:root {
    --primary: #1e88e5;
    --primary-hover: #1565c0;
    --accent: #42a5f5;
    --success: #66bb6a;
    --transition: all 0.2s ease;
}

body {
    min-height: 100.1vh;
    background: #f5f7fa;
}

article {
    margin-top: 0;
    box-shadow: none;
}

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

nav {
    background: #1565c0;
    padding: 1rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

nav a {
    color: white;
    text-decoration: none;
    transition: var(--transition);
}

nav a:hover {
    text-decoration: none;
}

.logo {
    display: inline-flex;
    align-items: center;
    font-size: 1.1rem;
    letter-spacing: 0.08em;
    line-height: 1;
    transition: var(--transition);
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
}

.logo-icon {
    flex-shrink: 0;
    margin-right: 10px;
    transition: transform 0.3s ease;
}

.logo-text {
    font-weight: 700;
    color: white;
    padding: 2px 0;
}

.logo:hover {
    text-decoration: none;
    background: rgba(255, 255, 255, 0.1);
}

.logo:hover .logo-icon {
    transform: rotate(-5deg) scale(1.05);
}

.logo:hover .logo-text {
    color: white;
    opacity: 0.95;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 2rem auto;
    max-width: 800px;
}

.search-box input {
    flex: 3;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    transition: var(--transition);
    background: white;
}

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

.search-box button {
    flex: 1;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    background: var(--primary);
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.search-box button:hover {
    background: var(--primary-hover);
}

.search-box button:active {
    opacity: 0.9;
}

.results {
    background: white;
    border-radius: 4px;
    padding: 1.5rem;
    border: 1px solid #e0e0e0;
}

.results h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.result-item {
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    background: white;
    transition: var(--transition);
}

.result-item:hover {
    border-color: var(--primary);
    background: #f8fbff;
}

.result-item:first-child {
    margin-top: 1rem;
}

.result-item:last-child {
    margin-bottom: 0;
}

.result-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    font-weight: 600;
}

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

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

.result-snippet {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    line-height: 1.5;
    color: #546e7a;
    font-size: 0.9rem;
}

.result-snippet mark {
    background: #fff59d;
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: 600;
}

.meta {
    font-size: 0.85rem;
    color: #78909c;
    margin-bottom: 1rem;
    padding: 0.6rem 0.85rem;
    background: rgba(30, 136, 229, 0.04);
    border-radius: 4px;
    border-left: 2px solid var(--primary);
}

table {
    margin-top: 2rem;
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    background: white;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

th {
    background: var(--primary);
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.9rem;
}

td, th {
    padding: 1.25rem 1.5rem;
    text-align: left;
}

tr {
    transition: var(--transition);
}

tr:hover {
    background: rgba(30, 136, 229, 0.05);
}

tbody tr {
    border-bottom: 1px solid rgba(30, 136, 229, 0.1);
}

tbody tr:last-child {
    border-bottom: none;
}

.total td {
    font-weight: 700;
    background: rgba(30, 136, 229, 0.1);
    border-top: 2px solid var(--primary);
}

.stats-card {
    background: white;
    border-radius: 4px;
    margin-top: 2rem;
    padding: 1.5rem;
    border: 1px solid #e0e0e0;
}

.stats-card h2 {
    margin-top: 0;
    color: var(--primary);
}

/* Main content styling */
main.container > p {
    font-size: 1rem;
    color: #546e7a;
    text-align: center;
    margin: 2rem auto;
    max-width: 700px;
    line-height: 1.5;
}

/* Error styling */
.error {
    background: #ffebee;
    border: 2px solid #ef5350;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 2rem 0;
    color: #c62828;
    font-weight: 500;
}

/* Enhance links */
a {
    transition: var(--transition);
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Documents page link styling */
nav a[href="/documents"] {
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    transition: var(--transition);
    font-weight: 600;
    font-size: 0.9rem;
}

nav a[href="/documents"]:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Documents listing */
.document-list {
    margin-top: 1.5rem;
}

.document-item {
    padding: 1rem 0;
    border-bottom: 1px solid #e0e0e0;
    transition: var(--transition);
}

.document-item:first-child {
    padding-top: 0;
}

.document-item:last-child {
    border-bottom: none;
}

.document-item:hover {
    background: rgba(30, 136, 229, 0.02);
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    margin-left: -0.5rem;
    margin-right: -0.5rem;
}

.document-title {
    display: block;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--primary);
    text-decoration: none;
    margin-bottom: 0.25rem;
    transition: var(--transition);
}

.document-title:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.document-source {
    font-size: 0.8rem;
    color: #78909c;
    word-break: break-all;
}

/* Responsive Design */
@media (max-width: 768px) {
    /* Adjust font sizes for mobile */
    .logo-text {
        font-size: 1rem;
    }

    .search-box {
        flex-direction: column;
        gap: 0.75rem;
    }

    .search-box input,
    .search-box button {
        width: 100%;
    }

    /* Adjust padding for mobile */
    nav {
        padding: 1rem;
    }

    .container {
        padding: 0.75rem;
    }

    .results,
    .stats-card {
        padding: 1.25rem;
    }

    .result-item {
        padding: 1rem;
    }

    .document-title {
        font-size: 1rem;
    }
}
