/* ============================================================
   components.css — Buttons, cards, badges, forms, stats, tags
   ============================================================ */

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    line-height: 1.4;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}
.btn-primary:hover:not(:disabled) {
    background: var(--accent-primary-hover);
    border-color: var(--accent-primary-hover);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-color: var(--border-color);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.btn-danger {
    background: var(--accent-danger-bg);
    color: var(--accent-danger);
    border-color: transparent;
}
.btn-danger:hover:not(:disabled) {
    background: var(--accent-danger);
    color: white;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}
.btn-ghost:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-sm {
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
}

.btn-lg {
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-base);
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: var(--radius-md);
}

.btn-icon.btn-sm {
    width: 26px;
    height: 26px;
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

.card-title {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ── Status Badge ────────────────────────────────────────── */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    white-space: nowrap;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-badge.not_started     { background: var(--status-not-started-bg); color: var(--status-not-started); }
.status-badge.not_started::before { background: var(--status-not-started); }
.status-badge.in_progress     { background: var(--status-in-progress-bg); color: var(--status-in-progress); }
.status-badge.in_progress::before { background: var(--status-in-progress); }
.status-badge.in_review       { background: var(--status-in-review-bg); color: var(--status-in-review); }
.status-badge.in_review::before { background: var(--status-in-review); }
.status-badge.complete        { background: var(--status-complete-bg); color: var(--status-complete); }
.status-badge.complete::before { background: var(--status-complete); }
.status-badge.blocked         { background: var(--status-blocked-bg); color: var(--status-blocked); }
.status-badge.blocked::before { background: var(--status-blocked); }
.status-badge.on_hold         { background: var(--status-on-hold-bg); color: var(--status-on-hold); }
.status-badge.on_hold::before { background: var(--status-on-hold); }

/* ── Status Dot (smaller) ────────────────────────────────── */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.status-dot.not_started  { background: var(--status-not-started); }
.status-dot.in_progress  { background: var(--status-in-progress); }
.status-dot.in_review    { background: var(--status-in-review); }
.status-dot.complete     { background: var(--status-complete); }
.status-dot.blocked      { background: var(--status-blocked); }
.status-dot.on_hold      { background: var(--status-on-hold); }

/* ── Priority Badge ──────────────────────────────────────── */
.priority-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
}
.priority-badge.low      { color: var(--priority-low); }
.priority-badge.medium   { color: var(--priority-medium); }
.priority-badge.high     { color: var(--priority-high); }
.priority-badge.critical { color: var(--priority-critical); }

/* ── Progress Bar ────────────────────────────────────────── */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 0;
}

.progress-bar-fill.green  { background: var(--accent-success); }
.progress-bar-fill.blue   { background: var(--accent-info); }
.progress-bar-fill.amber  { background: var(--accent-warning); }
.progress-bar-fill.red    { background: var(--accent-danger); }

.progress-bar-lg {
    height: 8px;
}

.progress-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.progress-label {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    min-width: 32px;
    text-align: right;
    font-weight: var(--font-medium);
}

/* ── Empty State ─────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-8);
    color: var(--text-tertiary);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

.empty-state-text {
    font-size: var(--text-base);
    margin-bottom: var(--space-4);
}

/* ── Form Groups ─────────────────────────────────────────── */
.form-group {
    margin-bottom: var(--space-4);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.form-row {
    display: flex;
    gap: var(--space-4);
}

.form-row > * {
    flex: 1;
}

/* ── Checkbox ────────────────────────────────────────────── */
.checkbox-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) 0;
}

.checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-hover);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition-fast);
    background: transparent;
}

.checkbox:hover {
    border-color: var(--accent-primary);
}

.checkbox.checked {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.checkbox.checked::after {
    content: '\2713';
    color: white;
    font-size: 11px;
    font-weight: bold;
}

.checkbox-label {
    font-size: var(--text-sm);
    color: var(--text-primary);
    cursor: pointer;
}

.checkbox-label.completed {
    text-decoration: line-through;
    color: var(--text-tertiary);
}

/* ── Divider ─────────────────────────────────────────────── */
.divider {
    height: 1px;
    background: var(--border-color);
    margin: var(--space-4) 0;
}

/* ── Stat Card Grid ──────────────────────────────────────── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
}

@media (max-width: 700px) {
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    transition: all var(--transition-fast);
    cursor: default;
}

.stat-card:hover {
    border-color: var(--border-hover);
}

.stat-card-label {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: var(--font-semibold);
    margin-bottom: var(--space-2);
}

.stat-card-value {
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    line-height: 1.1;
}

.stat-card-accent {
    border-left: 3px solid var(--accent-primary);
}
.stat-card-accent.success { border-left-color: var(--accent-success); }
.stat-card-accent.warning { border-left-color: var(--accent-warning); }
.stat-card-accent.danger  { border-left-color: var(--accent-danger); }
.stat-card-accent.info    { border-left-color: var(--accent-info); }

/* ── Tag / Chip ──────────────────────────────────────────── */
.tag {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 2px 8px;
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

/* ── Workspace Badge ─────────────────────────────────────── */
.ws-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 7px;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.02em;
    border-radius: var(--radius-full);
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1.6;
}
.ws-badge.ws-badge-active {
    background: rgba(34, 197, 94, 0.12);
    color: #86efac;
}
.ws-badge.ws-badge-readonly {
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
}

/* Workspace group header used in systems/projects views */
.ws-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0 4px 0;
    margin-top: 12px;
    border-top: 1px solid var(--border-subtle);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.ws-group-header:first-child {
    margin-top: 0;
    border-top: none;
}
.ws-group-header .ws-badge {
    text-transform: none;
    letter-spacing: normal;
}
