:root {
    --bg: #ffffff;
    --panel: #ffffff;
    --ink: #111827;
    --muted: #6b7280;
    --brand: #1f6feb;
    --bd: #e5e7eb;
    --chip: #f3f4f6;
    --chip-bd: #e5e7eb;
    --ok: #065f46;
    --warn: #92400e;
    --err: #991b1b;
    --focus: rgba(31, 111, 235, 0.45);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.5;
}

body.theme-light {
    background: var(--bg);
    color: var(--ink);
}

a {
    color: var(--brand);
    text-decoration: none;
}

a:hover,
a:focus {
    text-decoration: underline;
}

.card {
    background: var(--panel);
    border: 1px solid var(--bd);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.08);
}

input,
textarea,
select,
button {
    font: inherit;
}

/* Class-based form styling (opt-in, does not affect bare elements) */
.input,
.select {
    border: 1px solid var(--bd);
    border-radius: 10px;
    background: #fff;
    color: inherit;
    padding: 0.75rem 0.9rem;
    min-height: 44px;
    width: 100%;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus,
button:focus {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

textarea {
    resize: vertical;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border: 1px solid var(--bd);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    font-weight: 600;
    cursor: pointer;
    min-height: 44px;
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
    background: var(--chip);
}

.btn-primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.btn-primary:hover {
    box-shadow: 0 0 0 4px rgba(31, 111, 235, 0.15);
}

.btn[disabled],
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

/* Semantic Button Variants */
.btn-success {
    background: #10b981;
    border-color: #10b981;
    color: #ffffff;
}

.btn-success:hover {
    background: #059669;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    transform: translateY(-2px);
}

.btn-danger {
    background: #ef4444;
    border-color: #ef4444;
    color: #ffffff;
}

.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    transform: translateY(-2px);
}

.btn-warning {
    background: #f59e0b;
    border-color: #f59e0b;
    color: #ffffff;
}

.btn-warning:hover {
    background: #d97706;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    transform: translateY(-2px);
}

.btn-info {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #ffffff;
}

.btn-info:hover {
    background: #2563eb;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    transform: translateY(-2px);
}

.btn-secondary {
    background: #6b7280;
    border-color: #6b7280;
    color: #ffffff;
}

.btn-secondary:hover {
    background: #4b5563;
}

/* Button Size Variants */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    min-height: 36px;
}

.btn-lg {
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    min-height: 52px;
}

/* Full Width Variant */
.btn-block {
    width: 100%;
}

/* Override disabled state for variant buttons */
.btn-success:disabled,
.btn-danger:disabled,
.btn-warning:disabled,
.btn-info:disabled,
.btn-secondary:disabled {
    background: #9ca3af;
    border-color: #9ca3af;
    transform: none;
    cursor: not-allowed;
    opacity: 0.6;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: var(--chip);
    border: 1px solid var(--chip-bd);
    font-size: 0.85rem;
    color: var(--ink);
    line-height: 1;
}

.badge-success {
    color: var(--ok);
    background: rgba(6, 95, 70, 0.12);
    border-color: rgba(6, 95, 70, 0.12);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

@media (max-width: 768px) {
    .card {
        padding: 1.125rem;
    }
}

img.lazy-image {
    background: linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 50%, #f1f5f9 100%);
    background-size: 200% 100%;
    animation: img-shimmer 1.2s ease-in-out infinite;
    filter: blur(6px);
    transition: filter 0.25s ease, background 0.25s ease;
}

img.lazy-image.is-loaded {
    animation: none;
    filter: none;
    background: transparent;
}

@keyframes img-shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}
