/* ============================================
   shadcn/ui Design System — Dark Theme
   ============================================ */

:root {
    --background: 0 0% 100%;
    --foreground: 240 10% 3.9%;
    --card: 0 0% 100%;
    --card-foreground: 240 10% 3.9%;
    --primary: 240 5.9% 10%;
    --primary-foreground: 0 0% 98%;
    --secondary: 240 4.8% 95.9%;
    --secondary-foreground: 240 5.9% 10%;
    --muted: 240 4.8% 95.9%;
    --muted-foreground: 240 3.8% 46.1%;
    --accent: 240 4.8% 95.9%;
    --accent-foreground: 240 5.9% 10%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 0 0% 98%;
    --border: 240 5.9% 90%;
    --input: 240 5.9% 90%;
    --ring: 240 5.9% 10%;
    --radius: 0.75rem;
}

.dark {
    --background: 222.2 84% 4.9%;
    --foreground: 210 40% 98%;
    --card: 222.2 84% 4.9%;
    --card-foreground: 210 40% 98%;
    --primary: 217.2 91.2% 59.8%;
    --primary-foreground: 222.2 47.4% 11.2%;
    --secondary: 217.2 32.6% 17.5%;
    --secondary-foreground: 210 40% 98%;
    --muted: 217.2 32.6% 17.5%;
    --muted-foreground: 215 20.2% 65.1%;
    --accent: 217.2 32.6% 17.5%;
    --accent-foreground: 210 40% 98%;
    --destructive: 0 62.8% 30.6%;
    --destructive-foreground: 210 40% 98%;
    --border: 217.2 32.6% 17.5%;
    --input: 217.2 32.6% 17.5%;
    --ring: 224.3 76.3% 48%;
    --radius: 0.75rem;
}

/* ============================================
   Reset & Base
   ============================================ */

*,
*::before,
*::after {
    box-sizing: border-box;
    border-color: hsl(var(--border));
}

body {
    margin: 0;
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ============================================
   Scrollbar
   ============================================ */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: hsl(var(--muted-foreground) / 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--muted-foreground) / 0.4);
}

/* ============================================
   Form Controls
   ============================================ */

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="range"]):not([type="color"]),
textarea,
select {
    display: flex;
    height: 2.5rem;
    width: 100%;
    background-color: hsl(var(--background));
    border: 1px solid hsl(var(--input));
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    font-family: inherit;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: hsl(var(--foreground));
    outline: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

input:focus,
textarea:focus,
select:focus {
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 3px hsl(var(--ring) / 0.15);
}

input::placeholder,
textarea::placeholder {
    color: hsl(var(--muted-foreground) / 0.6);
}

textarea {
    height: auto;
    min-height: 5rem;
    resize: vertical;
}

/* Checkbox */
input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: hsl(var(--primary));
    cursor: pointer;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25rem;
    padding: 0.5rem 1rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: none;
    outline: none;
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
}

.btn:focus-visible {
    outline: 2px solid hsl(var(--ring));
    outline-offset: 2px;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--primary) / 0.85));
    color: hsl(var(--primary-foreground));
    font-weight: 600;
    box-shadow: 0 1px 3px hsl(var(--primary) / 0.3);
}

.btn-primary:hover {
    box-shadow: 0 4px 12px hsl(var(--primary) / 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
}

.btn-secondary:hover {
    background-color: hsl(var(--accent));
}

.btn-destructive {
    background-color: hsl(var(--destructive));
    color: hsl(var(--destructive-foreground));
}

.btn-destructive:hover {
    opacity: 0.9;
}

.btn-outline {
    border: 1px solid hsl(var(--input));
    background-color: transparent;
    color: hsl(var(--foreground));
}

.btn-outline:hover {
    background-color: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

.btn-ghost {
    background-color: transparent;
    color: hsl(var(--foreground));
}

.btn-ghost:hover {
    background-color: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

/* ============================================
   Card
   ============================================ */

.card {
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow:
        0 1px 3px 0 rgb(0 0 0 / 0.1),
        0 1px 2px -1px rgb(0 0 0 / 0.1);
}

/* ============================================
   Auth Card (Login / Register)
   ============================================ */

.auth-card {
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow:
        0 0 0 1px hsl(var(--border)),
        0 4px 6px -1px rgb(0 0 0 / 0.15),
        0 10px 30px -5px rgb(0 0 0 / 0.25);
    backdrop-filter: blur(8px);
}

/* ============================================
   Badge
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    padding: 0.125rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.25rem;
}

.badge-primary {
    background-color: hsl(var(--primary) / 0.15);
    color: hsl(var(--primary));
    border: 1px solid hsl(var(--primary) / 0.2);
}

.badge-destructive {
    background-color: hsl(var(--destructive) / 0.15);
    color: hsl(0 84.2% 60.2%);
}

/* ============================================
   Blazor Error Handling
   ============================================ */

.blazor-error-boundary {
    background: hsl(var(--destructive));
    padding: 1rem;
    color: hsl(var(--destructive-foreground));
    border-radius: var(--radius);
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: hsl(var(--destructive));
    color: hsl(var(--destructive-foreground));
    padding: 0.75rem 1rem;
    text-align: center;
}

/* ============================================
   Validation
   ============================================ */

.valid.modified:not([type=checkbox]) {
    outline: none;
    border-color: hsl(142 76% 36%);
}

.invalid {
    outline: none;
    border-color: hsl(0 84.2% 60.2%) !important;
}

.validation-message {
    color: hsl(0 84.2% 60.2%);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

/* ============================================
   Animations
   ============================================ */

@@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-12px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-in {
    animation: fadeIn 0.4s ease-out;
}

.animate-slide {
    animation: slideInLeft 0.3s ease-out;
}

/* ============================================
   Auth Background Pattern
   ============================================ */

.auth-bg {
    background-color: hsl(var(--background));
    background-image:
        radial-gradient(at 27% 37%, hsl(215 70% 15%) 0px, transparent 50%),
        radial-gradient(at 97% 21%, hsl(220 60% 12%) 0px, transparent 50%),
        radial-gradient(at 52% 99%, hsl(210 50% 10%) 0px, transparent 50%),
        radial-gradient(at 10% 29%, hsl(225 60% 13%) 0px, transparent 50%);
}