/*
 * rhinomed.css — Rhinomed Design System
 * Shared design tokens, base components, and layout utilities.
 * Import this in every Rhinomed internal app for consistent branding.
 *
 * Usage:
 *   <link rel="stylesheet" href="/shared/rhinomed.css" />
 *   (adjust path if your app lives in a subdirectory)
 */

/* ════════════════════════════════════════
   GOOGLE FONTS
   ════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ════════════════════════════════════════
   FONTS
   ════════════════════════════════════════ */
@font-face {
  font-family: 'Brandon Grotesque';
  src: url('/assets/fonts/BrandonGrotesque-Bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Brandon Grotesque';
  src: url('/assets/fonts/BrandonGrotesque-Medium.otf') format('opentype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Brandon Grotesque';
  src: url('/assets/fonts/BrandonGrotesque-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ════════════════════════════════════════
   DESIGN TOKENS
   ════════════════════════════════════════ */
:root {
  /* Grayscale palette */
  --rh-black:   #0a0a0a;
  --rh-ink:     #1a1a1a;
  --rh-dark:    #2d2d2d;
  --rh-mid:     #555555;
  --rh-muted:   #888888;
  --rh-border:  #d9d9d9;
  --rh-subtle:  #f0f0f0;
  --rh-light:   #f7f7f7;
  --rh-white:   #ffffff;

  /* Semantic colours (used sparingly) */
  --rh-red:     #dc2626;
  --rh-red-bg:  #fef2f2;
  --rh-green:   #16a34a;

  /* Shape */
  --rh-radius:    10px;
  --rh-radius-sm: 6px;
  --rh-radius-lg: 14px;

  /* Elevation */
  --rh-shadow:    0 1px 6px rgba(0,0,0,0.08), 0 2px 16px rgba(0,0,0,0.05);
  --rh-shadow-lg: 0 24px 64px rgba(0,0,0,0.3);
  --rh-shadow-hover: 0 4px 20px rgba(0,0,0,0.13);

  /* Typography */
  --rh-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --rh-font-heading: 'Brandon Grotesque', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Spacing scale */
  --rh-space-xs: 4px;
  --rh-space-sm: 8px;
  --rh-space-md: 16px;
  --rh-space-lg: 24px;
  --rh-space-xl: 36px;
  --rh-space-2xl: 64px;

  /* Layout */
  --rh-max-width: 1280px;
  --rh-header-height: 62px;
}

/* ════════════════════════════════════════
   RESET & BASE
   ════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--rh-font);
  background: var(--rh-light);
  color: var(--rh-ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--rh-font-heading);
  font-weight: 700;
}

/* ════════════════════════════════════════
   HEADER
   ════════════════════════════════════════ */
.rh-header {
  background: var(--rh-black);
  padding: 0 var(--rh-space-xl);
  height: var(--rh-header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid #222;
}

.rh-header-brand {
  display: flex;
  align-items: center;
  gap: var(--rh-space-md);
}

.rh-header-logo {
  height: 42px;
  width: auto;
  display: block;
}

.rh-header-label {
  color: rgba(255,255,255,0.35);
  font-family: var(--rh-font-heading);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding-left: var(--rh-space-md);
  border-left: 1px solid rgba(255,255,255,0.2);
}

.rh-header-right {
  display: flex;
  align-items: center;
  gap: var(--rh-space-lg);
}

/* ════════════════════════════════════════
   LAYOUT
   ════════════════════════════════════════ */
.rh-main {
  max-width: var(--rh-max-width);
  margin: 0 auto;
  padding: var(--rh-space-xl) var(--rh-space-xl) var(--rh-space-2xl);
}

/* ════════════════════════════════════════
   SECTION
   ════════════════════════════════════════ */
.rh-section {
  margin-bottom: 44px;
}

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

.rh-section-title {
  font-family: var(--rh-font-heading);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--rh-muted);
}

.rh-divider {
  border: none;
  border-top: 1px solid var(--rh-border);
  margin: 0 0 14px;
}

/* ════════════════════════════════════════
   CARDS
   ════════════════════════════════════════ */
.rh-card {
  background: var(--rh-white);
  border: 1px solid var(--rh-border);
  border-radius: var(--rh-radius);
  box-shadow: var(--rh-shadow);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.rh-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--rh-shadow-hover);
  border-color: #aaa;
}

.rh-card-dark {
  background: var(--rh-black);
  border-radius: var(--rh-radius);
}

/* ════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════ */
.rh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: var(--rh-radius-sm);
  font-family: var(--rh-font);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s, color 0.15s, border-color 0.15s;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.rh-btn-primary {
  background: var(--rh-black);
  color: var(--rh-white);
  padding: 9px 22px;
}
.rh-btn-primary:hover { background: var(--rh-dark); }

.rh-btn-secondary {
  background: var(--rh-white);
  color: var(--rh-ink);
  border: 1.5px solid var(--rh-border);
  padding: 9px 18px;
}
.rh-btn-secondary:hover { background: var(--rh-subtle); }

.rh-btn-ghost {
  background: transparent;
  color: rgba(255,255,255,0.7);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 6px 14px;
  font-size: 12px;
}
.rh-btn-ghost:hover {
  background: rgba(255,255,255,0.1);
  color: white;
  border-color: rgba(255,255,255,0.4);
}
.rh-btn-ghost.active {
  background: white;
  color: var(--rh-black);
  border-color: white;
}

.rh-btn-add {
  background: var(--rh-black);
  color: white;
  border: none;
  border-radius: var(--rh-radius-sm);
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
}
.rh-btn-add:hover { background: var(--rh-dark); transform: translateY(-1px); }

.rh-btn-icon {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: transform 0.1s;
}
.rh-btn-icon:hover { transform: scale(1.12); }
.rh-btn-icon.edit   { background: white; color: var(--rh-black); }
.rh-btn-icon.delete { background: var(--rh-red-bg); color: var(--rh-red); }

/* ════════════════════════════════════════
   BADGES
   Monochrome status system
   ════════════════════════════════════════ */
.rh-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  white-space: nowrap;
  display: inline-block;
}
.rh-badge-live   { background: var(--rh-black);  color: white; }
.rh-badge-beta   { background: var(--rh-mid);    color: white; }
.rh-badge-dev    { background: var(--rh-subtle); color: var(--rh-dark); border: 1px solid var(--rh-border); }
.rh-badge-idea   { background: transparent; color: var(--rh-muted); border: 1px dashed var(--rh-border); }
.rh-badge-paused { background: var(--rh-subtle); color: var(--rh-muted); border: 1px solid var(--rh-border); text-decoration: line-through; }

/* ════════════════════════════════════════
   MODAL
   ════════════════════════════════════════ */
.rh-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.rh-modal-backdrop.open { display: flex; }

.rh-modal {
  background: white;
  border-radius: var(--rh-radius-lg);
  width: 480px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--rh-shadow-lg);
  animation: rh-slide-up 0.2s ease;
}

@keyframes rh-slide-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.rh-modal-header {
  padding: 22px 22px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--rh-border);
}
.rh-modal-title { font-family: var(--rh-font-heading); font-size: 16px; font-weight: 700; color: var(--rh-black); }

