/* Modern Design System */
:root {
    --color-primary: #2563eb;
    --color-primary-dark: #1e40af;
    --color-secondary: #64748b;
    --color-text: #0f172a;
    --color-text-light: #475569;
    --color-text-muted: #94a3b8;
    --color-background: #ffffff;
    --color-surface: #f8fafc;
    --color-border: #e2e8f0;
    --color-border-light: #f1f5f9;
    --color-success: #059669;
    --color-error: #dc2626;
    --color-warning: #d97706;

    --border-radius: 8px;
    --border-radius-lg: 12px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-family-mono: 'SF Mono', Monaco, Inconsolata, 'Roboto Mono', Consolas, monospace;
}

/* Reset and Base Styles */
* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    font-size: 16px;
    line-height: 1.5;
    color: var(--color-text);
    background-color: var(--color-background);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Modern Navigation */
.modern-navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--color-background);
    border-bottom: 1px solid var(--color-border-light);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.navbar-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 80px;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--color-text);
}

.brand-icon {
    font-size: 1.25rem;
}

.brand-logo {
    height: 4rem;
    width: auto;
}

.brand-text {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text);
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-item {
    text-decoration: none;
    color: var(--color-text-light);
    font-weight: 500;
    padding: 0.5rem 0;
    position: relative;
    transition: color 0.2s ease;
}

.nav-item:hover {
    color: var(--color-primary);
}

.nav-item.active {
    color: var(--color-primary);
}

.nav-item.active::after {
    content: '';
    position: absolute;
    bottom: -17px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--color-primary);
    border-radius: 1px;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Modern Buttons */
.btn-modern {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    font-size: 0.875rem;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    background: none;
    font-family: inherit;
}

.btn-modern:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

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

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

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text-light);
    border-color: var(--color-border);
}

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

/* Disabled button styles */
.btn-modern:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    background: var(--color-surface);
    color: var(--color-text-muted);
    border-color: var(--color-border);
}

.btn-primary:disabled {
    background: var(--color-surface);
    color: var(--color-text-muted);
    border-color: var(--color-border);
    opacity: 0.5;
}

.btn-secondary:disabled {
    background: var(--color-surface);
    color: var(--color-text-muted);
    border-color: var(--color-border);
    opacity: 0.5;
}

/* Layout */
.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.modern-page {
    flex: 1;
    background: var(--color-background);
}

.modern-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.modern-content {
    width: 100%;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin: 0 0 1rem 0;
    font-weight: 600;
    line-height: 1.25;
    color: var(--color-text);
}

h1 {
    font-size: 2.25rem;
    font-weight: 700;
}

h2 {
    font-size: 1.875rem;
}

h3 {
    font-size: 1.5rem;
}

h4 {
    font-size: 1.25rem;
}

p {
    margin: 0 0 1rem 0;
    color: var(--color-text-light);
}

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

a:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

/* Form Elements */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--color-text);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: var(--color-background);
    color: var(--color-text);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

.form-control.is-invalid {
    border-color: var(--color-error);
    box-shadow: 0 0 0 3px rgb(220 38 38 / 0.1);
}

/* Cards and Surfaces */
.card {
    background: var(--color-background);
    border: 1px solid var(--color-border-light);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    padding: 1.5rem 1.5rem 0 1.5rem;
    border-bottom: 1px solid var(--color-border-light);
    background: var(--color-surface);
}

.card-body {
    padding: 1.5rem;
}

/* Utilities */
.text-center {
    text-align: center;
}

.text-muted {
    color: var(--color-text-muted);
}

.mb-3 {
    margin-bottom: 1rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.mt-3 {
    margin-top: 1rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .navbar-container {
        padding: 0 1rem;
    }

    .navbar-menu {
        display: none;
    }

    .modern-main {
        padding: 1rem;
    }

    h1 {
        font-size: 1.875rem;
    }

    h2 {
        font-size: 1.5rem;
    }
}

/* Error States */
.validation-message {
    color: var(--color-error);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.blazor-error-boundary {
    background: var(--color-error);
    color: white;
    padding: 1rem;
    border-radius: var(--border-radius);
    margin: 1rem 0;
}

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

#blazor-error-ui {
    background: var(--color-error);
    color: white;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    z-index: 2000;
    display: none;
}

#blazor-error-ui .reload,
#blazor-error-ui .dismiss {
    color: white;
    text-decoration: underline;
    margin-left: 1rem;
}

/* Loading States */
.loading {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--color-border);
    border-top: 2px solid var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}