/* ============================================================
   AutoCheck PWA - Component Library
   Prefix: .ac- (AutoCheck)
   ============================================================ */

/* ----------------------------------------------------------
   Page Layout
   ---------------------------------------------------------- */
.ac-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

.ac-page__content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.ac-page__bottom {
  padding: 10px 20px 20px;
  border-top: 0.5px solid var(--divider);
}

/* ----------------------------------------------------------
   App Bar
   ---------------------------------------------------------- */
.ac-appbar {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  position: sticky;
  top: 0;
  background-color: var(--bg);
  z-index: 50;
  border-bottom: 0.5px solid var(--divider);
}

.ac-appbar__back {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--text);
  flex-shrink: 0;
}

.ac-appbar__back:active {
  background-color: var(--surface);
}

.ac-appbar__title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-left: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ----------------------------------------------------------
   Card
   ---------------------------------------------------------- */
.ac-card {
  background-color: var(--card);
  border: 0.5px solid var(--divider);
  border-radius: var(--radius);
  padding: 16px;
}

/* ----------------------------------------------------------
   Buttons
   ---------------------------------------------------------- */
.ac-btn {
  width: 100%;
  height: var(--btn-height);
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.ac-btn:active {
  transform: scale(0.97);
}

.ac-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.ac-btn--primary {
  background-color: var(--accent);
  color: #ffffff;
}

.ac-btn--primary:active:not(:disabled) {
  background-color: #e55e2d;
}

.ac-btn--outline {
  background: transparent;
  border: 1px solid var(--divider);
  color: var(--text);
}

.ac-btn--outline:active:not(:disabled) {
  background-color: var(--surface);
}

/* ----------------------------------------------------------
   Inputs
   ---------------------------------------------------------- */
.ac-input {
  width: 100%;
  background-color: var(--surface);
  border: 0.5px solid var(--divider);
  border-radius: var(--radius-sm);
  padding: 15px 16px;
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s ease, border-width 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}

.ac-input:focus {
  border-color: var(--accent);
  border-width: 1.5px;
}

.ac-input::placeholder {
  color: var(--text-muted);
  font-size: 14px;
}

.ac-label {
  font-size: 14px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 6px;
}

.ac-section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin-bottom: 2px;
}

/* ----------------------------------------------------------
   Badge
   ---------------------------------------------------------- */
.ac-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

/* ----------------------------------------------------------
   Overlay
   ---------------------------------------------------------- */
.ac-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 100;
}

/* ----------------------------------------------------------
   Toast
   ---------------------------------------------------------- */
.ac-toast {
  position: fixed;
  bottom: 24px;
  left: 16px;
  right: 16px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  z-index: 200;
  transform: translateY(100px);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  font-size: 14px;
  font-weight: 600;
}

.ac-toast.active {
  transform: translateY(0);
  opacity: 1;
}

.ac-toast--success {
  background-color: var(--green);
  color: #000000;
}

.ac-toast--error {
  background-color: var(--red);
  color: #ffffff;
}

.ac-toast--info {
  background-color: var(--surface);
  color: var(--text);
  border: 0.5px solid var(--divider);
}

/* ----------------------------------------------------------
   Divider
   ---------------------------------------------------------- */
.ac-divider {
  height: 0.5px;
  background-color: var(--divider);
  width: 100%;
}

/* ----------------------------------------------------------
   Page Transition Animation
   ---------------------------------------------------------- */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ac-page-enter {
  animation: fadeIn 0.2s ease-out;
}

/* ----------------------------------------------------------
   Responsive Container
   ---------------------------------------------------------- */
@media (min-width: 768px) {
  .ac-page {
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
    border-left: 0.5px solid var(--divider);
    border-right: 0.5px solid var(--divider);
  }
}

/* ----------------------------------------------------------
   Safe Area
   ---------------------------------------------------------- */
@supports (padding: env(safe-area-inset-top)) {
  .ac-page {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .ac-page__bottom {
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }

  .ac-toast {
    bottom: calc(24px + env(safe-area-inset-bottom));
  }
}
