/* ═══════════════════════════════════════════
   SPC Email Signature Generator
   Stylesheet — matching www.spc.int
   ═══════════════════════════════════════════ */

/* ─── Design Tokens — Light mode (default) ─── */
:root {
  --navy:        #1A3668;
  --navy-dark:   #122650;
  --teal:        #00BFCB;
  --teal-dark:   #009EAA;
  --white:       #FFFFFF;
  --grey-100:    #F5F6F8;
  --grey-200:    #EAECF0;
  --grey-300:    #D0D5DD;
  --grey-500:    #667085;
  --grey-700:    #344054;
  --grey-900:    #101828;
  --radius:      6px;
  --radius-lg:   10px;
  --shadow-sm:   0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.06);

  /* Semantic tokens — used throughout the UI */
  --bg-page:        #F5F6F8;
  --bg-card:        #FFFFFF;
  --bg-input:       #F5F6F8;
  --bg-input-focus: #FFFFFF;
  --border:         #EAECF0;
  --border-input:   #D0D5DD;
  --text-primary:   #101828;
  --text-label:     #667085;
  --text-meta:      #667085;
}

/* ─── Design Tokens — Dark mode ─── */
body.dark {
  --bg-page:        #0F1117;
  --bg-card:        #1A1D27;
  --bg-input:       #22263A;
  --bg-input-focus: #2A2F45;
  --border:         #2E3348;
  --border-input:   #3A4060;
  --text-primary:   #E8EAF0;
  --text-label:     #8B93B0;
  --text-meta:      #8B93B0;
  --grey-100:       #0F1117;
  --grey-200:       #1A1D27;
  --grey-300:       #2E3348;
  --grey-500:       #8B93B0;
  --grey-700:       #C4C9DC;
  --grey-900:       #E8EAF0;
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ─── Base ─── */
body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.55;
  transition: background .2s, color .2s;
}

/* ─── Site Header ─── */
.site-header {
  background-color: var(--grey-200);
  background-image: url('../images/headerbg.gif');
  background-repeat: no-repeat;
  background-position: right center;
  background-size: cover;
  border-bottom: 4px solid var(--teal);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 80px;
  position: relative;
}
.site-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}
.header-logo-placeholder {
  height: 58px;
  width: 143px;
  background-image: url('../images/SPC-CPS-logo_27_stars-2023.svg');
  background-repeat: no-repeat;
  background-size: contain;
  background-position: left center;
}
.header-badge {
  font-size: 0.78rem;
  background: rgba(0,191,203,0.15);
  color: #007A82;
  padding: 8px 20px;
  border-radius: 6px;
  letter-spacing: 0.06em;
  font-weight: 700;
  text-transform: uppercase;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

/* ─── Header controls (theme toggle) ─── */
.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ─── Theme toggle button ─── */
.theme-btn {
  width: 34px;
  height: 34px;
  border-radius: 4px;
  border: 1px solid var(--grey-300);
  background: transparent;
  color: var(--grey-500);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: background .15s, border-color .15s;
  padding: 0;
}
.theme-btn:hover {
  background: var(--grey-200);
  border-color: var(--grey-400, var(--grey-300));
}

body.dark .header-badge {
  background: rgba(0,191,203,0.15);
  color: var(--teal);
}

body.dark .card {
  background: var(--bg-card);
  border-color: var(--border);
}
body.dark .card-header {
  background: var(--bg-card);
  color: var(--teal);
}
body.dark input.field,
body.dark select {
  background: var(--bg-input);
  border-color: var(--border-input);
  color: var(--text-primary);
}
body.dark input.field:focus,
body.dark select:focus {
  background: var(--bg-input-focus);
}
body.dark input.field:disabled {
  background: var(--border);
  color: var(--text-label);
  border-color: transparent;
}
body.dark label { color: var(--text-label); }
body.dark hr.form-divider { border-color: var(--border); }
body.dark .btn-preview,
body.dark .btn-copy {
  background: var(--bg-input);
  color: var(--text-primary);
  border-color: var(--border-input);
}
body.dark .btn-preview:hover,
body.dark .btn-copy:hover { background: var(--bg-input-focus); }
body.dark .instr-section h3 { color: var(--teal); }
body.dark .instr-section ol { color: var(--text-label); }
body.dark .instr-section kbd {
  background: var(--bg-input);
  border-color: var(--border-input);
  color: var(--text-primary);
}
body.dark #preview-area {
  background: var(--bg-card);
  border-color: var(--border);
}

