/* Create PINCS page - matches site colors, responsive, production-ready */

:root {
  --brand: #e32929;
  --brand-dark: #c60f1a;
  --map-bg: #f5f0eb;
  --grid-line: rgba(0, 0, 0, 0.06);
  --text-dark: #333333;
  --text-muted: #666666;
  --text-placeholder: #aaaaaa;
  --border-input: #dddddd;
  --panel-bg: #ffffff;
  --select-map-border: #cccccc;
  --select-map-bg: #f8f8f8;
}

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

html,
body {
  height: 100%;
}

body {
  font-family: "Syne", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text-dark);
  background: var(--panel-bg);
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

button {
  font: inherit;
  border: none;
  background: none;
  cursor: pointer;
}

a {
  text-decoration: none;
  color: inherit;
}

/* ----------
   Header (reuse main site styles)
   ---------- */
.site-header {
  position: fixed;
  inset-inline: 0;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.site-header .container {
  width: 100%;
  max-width: 100%;
  margin-inline: 0;
  padding-inline: clamp(16px, 4vw, 50px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 14px;
}

.logo {
  display: inline-flex;
  align-items: center;
}

.logo-img {
  height: 56px;
  width: auto;
}

.navbar {
  display: flex;
  align-items: center;
  gap: 24px;
  flex: 1;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
  list-style: none;
  font-size: 0.95rem;
  margin: 0 auto;
}

.nav-icon {
  display: none;
}

.nav-links a {
  position: relative;
  padding-block: 2px;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 2px;
  background: var(--brand);
  border-radius: 999px;
  transition: width 0.2s ease-out;
}

.nav-links a:hover::after,
.nav-links a:focus-visible::after {
  width: 100%;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn {
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: transform 0.15s ease-out, box-shadow 0.15s ease-out,
    background-color 0.15s ease-out, color 0.15s ease-out, border-color 0.15s ease-out;
  white-space: nowrap;
  display: inline-block;
  text-align: center;
}

.btn-primary {
  background: var(--brand);
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(227, 41, 41, 0.35);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--brand-dark);
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(198, 15, 26, 0.4);
}

.btn-outline {
  border: 1.6px solid var(--brand);
  color: var(--brand);
  background: #ffffff;
}

.btn-outline:hover,
.btn-outline:focus-visible {
  background: var(--brand);
  color: #ffffff;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 32px;
  height: 32px;
}

.nav-toggle span {
  height: 2px;
  width: 100%;
  background: #222;
  border-radius: 999px;
}

/* ----------
   Main layout
   ---------- */
.create-pincs-main {
  padding-top: 84px;
  min-height: 100vh;
}

.create-pincs-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  min-height: calc(100vh - 84px);
}

/* ----------
   Map section (left ~65-70%)
   ---------- */
.map-section {
  position: relative;
  background: var(--map-bg);
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 24px 24px;
  min-height: 400px;
}

.map-container {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.map-placeholder {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.map-placeholder.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.map-pin-icon {
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-pin-icon svg {
  width: 64px;
  height: 64px;
  filter: drop-shadow(0 4px 12px rgba(227, 41, 41, 0.25));
}

.map-label {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-dark);
}

.map-hint {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Leaflet map styling */
.map-container.leaflet-container {
  font-family: inherit;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  border-radius: 8px;
}

/* Custom PINCS marker */
.pincs-marker {
  background: none !important;
  border: none !important;
}

.pincs-marker svg {
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.25));
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ----------
   Form panel (right ~30-35%)
   ---------- */
.form-panel {
  background: var(--panel-bg);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.06);
  overflow-y: auto;
}

.form-panel-inner {
  padding: clamp(24px, 4vw, 32px);
  max-width: 100%;
}

.form-panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.form-panel-icon {
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.form-panel-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.2;
}

.form-panel-desc {
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 24px;
}

/* ----------
   Form elements
   ---------- */
.create-pincs-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 8px;
}

.field input {
  width: 100%;
  padding: 12px 14px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text-dark);
  background: #ffffff;
  border: 1px solid var(--border-input);
  border-radius: 8px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input::placeholder {
  color: var(--text-placeholder);
}

.field input:hover {
  border-color: #cccccc;
}

.field input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(227, 41, 41, 0.12);
}

.search-row {
  display: flex;
  gap: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-input);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-row:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(227, 41, 41, 0.12);
}

.search-row input {
  flex: 1;
  border: none;
  border-radius: 0;
  min-width: 0;
}

.search-row input:focus {
  box-shadow: none;
}

.btn-search {
  padding: 12px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #ffffff;
  background: var(--brand-dark);
  border-radius: 0 7px 7px 0;
  transition: background 0.2s ease, transform 0.15s ease;
}

.btn-search:hover,
.btn-search:focus-visible {
  background: #a80d16;
  transform: none;
}

.divider-text {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 4px 0;
}

.divider-text::before,
.divider-text::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-input);
}

.divider-text span {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.btn-select-map {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  font-size: 0.95rem;
  font-weight: 500;
  color: #2c5282;
  background: var(--select-map-bg);
  border: 1px dashed var(--select-map-border);
  border-radius: 8px;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.btn-select-map svg {
  color: #3498db;
  flex-shrink: 0;
}

.btn-select-map:hover,
.btn-select-map:focus-visible {
  background: #f0f0f0;
  border-color: #999999;
}

.btn-generate {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 8px;
  padding: 14px 20px;
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-dark) 100%);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(227, 41, 41, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-generate:hover,
.btn-generate:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(227, 41, 41, 0.45);
}

.btn-generate:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* ----------
   Responsive
   ---------- */
@media (max-width: 1024px) {
  .create-pincs-layout {
    grid-template-columns: 1fr 340px;
  }
}

@media (max-width: 900px) {
  .create-pincs-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }

  .map-section {
    min-height: 320px;
    order: 1;
  }

  .form-panel {
    order: 2;
  }

  .nav-toggle {
    display: flex;
  }

  .navbar {
    position: fixed;
    inset-inline: 0;
    top: 84px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    flex-direction: column;
    flex: initial;
    align-items: flex-start;
    padding: 20px 24px;
    gap: 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    transform: translateY(-120%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.2s ease-out, opacity 0.2s ease-out;
  }

  .navbar.is-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    margin-right: 12px;
    color: var(--brand);
  }

  .nav-links a {
    display: flex;
    align-items: center;
    padding-block: 8px;
  }

  .nav-links {
    flex-direction: column;
    align-items: flex-start;
    margin: 0;
  }

  .nav-actions {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
  }

  .nav-actions .btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .nav-actions .nav-icon {
    color: inherit;
  }

  .nav-icon-signin {
    color: #c9a227;
    transform: rotate(180deg);
  }
}

@media (max-width: 600px) {
  .create-pincs-main {
    padding-top: 72px;
  }

  .map-section {
    min-height: 280px;
  }

  .form-panel-inner {
    padding: 20px 16px;
  }

  .form-panel-title {
    font-size: 1.35rem;
  }

  .search-row {
    flex-direction: column;
    border: none;
  }

  .search-row input {
    border: 1px solid var(--border-input);
    border-radius: 8px;
  }

  .btn-search {
    width: 100%;
    border-radius: 8px;
  }

  .map-pin-icon svg {
    width: 52px;
    height: 52px;
  }

  .map-label {
    font-size: 1rem;
  }

  .map-hint {
    font-size: 0.85rem;
  }
}
