/* Fonts */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700&family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&display=swap');

/* Design tokens - Scandinavian palette */
:root {
    /* Colors - warm neutrals with forest green accent */
    --color-background: hsl(40, 20%, 98%);
    --color-foreground: hsl(30, 10%, 15%);
    --color-card: hsl(40, 25%, 99%);
    --color-card-foreground: hsl(30, 10%, 15%);
    
    /* Primary - muted forest green */
    --color-primary: hsl(155, 35%, 38%);
    --color-primary-foreground: hsl(40, 20%, 98%);
    
    /* Secondary - warm sand */
    --color-secondary: hsl(35, 25%, 94%);
    --color-secondary-foreground: hsl(30, 15%, 30%);
    
    /* Muted */
    --color-muted: hsl(35, 15%, 95%);
    --color-muted-foreground: hsl(30, 8%, 45%);
    
    /* Accent - terracotta */
    --color-accent: hsl(18, 55%, 58%);
    --color-accent-foreground: hsl(40, 20%, 98%);
    
    /* Destructive */
    --color-destructive: hsl(0, 65%, 50%);
    --color-destructive-foreground: hsl(40, 20%, 98%);
    
    /* Success */
    --color-success: hsl(155, 45%, 42%);
    --color-success-foreground: hsl(40, 20%, 98%);
    
    /* Border & input */
    --color-border: hsl(35, 15%, 90%);
    --color-input: hsl(35, 15%, 90%);
    --color-ring: hsl(155, 35%, 38%);
    
    /* Shadows */
    --shadow-card: 0 1px 3px hsla(30, 10%, 20%, 0.04), 0 4px 12px hsla(30, 10%, 20%, 0.06);
    --shadow-card-hover: 0 4px 8px hsla(30, 10%, 20%, 0.06), 0 12px 32px hsla(30, 10%, 20%, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    /* Radius */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.25rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;
    
    /* Typography */
    --font-sans: 'DM Sans', system-ui, sans-serif;
    --font-serif: 'Fraunces', Georgia, serif;
    
    /* Container */
    --container-max: 1280px;
    --container-padding: 1.5rem;
}

/* Base styles */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--color-foreground);
    background-color: var(--color-background);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Container utility */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--container-padding);
    padding-right: var(--container-padding);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-serif);
    font-weight: 600;
    line-height: 1.2;
    margin: 0;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

@media (min-width: 768px) {
    h1 { font-size: 3rem; }
    h2 { font-size: 2.25rem; }
}

p {
    margin: 0 0 1rem;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--color-foreground);
}

/* Button base styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1;
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--color-primary);
    color: var(--color-primary-foreground);
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

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

.btn-secondary:hover {
    background-color: var(--color-border);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--color-border);
    color: var(--color-foreground);
}

.btn-outline:hover {
    background-color: var(--color-secondary);
}

/* Card styles */
.card {
    background-color: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    transition: all 0.3s;
}

.card:hover {
    box-shadow: var(--shadow-card-hover);
    border-color: var(--color-border);
}

/* Section utility */
.section {
    padding: 2rem 0;
}

@media (min-width: 768px) {
    .section {
        padding: 3rem 0;
    }
}

.section-title {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-foreground);
}

@media (min-width: 768px) {
    .section-title {
        font-size: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .section-title {
        font-size: 1.875rem;
    }
}

/* Grid utilities */
.grid {
    display: grid;
    gap: 1.5rem;
}

@media (min-width: 640px) {
    .grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
    .grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
    .grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
}

/* Flex utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

/* Spacing utilities */
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }

/* Text utilities */
.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-muted { color: var(--color-muted-foreground); }
.text-primary { color: var(--color-primary); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }

/* Validation styles */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--color-success);
}

.invalid {
    outline: 1px solid var(--color-destructive);
}

.validation-message {
    color: var(--color-destructive);
    font-size: 0.875rem;
}

/* Blazor error boundary */
.blazor-error-boundary {
    background: var(--color-destructive);
    padding: 1rem 1.5rem;
    color: white;
    border-radius: var(--radius-md);
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    background: hsl(45, 100%, 90%);
    border-top: 1px solid hsl(45, 80%, 70%);
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
}

/* Focus styles */
:focus-visible {
    outline: 2px solid var(--color-ring);
    outline-offset: 2px;
}

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

.animate-in {
    animation: fadeIn 0.5s ease-out forwards;
}

/* Icon sizing utility */
.icon { width: 1.25rem; height: 1.25rem; }
.icon-sm { width: 1rem; height: 1rem; }
.icon-lg { width: 1.5rem; height: 1.5rem; }