/* ─── Page Layout ─── */
.page-wrap {
  max-width: 1320px;
  margin: 0 auto;
  padding: 28px 24px 64px;
  display: grid;
  grid-template-columns: 380px 1fr;
  grid-template-rows: auto 1fr;
  gap: 20px;
  align-items: start;
}

/* ─── Cards ─── */
.card {
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  background: var(--white);
  color: var(--navy);
  padding: 11px 20px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 3px solid var(--teal);
}
.card-header-dot {
  width: 7px; height: 7px;
  background: var(--teal);
  border-radius: 50%;
  flex-shrink: 0;
}
.card-body { padding: 20px; }

/* ─── Form ─── */
.form-panel { grid-column: 1; grid-row: 1 / 3; }
.form-group { margin-bottom: 13px; }

label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--grey-500);
  margin-bottom: 5px;
}

input.field, select {
  width: 100%;
  height: 37px;
  padding: 0 11px;
  background: var(--grey-100);
  border: 1px solid var(--grey-300);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--grey-900);
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input.field:focus, select:focus {
  border-color: var(--teal);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(0,191,203,0.15);
}
input.field:disabled {
  background: var(--grey-200);
  color: var(--grey-300);
  cursor: not-allowed;
  border-color: transparent;
}
select {
  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='%23667085' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

/* ─── Optional field rows (checkbox + input) ─── */
.opt-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.opt-row input[type="checkbox"] {
  width: 17px; height: 17px;
  accent-color: var(--teal);
  cursor: pointer;
  flex-shrink: 0;
}
.opt-row input.field { flex: 1; }

hr.form-divider {
  border: none;
  border-top: 1px solid var(--grey-200);
  margin: 16px 0;
}

/* ─── Buttons ─── */
.btn-group {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.btn {
  flex: 1;
  height: 40px;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: background .15s, transform .1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn:active { transform: scale(0.97); }
.btn-preview { background: #F0F2F7; color: var(--navy); border: 1px solid var(--grey-300); }
.btn-preview:hover { background: var(--grey-200); }
.btn-copy { background: #F0F2F7; color: var(--navy); border: 1px solid var(--grey-300); }
.btn-copy:hover { background: var(--grey-200); }
.btn-copy.copied { background: #E6F4EA; color: #2E7D32; border-color: #A8D5B0; }

/* ─── Instructions Panel ─── */
.instructions-panel { grid-column: 2; grid-row: 1; }
.instr-section + .instr-section { margin-top: 18px; }
.instr-section h3 {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.instr-section h3::before {
  content: '';
  display: inline-block;
  width: 3px; height: 14px;
  background: var(--teal);
  border-radius: 2px;
  flex-shrink: 0;
}
.instr-section ol {
  padding-left: 18px;
  font-size: 0.83rem;
  color: var(--grey-500);
  line-height: 1.8;
}
.instr-section ol ol { margin-top: 4px; }
.instr-section a { color: var(--teal-dark); text-decoration: underline; }
.instr-section kbd {
  font-size: 0.74rem;
  background: var(--grey-100);
  border: 1px solid var(--grey-300);
  border-radius: 3px;
  padding: 1px 5px;
  font-family: monospace;
}

/* ─── Preview Panel ─── */
.preview-panel { grid-column: 2; grid-row: 2; }
.preview-meta {
  margin-left: auto;
  font-size: 0.68rem;
  color: var(--grey-500);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}
#preview-area {
  min-height: 180px;
  border: 2px dashed var(--grey-200);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--white);
  overflow-x: auto;
  transition: border-color .2s;
}
#preview-area.has-content {
  border-style: solid;
  border-color: var(--grey-200);
}
/* ─── Responsive ─── */
@media (max-width: 960px) {
  .page-wrap { grid-template-columns: 1fr; }
  .form-panel     { grid-column: 1; grid-row: 1; }
  .instructions-panel { grid-column: 1; grid-row: 2; }
  .preview-panel  { grid-column: 1; grid-row: 3; }
}
