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

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary: #64748b;
  --secondary-hover: #475569;
  --success: #16a34a;
  --error: #dc2626;
  --bg-card: rgba(255, 255, 255, 0.92);
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html, body {
  height: 100%;
  font-family: var(--font);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ===== Background ===== */
.bg-image {
  position: fixed;
  inset: 0;
  /* Beautiful gradient as fallback + optional image */
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  background-image: url("background.jpg"); /* ← Put your image here (optional) */
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: -2;
}

.bg-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: -1;
}

/* ===== Layout ===== */
.container {
  max-width: 520px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.header {
  text-align: center;
  margin-bottom: 28px;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.header h1 {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  margin-top: 6px;
  font-size: 1rem;
  opacity: 0.9;
}

/* ===== Form Card ===== */
#guestbookForm {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

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

.form-group label .hint {
  display: block;
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

input[type="text"],
input[type="email"],
textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

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

/* ===== Signature Pad (full width of form) ===== */
.signature-section {
  margin-bottom: 24px;
}

.signature-wrapper {
  width: 100%;
  border: 2px dashed #94a3b8;
  border-radius: 8px;
  background: #f8fafc;
  overflow: hidden;
  touch-action: none; /* important for smooth drawing on touch devices */
  position: relative;
}

.signature-pad {
  display: block;
  width: 100%;
  height: 180px; /* fixed height, full width of parent */
  cursor: crosshair;
  background: transparent;
}

.signature-wrapper.drawing {
  border-color: var(--primary);
  background: #fff;
}

.signature-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

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

.btn-primary {
  background: var(--primary);
  color: #fff;
  width: 100%;
  padding: 14px;
  font-size: 1.05rem;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-secondary {
  background: #f1f5f9;
  color: var(--secondary);
  border: 1px solid var(--border);
  flex: 1;
}

.btn-secondary:hover {
  background: #e2e8f0;
  color: var(--secondary-hover);
}

.form-actions {
  margin-top: 8px;
}

/* ===== Status Message ===== */
.status-message {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 0.95rem;
  text-align: center;
  display: none;
}

.status-message.show {
  display: block;
}

.status-message.success {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.status-message.error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  margin-top: 24px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.9rem;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

/* ===== Responsive ===== */
@media (min-width: 540px) {
  .container {
    padding: 40px 20px 60px;
  }

  .header h1 {
    font-size: 2.2rem;
  }

  #guestbookForm {
    padding: 32px 28px;
  }

  .signature-pad {
    height: 200px;
  }
}

/* Prevent zoom on input focus on iOS */
@media screen and (max-width: 480px) {
  input[type="text"],
  input[type="email"],
  textarea {
    font-size: 16px;
  }
}
