/*
 * HamCation Base CSS
 * Shared design tokens and component styles used across all HamCation apps.
 * Import BEFORE app-specific styles so apps can override.
 *
 * Canonical source: _shared/shell/hamcation-base.css
 * Copy to: <project>/pages/assets/hamcation-base.css
 */

/* --- Design Tokens --- */
:root {
  --hc-bg: #f8fafc;
  --hc-card: #ffffff;
  --hc-border: #e2e8f0;
  --hc-text: #1e293b;
  --hc-muted: #64748b;
  --hc-primary: #2563eb;
  --hc-primary-hover: #1d4ed8;
  --hc-success: #16a34a;
  --hc-warning: #f59e0b;
  --hc-danger: #dc2626;
}

/* --- Reset --- */
* {
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--hc-bg);
  color: var(--hc-text);
  margin: 0;
  padding: 0;
  line-height: 1.5;
}

/* --- Accessibility --- */
.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  left: 16px;
  top: 16px;
  z-index: 1000;
  background: var(--hc-card);
  padding: 8px 16px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

:focus-visible {
  outline: 2px solid var(--hc-primary);
  outline-offset: 2px;
}

/* --- Buttons --- */
button, .btn {
  appearance: none;
  border: 1px solid var(--hc-border);
  background: var(--hc-card);
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
  transition: background-color 100ms ease;
}

button:hover, .btn:hover {
  background: var(--hc-bg);
}

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

button.primary, .btn.primary {
  background: var(--hc-primary);
  border-color: var(--hc-primary);
  color: white;
}

button.primary:hover, .btn.primary:hover {
  background: var(--hc-primary-hover);
}

button.danger, .btn.danger {
  background: var(--hc-danger);
  border-color: var(--hc-danger);
  color: white;
}

button.danger:hover, .btn.danger:hover {
  background: #b91c1c;
}

/* --- Cards --- */
.card {
  background: var(--hc-card);
  border: 1px solid var(--hc-border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

/* --- Forms --- */
input, select, textarea {
  padding: 8px 12px;
  border: 1px solid var(--hc-border);
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--hc-primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

/* --- Tables --- */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th, td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--hc-border);
}

th {
  background: var(--hc-bg);
  font-weight: 600;
  color: var(--hc-muted);
}

tr:hover {
  background: var(--hc-bg);
}

/* --- Pills --- */
.pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  background: var(--hc-bg);
  text-decoration: none;
  color: inherit;
}

.pill:hover {
  background: var(--hc-border);
}

/* --- Layout Utilities --- */
.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.muted {
  color: var(--hc-muted);
}

/* --- Status Colors --- */
.status-queued { color: var(--hc-warning); }
.status-leased { color: var(--hc-primary); }
.status-printed { color: var(--hc-success); }
.status-failed { color: var(--hc-danger); }
.status-canceled { color: var(--hc-muted); }

/* --- Modal --- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 10px;
  padding: 1.5rem;
  max-width: 420px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 1rem;
}

.modal-btn {
  padding: 8px 20px;
  border-radius: 6px;
  border: 1px solid var(--hc-border);
  cursor: pointer;
  font-size: 0.9rem;
}

.modal-btn-cancel {
  background: var(--hc-card);
}

.modal-btn-confirm {
  background: var(--hc-primary);
  border-color: var(--hc-primary);
  color: white;
}

.modal-btn-danger {
  background: var(--hc-danger);
  border-color: var(--hc-danger);
  color: white;
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  color: var(--hc-muted);
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 32px;
  height: 32px;
}

.modal-close:hover {
  color: var(--hc-text);
}

/* --- Responsive --- */
@media (max-width: 600px) {
  .card {
    padding: 12px;
  }
}
