/* ═══════════════════════════════════════════════════════════
   TNonline Design System — Scandinavian Industrial
   ═══════════════════════════════════════════════════════════ */

:root {
    /* Primary — deep charcoal with warmth */
    --tn-primary: #1A1D23;
    --tn-primary-light: #24272E;
    --tn-primary-dark: #111318;

    /* Accent — deep teal, industrial, confident */
    --tn-accent: #0D7377;
    --tn-accent-hover: #0A5C5F;
    --tn-accent-light: #EFFAFA;

    /* Status colors — muted, professional */
    --tn-success: #2D8B4E;
    --tn-success-light: #F0F9F3;
    --tn-warning: #B8860B;
    --tn-warning-light: #FDF8EC;
    --tn-danger: #C53030;
    --tn-danger-light: #FDF2F2;
    --tn-info: #0D7377;
    --tn-info-light: #EFFAFA;

    /* Text — warm, readable */
    --tn-text-primary: #1A1A1A;
    --tn-text-secondary: #5F6368;
    --tn-text-muted: #9AA0A6;
    --tn-text-on-dark: #B8BCC2;
    --tn-text-on-dark-bright: #ECEEF0;

    /* Backgrounds — warm neutrals */
    --tn-bg-page: #F5F5F3;
    --tn-bg-card: #FFFFFF;
    --tn-bg-hover: #FAFAF8;
    --tn-bg-active: #EFFAFA;

    /* Borders — clean, warm */
    --tn-border: #E3E3E0;
    --tn-border-light: #F0F0EE;

    /* Sidebar */
    --tn-sidebar-width: 252px;
    --tn-sidebar-bg: #1A1D23;
    --tn-sidebar-hover: rgba(255, 255, 255, 0.06);
    --tn-sidebar-active: rgba(13, 115, 119, 0.25);

    /* Shadows — subtle, grounded */
    --tn-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --tn-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    --tn-shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
    --tn-shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.1);

    /* Radius — angular, industrial */
    --tn-radius-sm: 3px;
    --tn-radius: 6px;
    --tn-radius-lg: 8px;
    --tn-radius-xl: 10px;

    /* Spacing — 8px base */
    --tn-space-xs: 4px;
    --tn-space-sm: 8px;
    --tn-space-md: 16px;
    --tn-space-lg: 24px;
    --tn-space-xl: 32px;

    /* Typography — Figtree: warm geometric, professional */
    --tn-font-family: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --tn-font-size-xs: 0.75rem;
    --tn-font-size-sm: 0.8125rem;
    --tn-font-size-base: 0.9375rem;
    --tn-font-size-lg: 1.0625rem;
    --tn-font-size-xl: 1.1875rem;
    --tn-font-size-2xl: 1.375rem;
    --tn-font-size-3xl: 1.75rem;

    /* Transitions — quick, purposeful */
    --tn-transition: 0.15s ease;
    --tn-transition-slow: 0.25s ease;
}

/* ═══════════════════════════════════════════════════════════
   Reset & Base
   ═══════════════════════════════════════════════════════════ */

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    font-family: var(--tn-font-family);
    font-size: var(--tn-font-size-sm);
    color: var(--tn-text-primary);
    background-color: var(--tn-bg-page);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}

a {
    color: var(--tn-accent);
    text-decoration: none;
}

a:hover {
    color: var(--tn-accent-hover);
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--tn-text-primary);
    margin: 0;
    letter-spacing: -0.01em;
}

h1:focus {
    outline: none;
}

/* ═══════════════════════════════════════════════════════════
   Form Validation
   ═══════════════════════════════════════════════════════════ */

.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--tn-success);
}

.invalid {
    outline: 1px solid var(--tn-danger);
}

.validation-message {
    color: var(--tn-danger);
    font-size: var(--tn-font-size-xs);
    margin-top: var(--tn-space-xs);
}

/* ═══════════════════════════════════════════════════════════
   Blazor Error Boundary
   ═══════════════════════════════════════════════════════════ */

.blazor-error-boundary {
    background: var(--tn-danger);
    padding: 1rem;
    color: white;
    border-radius: var(--tn-radius);
}

.blazor-error-boundary::after {
    content: "Ett fel har inträffat.";
}

/* ═══════════════════════════════════════════════════════════
   Utilities
   ═══════════════════════════════════════════════════════════ */

.text-muted {
    color: var(--tn-text-secondary) !important;
}

@keyframes tn-spin {
    to { transform: rotate(360deg); }
}

.tn-spinner {
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid var(--tn-border);
    border-top-color: var(--tn-accent);
    border-radius: 50%;
    animation: tn-spin 0.6s linear infinite;
}

.tn-spinner-sm {
    width: 1rem;
    height: 1rem;
}

/* ═══════════════════════════════════════════════════════════
   Focus & Active States
   ═══════════════════════════════════════════════════════════ */

button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--tn-accent);
}

/* ═══════════════════════════════════════════════════════════
   Loading Container
   ═══════════════════════════════════════════════════════════ */

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--tn-space-md);
    min-height: 300px;
    color: var(--tn-text-secondary);
    font-size: var(--tn-font-size-sm);
}

.loading-container p {
    margin: 0;
}

/* ═══════════════════════════════════════════════════════════
   Empty State
   ═══════════════════════════════════════════════════════════ */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--tn-space-sm);
    padding: var(--tn-space-xl) var(--tn-space-md);
    color: var(--tn-text-muted);
    text-align: center;
}

.empty-state .bi {
    font-size: 2rem;
    opacity: 0.5;
}

.empty-state p {
    margin: 0;
    font-size: var(--tn-font-size-sm);
}

/* ═══════════════════════════════════════════════════════════
   Export Error Banner
   ═══════════════════════════════════════════════════════════ */

.export-error {
    display: flex;
    align-items: center;
    gap: var(--tn-space-sm);
    padding: var(--tn-space-sm) var(--tn-space-md);
    margin-bottom: var(--tn-space-md);
    background: var(--tn-danger-light);
    border: 1px solid rgba(197, 48, 48, 0.15);
    border-radius: var(--tn-radius);
    color: #7F1D1D;
    font-size: var(--tn-font-size-sm);
}

.export-error i {
    color: var(--tn-danger);
    flex-shrink: 0;
}

.export-error span {
    flex: 1;
}

.export-error-close {
    background: none;
    border: none;
    color: #7F1D1D;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    opacity: 0.5;
}

.export-error-close:hover {
    opacity: 1;
}

/* ═══════════════════════════════════════════════════════════
   Table Scroll
   ═══════════════════════════════════════════════════════════ */

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Scrollbar — thin, unobtrusive */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--tn-text-muted);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--tn-text-secondary);
}
