/* ===== CSS Variables ===== */
:root {
  --bg-color: #f5f7fa;
  --card-bg: #ffffff;
  --text-primary: #1a1a2e;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --accent: #2a748a;
  --accent-hover: #1f5a6b;
  --accent-light: #e8f4f7;
  --border: #e5e7eb;
  --border-focus: #2a748a;
  --error: #dc2626;
  --error-bg: #fef2f2;
  --success: #16a34a;
  --success-bg: #f0fdf4;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  --radius: 16px;
  --radius-sm: 10px;
  --transition: 0.2s ease;
}

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

html {
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  background: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ===== Site Header ===== */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  width: 100%;
}

.site-header-left {
  flex-shrink: 0;
}

.site-header-center {
  flex: 1;
  text-align: center;
  min-width: 0;
}

.site-header-center h1 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.2;
}

.site-header-center .subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin: 2px 0 0;
  line-height: 1.3;
}

.site-header-right {
  flex-shrink: 0;
}

/* ===== Logo ===== */
.logo-img {
  height: 40px;
  width: auto;
  display: block;
}

/* ===== Lang Switcher ===== */
.lang-switcher {
  display: flex;
  gap: 4px;
}

.lang-btn {
  padding: 4px 12px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.lang-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.lang-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 8px 16px;
  min-height: calc(100vh - 65px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lang-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.lang-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ===== Card ===== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 20px;
  width: 100%;
}

/* ===== Form ===== */
form {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.required {
  color: var(--error);
}

/* ===== Inputs ===== */
input[type="text"],
input[type="time"],
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  font-size: 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--text-primary);
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

input[type="text"]:focus,
input[type="time"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(42, 116, 138, 0.1);
}

/* ===== Custom Dropdown (radio-based) ===== */
.dropdown-el {
  position: relative;
  display: block;
  width: 100%;
  min-height: 42px;
  max-height: 42px;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  color: var(--text-primary);
  outline: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: var(--card-bg);
  transition:
    max-height 0.2s ease-in-out,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.dropdown-el input {
  width: 1px;
  height: 1px;
  display: inline-block;
  position: absolute;
  opacity: 0.01;
}

.dropdown-el input:focus + label {
  background: var(--accent-light);
}

.dropdown-el label {
  border-top: 1px solid var(--border);
  display: block;
  height: 42px;
  line-height: 42px;
  padding-left: 14px;
  padding-right: 42px;
  cursor: pointer;
  position: relative;
  transition:
    color 0.2s ease,
    background 0.2s ease;
  font-size: 1rem;
}

/* First label: push below selected when collapsed */
.dropdown-el label:nth-child(2) {
  margin-top: 42px;
}

/* Selected label: show at top when collapsed */
.dropdown-el input:checked + label {
  display: block;
  border-top: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
}

/* First label selected: special case, no margin */
.dropdown-el input:checked + label:nth-child(2) {
  margin-top: 0;
  position: relative;
}

.dropdown-el::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 18px;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--text-secondary);
  transition: 0.3s ease-in-out;
  pointer-events: none;
}

/* ===== Expanded state ===== */
.dropdown-el.expanded {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  max-height: 200px;
  overflow-y: auto;
  z-index: 10;
}

/* Reset all labels to normal flow when expanded */
.dropdown-el.expanded label {
  border-top: 1px solid var(--border);
  margin-top: 0;
  position: relative;
}

.dropdown-el.expanded label:nth-child(2) {
  margin-top: 0;
}

/* Reset selected label from absolute to normal flow */
.dropdown-el.expanded input:checked + label {
  position: relative;
  top: auto;
  left: auto;
  width: auto;
  border-top: 1px solid var(--border);
}

.dropdown-el.expanded label:hover {
  color: var(--accent);
  background: var(--accent-light);
}

.dropdown-el.expanded input:checked + label {
  color: var(--accent);
  background: var(--accent-light);
}

.dropdown-el.expanded::after {
  transform: rotate(-180deg);
  top: 14px;
}

.dropdown-el.error {
  border-color: var(--error) !important;
}

textarea {
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

/* ===== Photo Upload ===== */
.photo-upload {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 200px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-color);
  overflow: hidden;
  cursor: pointer;
  transition:
    border-color var(--transition),
    background var(--transition);
}

.photo-upload:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.photo-upload.has-file {
  border-style: solid;
  border-color: var(--accent);
}

.photo-upload input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.upload-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-secondary);
  pointer-events: none;
  z-index: 1;
}

.upload-placeholder .icon {
  width: 40px;
  height: 40px;
  opacity: 0.5;
}

.upload-placeholder span {
  font-size: 0.9375rem;
  font-weight: 500;
}

.upload-placeholder .upload-hint {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 4px;
}

.photo-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}

.remove-photo {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  transition: background var(--transition);
}

.remove-photo:hover {
  background: rgba(0, 0, 0, 0.7);
}

.remove-photo svg {
  width: 16px;
  height: 16px;
}

/* ===== Location Button ===== */
.location-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  margin-top: 4px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-light);
  border: 1px solid rgba(42, 116, 138, 0.15);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  align-self: flex-start;
}

.location-btn:hover {
  background: #c5e0e8;
}

.location-btn svg {
  width: 14px;
  height: 14px;
}

.location-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ===== Error Messages ===== */
.error-message {
  font-size: 0.8125rem;
  color: var(--error);
  min-height: 18px;
}

input.error,
textarea.error,
select.error,
.photo-upload.error {
  border-color: var(--error) !important;
}

input.error:focus,
textarea.error:focus,
select.error:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* ===== Submit Button ===== */
.submit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  margin-top: 4px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition:
    background var(--transition),
    transform var(--transition);
  -webkit-appearance: none;
  appearance: none;
  text-decoration: none;
}

.submit-btn:hover {
  background: var(--accent-hover);
}

.submit-btn:active {
  transform: scale(0.98);
}

.submit-btn:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
  transform: none;
}

.btn-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner {
  width: 20px;
  height: 20px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===== Success Page ===== */
.success-card {
  text-align: center;
  padding: 40px 24px;
}

.success-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  color: var(--success);
  background: var(--success-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.success-icon svg {
  width: 32px;
  height: 32px;
}

.success-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.success-card .subtitle {
  margin-bottom: 24px;
  line-height: 1.6;
}

/* ===== Server Error ===== */
.server-error {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid rgba(220, 38, 38, 0.2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 0.875rem;
  font-weight: 500;
}

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

.field-hint-inline {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  margin-top: 16px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ===== Responsive ===== */
@media (max-width: 360px) {
  .site-header {
    padding: 8px 12px;
  }

  .site-header-center h1 {
    font-size: 0.95rem;
  }

  .site-header-center .subtitle {
    font-size: 0.7rem;
  }

  .logo-img {
    height: 32px;
  }

  .container {
    padding: 12px;
  }

  .card {
    padding: 20px 16px;
    border-radius: 12px;
  }
}

@media (min-width: 768px) {
  .site-header {
    padding: 16px 32px;
  }

  .site-header-center h1 {
    font-size: 1.3rem;
  }

  .container {
    padding: 32px;
  }

  .card {
    padding: 12px 32px 36px 32px;
  }
}

/* ===== Utility ===== */
.hidden {
  display: none !important;
}
