/* Lovdata RAG — Minimalistisk juridisk design */

:root {
    --bg: #fafaf9;
    --surface: #ffffff;
    --text: #1a1a1a;
    --text-secondary: #666;
    --border: #e5e5e5;
    --accent: #1a4d7c;
    --accent-hover: #15406a;
    --accent-light: #e8f0f8;
    --success: #2d7d46;
    --warning: #b45309;
    --radius: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --max-width: 800px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--accent);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

/* Søkefelt */
.search-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: var(--shadow);
}

#query {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.2s;
}

#query:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.search-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.btn {
    padding: 0.6rem 1.25rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent);
    color: white;
    flex: 1;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--accent-light);
    color: var(--accent);
}

.btn-secondary:hover:not(:disabled) {
    background: #d5e5f3;
}

/* Loading */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 0.5rem;
}

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

.hidden {
    display: none !important;
}

/* AI-svar */
.answer-section {
    margin-top: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

.answer-section h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 0.75rem;
}

.answer-content {
    font-size: 0.95rem;
    line-height: 1.7;
}

.answer-content h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 1rem 0 0.5rem;
}

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

.answer-content ul, .answer-content ol {
    margin: 0.5rem 0 0.75rem 1.5rem;
}

.answer-content a {
    color: var(--accent);
}

.answer-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1rem 0;
}

.answer-content strong {
    font-weight: 600;
}

.answer-meta {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Søkeresultater */
.results-section {
    margin-top: 1.5rem;
}

.results-section h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.result-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow);
}

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

.result-law {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.result-ref {
    font-weight: 600;
    color: var(--accent);
}

.result-ref a {
    color: inherit;
    text-decoration: none;
}

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

.result-title {
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.result-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    max-height: 6em;
    overflow: hidden;
    position: relative;
}

.result-text.expanded {
    max-height: none;
}

.result-badge {
    display: inline-block;
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    background: var(--accent-light);
    color: var(--accent);
}

.result-expand {
    font-size: 0.8rem;
    color: var(--accent);
    cursor: pointer;
    border: none;
    background: none;
    padding: 0.25rem 0;
    margin-top: 0.25rem;
}

/* Footer */
footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
}

footer a {
    color: var(--accent);
}

.footer-meta {
    margin-top: 0.5rem;
}

/* Responsivt */
@media (max-width: 600px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 1.4rem;
    }

    .search-actions {
        flex-direction: column;
    }
}
