/* css/shared_vars.css */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

* {
  -webkit-overflow-scrolling: touch;
}

:root {
  /* Core Brand Colors */
  --color-brand: rgba(42, 50, 189, 1);
  /* FCS Logo Blue */
  --color-brand-light: rgba(42, 50, 189, 0.1);
  /* Light brand tint */
  --color-brand-dk: rgba(30, 36, 140, 1);
  /* Darker shade for headers/hovers */
  --color-accent: #C8762B;
  /* Safety Orange */
  --color-accent-lt: #FDF3E7;
  /* Subtle Orange tint */

  /* Surface & Background (Warm Greys) */
  --color-bg: #F4F3F1;
  /* Main Warm Grey Background */
  --color-surface: #FFFFFF;
  /* White Surfaces */
  --color-surface-2: #EEECEA;
  /* Secondary Grey Background */
  --color-border: #D8D5D0;
  /* Soft Warm Border */
  --color-border-light: #E8E5E0;
  /* Lighter border */

  /* Text Colors */
  --color-text: #1A1916;
  --color-text-mid: #4A4845;
  --color-text-dim: #7A7875;
  --color-text-inverse: #FFFFFF;

  /* Typography */
  --font-sans: 'DM Sans', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'DM Mono', 'Fira Code', 'Courier New', monospace;

  /* Semantic Status / Error Colors */
  --color-error: #c0392b;
  --color-error-lt: #FDECEA;

  /* Spacing & Shape */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --gap-form: 16px;
}

/* ── Unified Module Header & Buttons ── */
.module-header {
  height: 52px;
  min-height: 52px;
  max-height: 52px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 24px;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  z-index: 100;
}

.module-logo {
  font-size: 17px;
  font-weight: 700;
  color: var(--color-brand);
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.module-logo span {
  font-weight: 400;
  color: var(--color-text-dim);
}

.module-nav {
  display: flex;
  gap: 8px;
  flex: 1;
  min-height: 32px;
}

.module-nav-btn {
  padding: 7px 24px;
  background: transparent;
  border: 2px solid var(--color-border);
  border-radius: 6px;
  color: var(--color-text-mid);
  font-family: var(--font-sans);
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  height: 36px;
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  min-width: 125px;
  justify-content: center;
}

.module-nav-btn:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}

.module-nav-btn.active {
  background: var(--color-brand-light);
  color: var(--color-brand);
  font-weight: 600;
  border-color: var(--color-brand);
}

.module-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Standardized Header Buttons */
.btn-action {
  padding: 6px 20px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

.btn-outline {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-mid);
}

.btn-outline:hover:not(:disabled) {
  background: var(--color-surface-2);
  border-color: var(--color-text-dim);
  color: var(--color-text);
}

.btn-danger-outline {
  background: transparent;
  border: 1px solid #c0392b;
  color: #c0392b;
}

.btn-danger-outline:hover:not(:disabled) {
  background: #FDECEA;
}

/* Plain text/labels in headers */
.header-text {
  font-size: 12px;
  color: var(--color-text-mid);
  margin-right: 8px;
}

.header-pill {
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 4px 10px;
  background: var(--color-brand-light);
  color: var(--color-brand);
  border-radius: 99px;
  border: 1px solid var(--color-border-light);
}


/* ════════════════════════════════════════════════════
   GLOBAL COMPONENT LIBRARY — Phase 5.2
   ════════════════════════════════════════════════════ */

/* ── Buttons ── */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 20px;
  background: var(--color-brand);
  border: 1px solid var(--color-brand);
  color: var(--color-text-inverse);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

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

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

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 20px;
  background: transparent;
  border: 1px solid var(--color-brand);
  color: var(--color-brand);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.btn-secondary:hover:not(:disabled) {
  background: var(--color-brand-light);
}

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

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 20px;
  background: var(--color-error);
  border: 1px solid var(--color-error);
  color: var(--color-text-inverse);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.btn-danger:hover:not(:disabled) {
  background: #a93226;
  border-color: #a93226;
}

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


/* ── Forms & Inputs (CSS Grid) ── */

.form-grid-1 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap-form);
}

.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap-form);
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap-form);
}

/* Vertical rhythm between stacked form-grid blocks inside modal bodies.
   Gives the same breathing room as the proposal module's section padding. */
.fcs-modal-bdy .form-grid-1 + .form-grid-1,
.fcs-modal-bdy .form-grid-1 + .form-grid-2,
.fcs-modal-bdy .form-grid-1 + .form-grid-3,
.fcs-modal-bdy .form-grid-2 + .form-grid-1,
.fcs-modal-bdy .form-grid-2 + .form-grid-2,
.fcs-modal-bdy .form-grid-2 + .form-grid-3,
.fcs-modal-bdy .form-grid-3 + .form-grid-1,
.fcs-modal-bdy .form-grid-3 + .form-grid-2,
.fcs-modal-bdy .form-grid-3 + .form-grid-3 {
  margin-top: var(--gap-form);
}

/* Also handle grids nested one level deep inside a stash wrapper div */
.fcs-modal-bdy > * > .form-grid-1 + .form-grid-1,
.fcs-modal-bdy > * > .form-grid-1 + .form-grid-2,
.fcs-modal-bdy > * > .form-grid-1 + .form-grid-3,
.fcs-modal-bdy > * > .form-grid-2 + .form-grid-1,
.fcs-modal-bdy > * > .form-grid-2 + .form-grid-2,
.fcs-modal-bdy > * > .form-grid-2 + .form-grid-3,
.fcs-modal-bdy > * > .form-grid-3 + .form-grid-1,
.fcs-modal-bdy > * > .form-grid-3 + .form-grid-2,
.fcs-modal-bdy > * > .form-grid-3 + .form-grid-3 {
  margin-top: var(--gap-form);
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-dim);
  margin-bottom: 4px;
}

.form-control {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--color-text);
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px var(--color-brand-light);
}

.form-control::placeholder {
  color: var(--color-text-dim);
}

select.form-control {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237A7875' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}


/* ── Modals & Cards ── */

.fcs-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.fcs-modal-box {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

.fcs-modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.fcs-modal-backdrop.open {
  display: flex;
}

.fcs-modal-header {
  background: var(--color-brand);
  padding: 14px 20px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.fcs-modal-header h2,
.fcs-modal-header h3,
.fcs-modal-header .modal-title {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-inverse);
  margin: 0;
}

.fcs-modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}