:root {
  --bg-overlay: rgba(44, 24, 16, 0.6);
  --bg-modal: #FDFBF7;
  --bg-panel: #FFFFFF;
  --text-primary: #2C1810;
  --text-secondary: #6D5E57;
  --brand-primary: #8D6E63;
  --brand-dark: #5D4037;
  --brand-accent: #A1887F;
  --border-color: #D7CCC8;
  --danger: #D32F2F;
  --success: #388E3C;
  --link: #0645AD;
  --input-bg: #FFFFFF;
  --paper: #f7f3e9;
  --ink: #222;
  --font-serif: "Playfair Display", Georgia, serif;
  --font-sans: "Lato", Arial, sans-serif;
  --white: #f2f7fd;

  /* NEW: Soft brand-colored glow for focus states to replace default blue */
  --ring: 0 0 0 3px rgba(141, 110, 99, 0.25);
  --bg: var(--white);
  /* Ensure bg variable is mapped */
}

* {
  box-sizing: border-box;
  color: var(--text-secondary);
  font-family: var(--font-sans);
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.support-page {
  margin-top: 70px;
}

.card {
  background: var(--bg-panel);
  border-radius: 16px;
  padding: 1.25rem;
  width: 500px;
  margin: 20px auto;
  /* Centered margin */
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 -1px 10px rgba(0, 0, 0, 0.05),
    4px 0 15px rgba(0, 0, 0, 0.05),
    -4px 0 15px rgba(0, 0, 0, 0.05);
}

h1 {
  margin: 0 0 1rem 0;
  font-size: 1.6rem;
  letter-spacing: -0.01em;
  color: var(--brand-dark);
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1rem 0;
}

/* Base Input Styles */
input[type="text"],
input[type="email"],
select,
textarea {
  width: 100%;
  padding: 0.8rem 0.95rem;
  border-radius: 12px;
  background: var(--input-bg);
  color: var(--text-primary);
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
  border: 1px solid transparent;
  /* Prepare for border transition */
  appearance: none;
  /* Helps standardise select dropdowns */
  -webkit-appearance: none;
}

/* Add custom arrow for Select dropdowns if browser supports appearance:none */
select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235D4037' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1em;
}

/* Hover State for Inputs */
input:hover,
select:hover,
textarea:hover {
  border-color: var(--brand-accent);
}

/* Focus State - The Fix for "Blue" */
input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand-dark);
  box-shadow: var(--ring);
  /* Uses the brand color glow defined in root */
  outline: none;
}

/* Prevent Chrome Autofill from turning background blue/yellow */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 30px var(--input-bg) inset !important;
  -webkit-text-fill-color: var(--text-primary) !important;
  transition: background-color 5000s ease-in-out 0s;
}

textarea {
  resize: vertical;
  min-height: 140px;
}

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

/* Button Styling */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 12px;
  padding: 0.8rem 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 10px;

  /* Brand Colors */
  background-color: var(--brand-dark);
  color: #ffffff;
}

.btn:hover {
  background-color: var(--brand-primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(93, 64, 55, 0.2);
}

.btn:active {
  transform: translateY(0);
}

.form-message {
  margin-top: 1rem;
  font-size: 0.95rem;
}

.form-message.ok {
  color: var(--success);
}

.form-message.err {
  color: var(--danger);
}

.hidden {
  display: none;
}

/* "Alternate contact" card (mailto) */
.support-alt-contact {
  margin-top: 1.25rem;
}

.support-alt-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.02), rgba(0, 0, 0, 0));
  transition: all 0.2s ease;
}

.support-alt-card:hover {
  border-color: var(--brand-accent);
  box-shadow: var(--ring);
  transform: translateY(-1px);
}

.support-alt-icon {
  fill: var(--brand-dark);
  flex: 0 0 auto;
}

.support-alt-text {
  display: flex;
  flex-direction: column;
}

.support-alt-label {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.1;
}

.support-alt-email {
  color: var(--text-primary);
  font-weight: 700;
  text-decoration: none;
  margin-top: 2px;
  word-break: break-all;
}

.support-alt-email:hover {
  text-decoration: underline;
  color: var(--brand-dark);
}


/* --- Custom Select Dropdown Styles --- */

/* The container must be relative for the dropdown to position correctly */
.custom-select {
  position: relative;
  width: 100%;
}

/* Hide the default browser select element */
.custom-select select {
  display: none;
}

/* The box that shows the currently selected value */
.select-selected {
  background-color: var(--input-bg);
  border-radius: 12px;
  padding: 0.8rem 0.95rem;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

/* Add the custom arrow */
.select-selected:after {
  position: absolute;
  content: "";
  top: 18px;
  right: 1rem;
  width: 0;
  height: 0;
  border: 6px solid transparent;
  border-color: var(--brand-dark) transparent transparent transparent;
}

/* Arrow points up when open */
.select-selected.select-arrow-active:after {
  border-color: transparent transparent var(--brand-dark) transparent;
  top: 10px;
}

/* Focus state for the box */
.select-selected.select-arrow-active {
  border-color: var(--brand-dark);
  box-shadow: var(--ring);
}

/* The dropdown list container */
.select-items {
  position: absolute;
  background-color: var(--bg-modal);
  top: 100%;
  left: 0;
  right: 0;
  z-index: 99;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  margin-top: 5px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

/* Individual options */
.select-items div {
  color: #2C1810;
  padding: 10px 16px;
  cursor: pointer;
  user-select: none;
  transition: background 0.1s;
}

/* THE FIX: Hovering an option now uses your brand color */
.select-items div:hover,
.same-as-selected {
  background-color: var(--paper);
  /* Make sure this is defined in :root, or use #A1887F */
}

/* Utility to hide the list */
.select-hide {
  display: none;
}

/* --- Small Screen Fixes --- */
@media (max-width: 600px) {
  .card {
    width: 100%;
  }
}