/* Fifty UI - shadcn-inspired design system */

:root {
    --background: hsl(222.2 84% 4.9%);
    --foreground: hsl(210 40% 98%);
    --card: hsl(222.2 84% 4.9%);
    --card-foreground: hsl(210 40% 98%);
    --muted: hsl(217.2 32.6% 17.5%);
    --muted-foreground: hsl(215 20.2% 65.1%);
    --border: hsl(217.2 32.6% 17.5%);
    --input: hsl(217.2 32.6% 17.5%);
    --ring: hsl(212.7 26.8% 83.9%);
    --primary: hsl(210 40% 98%);
    --primary-foreground: hsl(222.2 47.4% 11.2%);
    --secondary: hsl(217.2 32.6% 17.5%);
    --secondary-foreground: hsl(210 40% 98%);
    --destructive: hsl(0 62.8% 50.6%);
    --destructive-foreground: hsl(210 40% 98%);
    --success: hsl(142.1 76.2% 36.3%);
    --success-foreground: hsl(355.7 100% 97.3%);
    --radius: 0.5rem;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family:
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        "Helvetica Neue",
        Arial,
        sans-serif;
    background: var(--background);
    color: var(--foreground);
    min-height: 100vh;
    padding: 3rem 1rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 28rem;
    margin: 0 auto;
}

h1 {
    font-size: 1.875rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    margin-bottom: 1.5rem;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    margin-bottom: 1rem;
}

/* Forms */
form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

form.inline {
    flex-direction: row;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

form.inline input[type="text"],
form.inline input[type="email"],
form.inline input[type="search"] {
    flex: 1;
}

.field,
.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-field.error input,
.form-field.error textarea,
.form-field.error select {
    border-color: var(--destructive);
}

.form-error {
    color: var(--destructive);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.form-help {
    color: var(--muted-foreground);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.form-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
}

/* Inputs */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
textarea,
select,
.input {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--foreground);
    height: 2.5rem;
    font-family: inherit;
    transition:
        border-color 0.15s,
        box-shadow 0.15s;
}

textarea {
    height: auto;
    min-height: 8rem;
    resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow:
        0 0 0 2px var(--background),
        0 0 0 4px var(--ring);
}

input::placeholder,
textarea::placeholder {
    color: var(--muted-foreground);
}

/* Checkboxes */
input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 1rem;
    height: 1rem;
    border: 1px solid var(--primary);
    border-radius: 0.25rem;
    cursor: pointer;
    position: relative;
    transition:
        background-color 0.15s,
        border-color 0.15s;
}

input[type="checkbox"]:checked {
    background: var(--primary);
    border-color: var(--primary);
}

input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid var(--primary-foreground);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

input[type="checkbox"]:focus-visible {
    outline: none;
    box-shadow:
        0 0 0 2px var(--background),
        0 0 0 4px var(--ring);
}

/* Buttons */
button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: var(--primary-foreground);
    border: none;
    border-radius: var(--radius);
    padding: 0 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    height: 2.5rem;
    cursor: pointer;
    transition: opacity 0.15s;
    text-decoration: none;
}

button:hover,
.btn:hover {
    opacity: 0.9;
}

button:focus-visible,
.btn:focus-visible {
    outline: none;
    box-shadow:
        0 0 0 2px var(--background),
        0 0 0 4px var(--ring);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

button.destructive,
.btn.destructive {
    background: var(--destructive);
    color: var(--destructive-foreground);
}

button.ghost,
.btn.ghost {
    background: transparent;
    color: var(--foreground);
}

button.ghost:hover,
.btn.ghost:hover {
    background: var(--muted);
    opacity: 1;
}

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

/* Cards */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}

.card:hover {
    background: var(--muted);
}

/* Lists */
.list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.list-item {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: background-color 0.15s;
}

.list-item form {
    display: flex;
    align-items: center;
    margin: 0;
    gap: 0;
}

.list-item:hover {
    background: var(--muted);
}

.list-item span {
    flex: 1;
    font-size: 0.875rem;
}

.list-item.completed span {
    text-decoration: line-through;
    color: var(--muted-foreground);
}

/* Messages / Alerts */
.message,
.flash {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
    background: hsl(142.1 76.2% 10%);
    border: 1px solid var(--success);
    color: hsl(142.1 70.6% 65.3%);
}

.message.success {
    background: hsl(142.1 76.2% 10%);
    border: 1px solid var(--success);
    color: hsl(142.1 70.6% 65.3%);
}

.message.error {
    background: hsl(0 62.8% 10%);
    border: 1px solid var(--destructive);
    color: hsl(0 72.2% 70.6%);
}

.message.info {
    background: hsl(217.2 32.6% 10%);
    border: 1px solid var(--ring);
    color: var(--ring);
}

/* Muted text */
.muted {
    color: var(--muted-foreground);
    font-size: 0.75rem;
}

/* Utility: hidden delete buttons that show on hover */
.hover-action {
    opacity: 0;
    transition:
        opacity 0.15s,
        color 0.15s;
}

.list-item:hover .hover-action,
.card:hover .hover-action {
    opacity: 1;
}

.hover-action.destructive:hover {
    color: var(--destructive);
}
