/* ======================================================
   Gatherly – App-Level Styles
   ====================================================== */

/* Reset & base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--foreground, hsl(224 71% 4%));
    background: var(--background, hsl(0 0% 100%));
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    line-height: 1.25;
    font-weight: 600;
    color: var(--foreground);
}

h1 { font-size: 1.875rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

a { color: var(--primary, hsl(221 83% 53%)); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Focus ring */
:focus-visible {
    outline: 2px solid var(--ring, hsl(221 83% 53%));
    outline-offset: 2px;
}

/* Blazor error boundary */
.blazor-error-boundary {
    background: hsl(0 84% 60%);
    padding: 1rem 1.5rem;
    color: white;
    border-radius: var(--radius, 0.5rem);
    margin: 1rem;
}
.blazor-error-boundary::after {
    content: "An error has occurred.";
}

/* Validation */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid hsl(142 76% 36%);
}
.invalid {
    outline: 1px solid hsl(0 84% 60%);
}
.validation-message {
    color: hsl(0 84% 60%);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

/* Layout: Sidebar + Main */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: 260px;
    background: var(--card, hsl(0 0% 100%));
    border-right: 1px solid var(--border, hsl(220 13% 91%));
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 40;
    transition: transform 0.2s ease;
}

.app-sidebar .sidebar-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.app-sidebar .sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
}

.app-sidebar nav {
    flex: 1;
    padding: 1rem 0.75rem;
    overflow-y: auto;
}

.app-sidebar .nav-section {
    margin-bottom: 1.5rem;
}

.app-sidebar .nav-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted-foreground, hsl(220 9% 46%));
    padding: 0 0.75rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.app-sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius, 0.5rem);
    color: var(--muted-foreground);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.app-sidebar .nav-link:hover {
    background: var(--accent, hsl(220 14% 96%));
    color: var(--foreground);
    text-decoration: none;
}

.app-sidebar .nav-link.active {
    background: var(--primary, hsl(221 83% 53%));
    color: white;
}

.app-main {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-topbar {
    height: 56px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    background: var(--card);
    position: sticky;
    top: 0;
    z-index: 30;
}

.app-content {
    flex: 1;
    padding: 1.5rem;
}

/* Public layout */
.public-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.public-layout .public-header {
    height: 56px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    background: var(--card);
}

.public-layout .public-content {
    flex: 1;
}

.public-layout .public-footer {
    padding: 2rem 1.5rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--muted-foreground);
    border-top: 1px solid var(--border);
}

/* Auth layout */
.auth-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--muted, hsl(220 14% 96%));
}

/* Gate layout - full width, minimal chrome */
.gate-layout {
    min-height: 100vh;
    background: var(--background);
}

/* Responsive: hide sidebar on small screens */
@media (max-width: 768px) {
    .app-sidebar {
        transform: translateX(-100%);
    }
    .app-sidebar.open {
        transform: translateX(0);
    }
    .app-main {
        margin-left: 0;
    }
}

/* Utility classes */
.text-muted { color: var(--muted-foreground); }
.text-center { text-align: center; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mt-4 { margin-top: 1rem; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }

/* Auth card */
.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
}

.auth-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.auth-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

/* Blazor error UI */
#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}