/* VeriSmart Tenant Portal — modern mobile-first PWA styles */

:root {
  --color-brand: #f5c518;
  --color-brand-dark: #d4a90f;
  --color-text: #1a1a1a;
  --color-text-muted: #5a5a5a;
  --color-surface: #ffffff;
  --color-surface-alt: #f7f7f7;
  --color-border: #d8d8d8;
  --color-danger: #c0392b;
  --color-link: #1a5fb4;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
  --radius: 10px;
  --radius-sm: 6px;
  --header-height: 56px;
  --max-content: 960px;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-surface-alt);
  min-height: 100dvh;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--color-link);
}

/* App shell */

.app-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.5rem;
  min-height: var(--header-height);
  padding: 0.5rem 0.75rem;
  background: var(--color-brand);
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
}

.app-header__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-header__start,
.app-header__end {
  min-width: 4rem;
}

.app-header__end {
  text-align: right;
}

.app-main {
  flex: 1;
  width: 100%;
  max-width: var(--max-content);
  margin: 0 auto;
  padding: 1rem;
}

.app-footer {
  padding: 1rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}

.app-footer p {
  margin: 0;
}

/* Header navigation */

.header-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.35);
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid rgba(0, 0, 0, 0.08);
  transition: background 0.15s ease;
}

.header-btn:hover,
.header-btn:focus-visible {
  background: rgba(255, 255, 255, 0.55);
  outline: none;
}

.header-btn svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

/* Typography */

h1, h2, h3, h4, h5 {
  line-height: 1.25;
  margin: 0 0 0.75rem;
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.125rem; }
h4, h5 { font-size: 1rem; }

p {
  margin: 0 0 1rem;
}

.text-center {
  text-align: center;
}

.text-muted {
  color: var(--color-text-muted);
}

.text-danger {
  color: var(--color-danger);
}

/* Cards and panels */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

/* Brand bar */

.brand-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--color-surface);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

.brand-bar img {
  width: 64px;
  height: auto;
  flex-shrink: 0;
}

.brand-bar h1 {
  margin: 0;
  font-size: 1.5rem;
}

/* Two-column layout */

.grid-two-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (min-width: 768px) {
  .grid-two-col {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

.grid-col {
  min-width: 0;
}

.introtext {
  padding: 1.25rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.proptext {
  padding: 1.25rem;
  text-align: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--color-brand);
  color: var(--color-text);
  border-color: var(--color-brand-dark);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--color-brand-dark);
  outline: none;
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
  background: var(--color-surface-alt);
  outline: none;
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin: 1rem 0;
}

/* Lists */

.item-list,
.nav-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--color-surface);
}

.item-list li,
.nav-list li {
  border-bottom: 1px solid var(--color-border);
}

.item-list li:last-child,
.nav-list li:last-child {
  border-bottom: none;
}

.item-list a,
.nav-list a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  color: var(--color-text);
  text-decoration: none;
  transition: background 0.15s ease;
}

.item-list a:hover,
.item-list a:focus-visible,
.nav-list a:hover,
.nav-list a:focus-visible {
  background: var(--color-surface-alt);
  outline: none;
}

.list-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  background: var(--color-surface-alt);
}

.list-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.item-list__content {
  flex: 1;
  min-width: 0;
}

.item-list__title {
  margin: 0 0 0.2rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.item-list__desc {
  margin: 0;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Forms */

.form {
  margin-bottom: 1rem;
}

.form-field {
  margin-bottom: 1rem;
}

.form-field label,
.form-field legend {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.form-field input[type="text"],
.form-field input[type="tel"],
.form-field input[type="email"],
.form-field input[type="number"],
.form-field input[type="file"],
.form-field textarea,
.form-field select {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font: inherit;
  background: var(--color-surface);
  color: var(--color-text);
}

.form-field textarea {
  min-height: 120px;
  resize: vertical;
}

.form-field input[type="file"] {
  padding: 0.5rem;
}

.form-field input:focus-visible,
.form-field textarea:focus-visible,
.form-field select:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 1px;
  border-color: var(--color-brand-dark);
}

.form-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.checkbox-group {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  background: var(--color-surface-alt);
}

.checkbox-group label {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-weight: 500;
  cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  margin-top: 0.15rem;
  flex-shrink: 0;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

/* Photo preview */

.photo-preview {
  margin: 1rem 0;
}

.photo-preview img {
  max-width: 200px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
}

/* Loading overlay */

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
}

.loading-overlay[hidden] {
  display: none;
}

.loading-overlay__panel {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  text-align: center;
  box-shadow: var(--shadow-md);
}

.loading-overlay__panel p {
  margin: 0.75rem 0 0;
  font-weight: 600;
}

.spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Login page */

.login-panel {
  max-width: 480px;
  margin: 0 auto;
}

.login-panel .form-inline input[type="text"] {
  flex: 1 1 8rem;
  min-width: 0;
}

/* GDPR / instructions embedded content */

.content-embed h1,
.content-embed h2,
.content-embed h3 {
  margin-top: 1.25rem;
}

.content-embed h1:first-child,
.content-embed h2:first-child {
  margin-top: 0;
}

/* Utility */

.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;
}

/* Desktop enhancements */

@media (min-width: 1024px) {
  .app-main {
    padding: 1.5rem 2rem 2rem;
  }

  .app-header__title {
    font-size: 1.125rem;
  }

  .brand-bar h1 {
    font-size: 1.75rem;
  }
}

/* Reduced motion */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
