/*----------------------------------*
 * Base CSS - Global Styles
 * Shared across all pages
 *---------------------------------*/

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  min-height: 100vh;
}

/* Global unsaved modal button consistency (reuses existing btn classes if present) */
#globalUnsavedModal .btn {
  min-height: 38px;
}

/*----------------------------------*
 * Utility / Message styles
 *---------------------------------*/

.error-message {
  background-color: #ffe5e5;
  color: #d8000c;
  padding: 10px 15px;
  border: 1px solid #d8000c;
  border-radius: 5px;
  margin-bottom: 15px;
  font-size: 14px;
  text-align: center;
}

.error {
  color: #b91c1c;
  margin-bottom: 10px;
}

.success {
  color: #15803d;
  margin-bottom: 10px;
  font-size: 1.2rem;
  font-weight: 700;
}

.message {
  color: #15803d;
  font-weight: 700;
}

/*----------------------------------*
 * Shared components
 *---------------------------------*/

.logo {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  margin: 0 auto 20px auto;
  display: block;
  object-fit: cover;
}

.back-btn {
  background-color: #666;
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  text-decoration: none;
  display: inline-block;
  margin-bottom: 20px;
  cursor: pointer;
}

.back-btn:hover {
  background-color: #555;
}

/*----------------------------------*
 * Form styles (shared)
 *---------------------------------*/

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

.form-group label {
  display: block;
  margin-bottom: 5px;
  color: #555;
  font-weight: 500;
  font-size: 14px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.hint {
  display: block;
  margin-top: 6px;
  color: #666;
  font-size: 12px;
}

/*----------------------------------*
 * Maintenance image
 *---------------------------------*/

.maintenance-image {
  max-width: 400px;
  width: 100%;
  height: auto;
  display: block;
  margin: 20px auto;
}

/* Larger, bottom-anchored maintenance image variant */
.maintenance-wrap {
  /* make this container full-bleed (edge-to-edge) while keeping it inside the normal flow
     - it will expand to the viewport width and center its contents
     - keeps the visual anchored to the bottom using flex alignment */
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  width: 100vw;
  display: flex;
  align-items: flex-end; /* anchor image to bottom of available area */
  justify-content: center;
  min-height: 60vh; /* leave space so image sits near bottom */
  padding-bottom: 24px;
  box-sizing: border-box;
}

.maintenance-image.large {
  max-width: none;
  width: 100%; /* fill the .maintenance-wrap (which is full viewport width) */
  height: auto;
  display: block;
}

/*----------------------------------*
 * Responsive Utilities
 *---------------------------------*/

/* Ensure images are responsive */
img {
  max-width: 100%;
  height: auto;
}

/* Responsive text sizing */
@media (max-width: 768px) {
  body {
    font-size: 14px;
  }

  .form-group input,
  .form-group select {
    font-size: 16px; /* Prevents zoom on iOS */
  }

  .maintenance-image {
    max-width: 300px;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 13px;
  }

  .back-btn {
    width: 100%;
    text-align: center;
  }

  .maintenance-image {
    max-width: 250px;
  }
}

/* Prevent horizontal scroll on mobile */
html,
body {
  overflow-x: hidden;
  max-width: 100%;
}

/* Touch-friendly button sizing */
@media (hover: none) and (pointer: coarse) {
  button,
  .nav-btn,
  .back-btn,
  a[role="button"] {
    min-height: 44px; /* iOS recommended touch target */
    min-width: 44px;
  }
}