.rh-modal-close {
  background: var(--rh-subtle);
  border: none;
  width: 30px;
  height: 30px;
  border-radius: var(--rh-radius-sm);
  cursor: pointer;
  font-size: 16px;
  color: var(--rh-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.rh-modal-close:hover { background: #e5e5e5; color: var(--rh-ink); }

.rh-modal-body { padding: 18px 22px 22px; }

.rh-modal-footer {
  padding: 16px 22px 22px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  border-top: 1px solid var(--rh-border);
}

/* ════════════════════════════════════════
   FORMS
   ════════════════════════════════════════ */
.rh-form-group { margin-bottom: 15px; }

.rh-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--rh-muted);
  margin-bottom: 5px;
}

.rh-input,
input[type="text"].rh-input,
input[type="url"].rh-input,
select.rh-input,
textarea.rh-input {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--rh-border);
  border-radius: 7px;
  font-size: 13px;
  color: var(--rh-ink);
  background: white;
  transition: border-color 0.2s;
  outline: none;
  font-family: var(--rh-font);
}
.rh-input:focus { border-color: var(--rh-dark); }
textarea.rh-input { resize: vertical; min-height: 80px; }

/* ════════════════════════════════════════
   TOAST
   ════════════════════════════════════════ */
.rh-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--rh-black);
  color: white;
  padding: 11px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.22s, transform 0.22s;
  pointer-events: none;
  z-index: 999;
}
.rh-toast.show { opacity: 1; transform: translateY(0); }

/* ════════════════════════════════════════
   EMPTY STATE
   ════════════════════════════════════════ */
.rh-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
  color: var(--rh-muted);
  font-size: 13px;
  border: 1.5px dashed var(--rh-border);
  border-radius: var(--rh-radius);
}

/* ════════════════════════════════════════
   UTILITY CLASSES
   ════════════════════════════════════════ */
.rh-sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* ════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════ */
@media (max-width: 600px) {
  .rh-main   { padding: 20px 16px 40px; }
  .rh-header { padding: 0 16px; }
}
