/* ========================================================
   Shared styles - reset, buttons, inputs, scrollbar, utils
   ======================================================== */

/* --- Reset --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: var(--font-family);
    font-size: 16px;
    color: var(--text-primary);
    background: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: var(--font-size-sm);
    border-radius: var(--radius-sm);
    transition: background 250ms ease, color 250ms ease, opacity 250ms ease;
    line-height: 1;
}

.btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.btn--icon {
    width: 32px;
    height: 32px;
    background: transparent;
    color: var(--text-secondary);
    font-size: var(--font-size-lg);
}

.btn--icon:hover {
    color: var(--text-primary);
    background: var(--bg-surface-hover);
}

.btn--small {
    padding: 4px 12px;
    background: var(--bg-surface);
    color: var(--text-secondary);
}

.btn--small:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.btn--add {
    width: 32px;
    height: 32px;
    background: var(--accent);
    color: var(--text-inverse);
    font-size: var(--font-size-xl);
    font-weight: 600;
    border-radius: 50%;
    margin-left: auto;
    padding-bottom: 2px;
}

.btn--add:hover {
    background: var(--accent-hover);
}

.btn--primary {
    padding: 8px 20px;
    background: var(--accent);
    color: #fff;
    font-weight: 500;
}

.btn--primary:hover {
    background: var(--accent-hover);
}

.btn--secondary {
    padding: 8px 20px;
    background: var(--bg-surface);
    color: var(--text-secondary);
}

.btn--secondary:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.btn--danger {
    padding: 8px 20px;
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
}

.btn--danger:hover {
    background: var(--danger);
    color: #fff;
}

/* --- Inputs --- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    font-weight: 500;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--font-size-base);
    transition: border-color var(--transition-fast);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--accent);
}

.form-textarea {
    resize: vertical;
    min-height: 72px;
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted);
}

/* --- Native form control icons (date, time, number spinners) --- */
.form-input::-webkit-calendar-picker-indicator {
    filter: invert(0.7);
    cursor: pointer;
}

.form-input::-webkit-inner-spin-button,
.form-input::-webkit-outer-spin-button {
    filter: invert(0.7);
}

/* Tell the browser to render inputs in dark color-scheme */
.form-input,
.form-textarea,
.form-select {
    color-scheme: dark;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* --- Utility --- */
.hidden {
    display: none !important;
}

/* --- Icons (inline SVG standard) --- */
.icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    text-align: center;
    font-style: italic;
}
