/* Custom styles for Helsedirektoratet (hdir) branding */

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


/* HTMX loading indicator styles */
.htmx-indicator {
    opacity: 0;
    transition: opacity 200ms ease-in;
    pointer-events: none;
}

.htmx-request .htmx-indicator {
    opacity: 1;
}

.htmx-request.htmx-indicator {
    opacity: 1;
}

/* Ensure form elements are always clickable */
form,
textarea,
input,
select,
button {
    pointer-events: auto !important;
    position: relative;
    z-index: 1;
}

/* /sok page: export buttons (JSON, CSV, Kopier); ensure solid backgrounds
   when buttons are injected by JS so Tailwind CDN has these classes */
.export-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}
.export-buttons button {
    font-weight: 600;
    padding: 0.75rem 1.25rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.2s;
}
.export-buttons button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}
/* Export actions: brand + aksent + to toner (ikke regnbue) */
.export-buttons button:nth-child(1) {
    background-color: var(--brand-primary);
    color: #fff;
}
.export-buttons button:nth-child(1):hover {
    background-color: var(--brand-primary-dark);
}
.export-buttons button:nth-child(2) {
    background-color: var(--accent);
    color: #fff;
}
.export-buttons button:nth-child(2):hover {
    background-color: var(--accent-dark, var(--accent));
}
.export-buttons button:nth-child(3) {
    background-color: color-mix(in srgb, var(--brand-primary) 32%, var(--surface));
    color: var(--brand-primary-dark);
}
.export-buttons button:nth-child(3):hover {
    background-color: color-mix(in srgb, var(--brand-primary) 22%, var(--surface));
}
.export-buttons button:nth-child(4) {
    background-color: var(--surface);
    color: var(--brand-primary);
    border: 1px solid var(--border-default);
}
.export-buttons button:nth-child(4):hover {
    background-color: color-mix(in srgb, var(--brand-primary) 8%, var(--surface));
}

/* /sok page: "Vis innhold" content preview; scrollable box so full content is visible.
   Does not rely on Tailwind (HTMX-loaded partial may not have Tailwind classes applied.) */
.search-result-content-box {
    background: #f9fafb;
    padding: 1rem 1.25rem;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    min-height: 12rem;
    max-height: 70vh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}
.search-result-content-text {
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-word;
    font-size: 0.875rem;
    line-height: 1.6;
    color: #1f2937;
    display: block;
    width: 100%;
    min-height: 10rem;
    margin: 0;
    font-family: inherit;
}

/* Empty/error state inside .search-result-content-box when the Vis innhold endpoint
   returns no body (kapitler/referanser/seksjoner and title-only artikler). */
.search-result-empty-state {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
    border-radius: 0.375rem;
    padding: 1rem 1.25rem;
    min-height: 8rem;
    justify-content: center;
}
.search-result-empty-state__heading {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e3a8a;
    margin: 0;
}
.search-result-empty-state__body {
    font-size: 0.875rem;
    line-height: 1.5;
    color: #1e3a8a;
    margin: 0;
    max-width: 56ch;
}
.search-result-empty-state__cta {
    display: inline-flex;
    align-items: center;
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    background: #2563eb;
    color: #ffffff;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.15s ease;
}
.search-result-empty-state__cta:hover,
.search-result-empty-state__cta:focus {
    background: #1d4ed8;
    text-decoration: none;
}
.search-result-empty-state--error {
    background: #fef2f2;
    border-left-color: #dc2626;
}
.search-result-empty-state--error .search-result-empty-state__heading {
    color: #991b1b;
}

/* Animation for results */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#search-results > div {
    animation: fadeIn 0.3s ease-in;
}

/* Focus styles */
input:focus,
textarea:focus,
select:focus {
    outline: none;
}

/* Button hover effects */
button,
a.button {
    transition: all 0.2s ease;
}

button:hover,
a.button:hover {
    transform: translateY(-1px);
}

/* Header title link */
.header-title-link {
    color: inherit;
    text-decoration: none;
    transition: opacity 0.2s ease;
    display: inline-block;
}

.header-title-link:hover {
    opacity: 0.9;
    cursor: pointer;
}

/* Bottom-right corner: theme toggle + license (fixed to viewport, always visible) */
.bottom-right-corner {
    position: fixed;
    bottom: 0;
    right: 0;
    margin: 0.75rem 1rem;
    z-index: 2147483647;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    pointer-events: none;
}
.bottom-right-corner .theme-toggle,
.bottom-right-corner .ui-variation-picker,
.bottom-right-corner .bottom-right-corner-license {
    pointer-events: auto;
}
.bottom-right-corner-license {
    font-size: 0.75rem;
    text-decoration: none;
    padding: 0.35rem 0.6rem;
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(6px);
    color: var(--frisk-neutral-medium);
    transition: color 0.2s ease, background-color 0.2s ease;
}

.bottom-right-corner-license:hover {
    background-color: rgba(255, 255, 255, 0.98);
    color: var(--frisk-neutral-dark);
}

/* Enhanced UI Components for Overlaps Analysis */

/* Enhanced Card Hover Effects */
.bg-white.rounded-xl {
    transition: all 0.3s ease;
}

.bg-white.rounded-xl:hover {
    transform: translateY(-2px);
}

/* Enhanced Input Focus States */
input:focus,
select:focus,
textarea:focus {
    outline: 3px solid var(--focus-ring, var(--accent));
    outline-offset: 2px;
    border-color: var(--brand-primary);
    box-shadow: none;
    transition: all 0.2s ease;
}

/* Smooth Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#overlaps-list > div {
    animation: slideIn 0.4s ease-out;
}

/* Loading Spinner Enhancement */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Enhanced Button Shadows */
button.shadow-md,
a.shadow-md {
    transition: all 0.2s ease;
}

button.shadow-md:hover,
a.shadow-md:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Enhanced Border Radius for Modern Look */
.rounded-xl {
    border-radius: 0.75rem;
}

/* Smooth Transitions for All Interactive Elements */
button,
a,
input,
select,
details {
    transition: all 0.2s ease;
}

/* Enhanced Details/Summary Styling */
details summary {
    list-style: none;
}

details summary::-webkit-details-marker {
    display: none;
}

details[open] summary {
    margin-bottom: 1rem;
}

/* Improved Scrollbar for Better Aesthetics */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 6px;
}

::-webkit-scrollbar-thumb {
    background: var(--brand-primary);
    border-radius: 6px;
    border: 2px solid var(--surface-muted, #f1f5f9);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--brand-primary-dark);
}

/* Enhanced Focus Visible States for Accessibility */
*:focus-visible {
    outline: 3px solid var(--focus-ring, var(--accent));
    outline-offset: 2px;
    border-radius: 4px;
}

/* Print Styles */
@media print {
    button,
    a.button {
        display: none !important;
    }
}

/* Bottom-right: UI variation picker (see main.js) */
.ui-variation-picker {
    position: relative;
    pointer-events: auto;
}
.ui-variation-picker > summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 400;
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(6px);
    color: var(--frisk-neutral-medium);
    user-select: none;
    transition: color 0.2s ease, background-color 0.2s ease;
}
.ui-variation-picker > summary::-webkit-details-marker {
    display: none;
}
.ui-variation-picker > summary:hover {
    background-color: rgba(255, 255, 255, 0.98);
    color: var(--frisk-neutral-dark);
}
html[data-screenshot="1"] .bottom-right-corner .ui-variation-picker {
    display: none !important;
}

