/* AlertBuddy Stitch Stylesheet */
@font-face {
  font-family: "Red Hat Display";
  src: url("/fonts/RedHatDisplay-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Red Hat Display";
  src: url("/fonts/RedHatDisplay-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Red Hat Display";
  src: url("/fonts/RedHatDisplay-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Red Hat Display";
  src: url("/fonts/RedHatDisplay-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Chrome & Navigation */
  --chrome-bg: #575a5e;
  --chrome-active-tab: #6a6e73;
  --chrome-text: #ffffff;
  --chrome-muted: #cbd2d9;

  /* Canvas & Containers */
  --canvas-bg: #e3f0fa;
  --card-bg: #ffffff;
  --card-border: #dbe4ee;
  --card-shadow: 0 2px 6px rgba(28, 38, 50, 0.04);
  --input-bg: #f6f4f2;
  --input-border: #e7e2de;
  --input-placeholder: #8c9099;

  /* Typography Colors */
  --text-main: #212529;
  --text-eyebrow: #5c626c;
  --text-muted: #6e7580;
  --text-dim: #9499a3;

  /* Action & Accent */
  --mauve-accent: #cb8594;
  --mauve-hover: #bd7786;
  --mauve-active: #ad6b79;
  --mauve-shadow: 0 4px 12px rgba(203, 133, 148, 0.35);

  /* Status Colors */
  --status-delivered-bg: #22c55e;
  --status-delivered-text: #ffffff;
  --status-pending-bg: #f5b700;
  --status-pending-text: #ffffff;
  --status-emergency: #e04b5f;
  --status-emergency-shadow: 0 4px 14px rgba(224, 75, 95, 0.4);

  /* Toggle */
  --toggle-off: #d4d8de;
  --toggle-on: #e04b5f;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  background-color: #121316;
  font-family: "Red Hat Display", -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* App Viewport Container */
.app-viewport {
  width: 100%;
  max-width: 440px;
  min-height: 100vh;
  background-color: var(--canvas-bg);
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
  position: relative;
  overflow-x: hidden;
}

@media (min-width: 480px) {
  body {
    padding: 24px 0;
  }
  .app-viewport {
    min-height: calc(100vh - 48px);
    border-radius: 24px;
    overflow: hidden;
  }
}

/* Header Chrome */
.app-header {
  background-color: var(--chrome-bg);
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: sticky;
  top: 0;
  z-index: 40;
  padding: 0 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.logo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.logo-link:hover {
  transform: scale(1.05);
}

.header-logo-img {
  width: 38px;
  height: 38px;
  display: block;
}

/* Main Content Area */
.app-content {
  flex: 1;
  padding: 16px 14px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Card System */
.stitch-card {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--card-shadow);
  position: relative;
}

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.card-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-eyebrow);
}

.card-timestamp {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Latest Response Card */
.latest-response-body {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: 8px;
  line-height: 1.35;
  text-align: center;
}

.latest-response-val-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}

.latest-response-val-text {
  font-size: 28px;
  font-weight: 700;
  color: #22c55e;
  line-height: 1;
  text-align: center;
}

/* Emergency Toggle in Card Header */
.emergency-toggle-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.emergency-toggle-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  transition: color 0.15s ease;
}

.emergency-toggle-label.active {
  color: var(--status-emergency);
}

.toggle-pill {
  width: 38px;
  height: 22px;
  background-color: var(--toggle-off);
  border-radius: 999px;
  position: relative;
  transition: background-color 0.2s ease;
  border: none;
  cursor: pointer;
}

.toggle-pill.active {
  background-color: var(--toggle-on);
}

.toggle-knob {
  width: 18px;
  height: 18px;
  background-color: #ffffff;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-pill.active .toggle-knob {
  transform: translateX(16px);
}

/* Textarea Input */
.stitch-textarea {
  width: 100%;
  min-height: 94px;
  background-color: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 15px;
  color: var(--text-main);
  resize: vertical;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.stitch-textarea::placeholder {
  color: var(--input-placeholder);
}

.stitch-textarea:focus {
  border-color: #cb8594;
  box-shadow: 0 0 0 3px rgba(203, 133, 148, 0.15);
}

.stitch-textarea.emergency-mode:focus {
  border-color: #e04b5f;
  box-shadow: 0 0 0 3px rgba(224, 75, 95, 0.2);
}

/* Quick Presets Row */
.presets-scroll-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 0 4px;
  scrollbar-width: none;
}
.presets-scroll-row::-webkit-scrollbar {
  display: none;
}

.preset-chip-btn {
  background-color: #f0edf0;
  border: 1px solid #e1dcde;
  color: #525866;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease;
}

.preset-chip-btn:hover {
  background-color: #e6dfec;
}

/* Response Type Section */
.response-type-section {
  margin-top: 12px;
}

.response-type-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-eyebrow);
  margin-bottom: 8px;
  display: block;
}

.response-type-pills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.response-pill-btn {
  background-color: #ffffff;
  border: 1px solid #dcdfe4;
  color: #374151;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 0;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.response-pill-btn:hover {
  border-color: #b8bdc5;
}

.response-pill-btn.selected {
  background-color: var(--mauve-accent);
  color: #ffffff;
  border-color: var(--mauve-accent);
  font-weight: 700;
}

/* Custom Choices Inline Inputs */
.custom-choices-wrapper {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.custom-choice-input-row {
  display: flex;
  gap: 6px;
}

.custom-choice-input {
  flex: 1;
  background-color: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 6px;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-main);
  outline: none;
}

.custom-choice-input:focus {
  border-color: var(--mauve-accent);
}

.custom-choice-remove {
  background: transparent;
  border: none;
  color: #8a8d94;
  font-size: 16px;
  cursor: pointer;
  padding: 0 6px;
}

.custom-choice-add-btn {
  align-self: flex-start;
  background: transparent;
  border: none;
  color: var(--mauve-accent);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 0;
}

/* Main Action Button (SEND ALERT) */
.send-alert-button {
  width: 100%;
  height: 50px;
  background-color: var(--mauve-accent);
  border: none;
  border-radius: 10px;
  color: #ffffff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: var(--mauve-shadow);
  transition: transform 0.1s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.send-alert-button:hover:not(:disabled) {
  background-color: var(--mauve-hover);
  transform: translateY(-1px);
}

.send-alert-button:active:not(:disabled) {
  background-color: var(--mauve-active);
  transform: translateY(1px);
}

.send-alert-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.send-alert-button.emergency-state {
  background-color: var(--status-emergency);
  box-shadow: var(--status-emergency-shadow);
}

.send-alert-button.emergency-state:hover:not(:disabled) {
  background-color: #d13d51;
}

.send-icon-svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Section Title */
.section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #6e7580;
  margin-top: 4px;
  margin-bottom: -4px;
}

/* Recent Activity List */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.activity-item-card {
  background-color: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 4px rgba(28, 38, 50, 0.03);
}

.activity-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.activity-item-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.activity-item-time {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.activity-status-pill {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.activity-status-pill.dismissed {
  background-color: #d1d5db; /* ~25% gray background */
  color: #374151;
}

.activity-status-pill.delivered {
  background-color: #e5f5ef;
  color: #0d7048;
}

.activity-status-pill.responded {
  background-color: #e5f5ef;
  color: #0d7048;
}

.activity-status-pill.pending {
  background-color: #FCAE1E;
  color: #ffffff;
}

.activity-status-pill.error,
.activity-status-pill.failure,
.activity-status-pill.failed {
  background-color: #dc2626; /* red background */
  color: #ffffff;
}

/* Bottom Navigation Bar */
.app-bottom-nav {
  background-color: var(--chrome-bg);
  height: 64px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: center;
  position: sticky;
  bottom: 0;
  z-index: 40;
  padding: 0 12px;
  box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.12);
}

.nav-tab-btn {
  background: transparent;
  border: none;
  color: var(--chrome-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 10px;
  transition: all 0.15s ease;
  user-select: none;
}

.nav-tab-btn:hover {
  color: #ffffff;
}

.nav-tab-btn.active {
  background-color: var(--chrome-active-tab);
  color: #FCAE1E;
}

.nav-tab-icon {
  width: 22px;
  height: 22px;
  display: block;
}

.nav-tab-label {
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.nav-tab-btn.active .nav-tab-label {
  color: #FCAE1E;
}

/* Modal and Desk Clock Receiver Preview */
.desk-clock-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.desk-clock-frame {
  width: 100%;
  max-width: 480px;
  background-color: #0b0c0e;
  border-radius: 20px;
  border: 4px solid #23252a;
  box-shadow: 0 0 50px rgba(0,0,0,0.8);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: background-color 0.15s ease;
  min-height: 340px;
  position: relative;
}

.desk-clock-frame.flash-white {
  background-color: #ffffff !important;
}

.desk-clock-frame.flash-white * {
  color: #000000 !important;
}

.desk-clock-top-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.desk-clock-status-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #8c9099;
  font-weight: 600;
}

.live-dot {
  width: 8px;
  height: 8px;
  background-color: #22c55e;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px #22c55e;
}

.desk-clock-close-btn {
  background: #23252a;
  border: 1px solid #363a42;
  color: #d1d5db;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.desk-clock-message-text {
  font-size: 26px;
  font-weight: 700;
  color: #ffffff;
  margin: 18px 0 24px;
  line-height: 1.3;
}

.desk-clock-buttons-row {
  display: flex;
  gap: 12px;
  width: 100%;
  justify-content: center;
}

.desk-clock-btn {
  flex: 1;
  height: 54px;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.desk-clock-btn:active {
  transform: scale(0.97);
}

.desk-clock-btn.dismiss {
  background-color: #4d8eff;
  color: #ffffff;
}

.desk-clock-btn.yes {
  background-color: #22c55e;
  color: #ffffff;
}

.desk-clock-btn.no {
  background-color: #ef4444;
  color: #ffffff;
}

.desk-clock-btn.custom-choice {
  background-color: #2f343d;
  color: #ffffff;
  border: 1px solid #454c58;
}

.desk-clock-choices-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.desk-clock-standby-time {
  font-size: 48px;
  font-weight: 700;
  color: #e5e7eb;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  margin-top: 20px;
}

.desk-clock-standby-date {
  font-size: 14px;
  color: #8c9099;
  margin-top: 4px;
}

.desk-clock-standby-hint {
  font-size: 12px;
  color: #6b7280;
  margin-top: 24px;
  max-width: 280px;
  line-height: 1.4;
}

/* Strobe flash overlay */
.flash-overlay {
  position: fixed;
  inset: 0;
  background-color: #ffffff;
  opacity: 0;
  pointer-events: none;
  z-index: 999;
  transition: opacity 0.05s ease;
}

.flash-overlay.active {
  opacity: 0.85;
}

/* Ghost / utility buttons */
.stitch-btn-secondary {
  background-color: #ffffff;
  border: 1px solid var(--card-border);
  color: var(--text-main);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.stitch-btn-secondary:hover {
  background-color: #f7f9fa;
}

.error-banner {
  background-color: #fee2e2;
  border: 1px solid #fecaca;
  color: #dc2626;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 8px;
  margin-top: 8px;
}
