/* Customer Document Management - Mobile-first, React-like UI */

:root {
  --app-radius: 0.75rem;
  --app-radius-lg: 1rem;
  --app-shadow: 0 2px 12px rgba(0,0,0,.08);
  --app-shadow-hover: 0 8px 24px rgba(0,0,0,.12);
  --touch-min-height: 44px;
}

/* Auth page */
.auth-page { background: linear-gradient(135deg, #1a1d29 0%, #2d3142 100%); }
.auth-wrapper { min-height: 100vh; }
.auth-card { max-width: 400px; width: 100%; }
.auth-logo { max-height: 80px; width: auto; }

/* Touch-friendly targets (mobile) */
.touch-target { min-height: var(--touch-min-height); }
.btn.touch-target { padding: 0.6rem 1rem; }
.form-control-lg { min-height: var(--touch-min-height); }

/* Cards - rounded, soft shadow */
.app-card {
  border-radius: var(--app-radius-lg);
  box-shadow: var(--app-shadow);
  border: 0;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.app-card:hover { box-shadow: var(--app-shadow-hover); }
@media (hover: none) {
  .app-card:hover { box-shadow: var(--app-shadow); }
}

/* Buttons */
.btn { border-radius: var(--app-radius); transition: transform 0.15s ease, box-shadow 0.15s ease; }
.btn:active { transform: scale(0.98); }
.btn i { pointer-events: none; }

/* Navbar - sticky */
.app-navbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.navbar-brand { font-size: 1.1rem; }
.navbar-brand img { height: 36px; width: auto; }

/* Bottom spacing for mobile thumbs */
.app-container { padding-bottom: env(safe-area-inset-bottom, 2rem); }
.app-container .mb-footer { margin-bottom: 2rem; }

/* Gallery grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}
.gallery-item {
  aspect-ratio: 1;
  border-radius: var(--app-radius);
  overflow: hidden;
  background: #f0f0f0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--app-shadow);
  transition: box-shadow 0.2s ease, transform 0.15s ease;
}
.gallery-item:hover { box-shadow: var(--app-shadow-hover); transform: scale(1.02); }
.gallery-item:active { transform: scale(0.98); }
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  flex: 1;
  min-height: 0;
  min-width: 0;
}
.gallery-item .gallery-pdf {
  color: #dc3545;
  font-size: 2.5rem;
  padding: 0.5rem;
}
.gallery-item .gallery-label { font-size: 0.7rem; color: #666; margin-top: 0.25rem; }

/* Document gallery (view page) - list of uploaded files */
.document-gallery { margin-bottom: 1rem; }

/* Modal viewer */
.modal-content { border-radius: var(--app-radius-lg); border: 0; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-body img { max-width: 100%; height: auto; max-height: 80vh; object-fit: contain; }
.modal-body .pdf-embed { width: 100%; min-height: 70vh; border: 0; }

/* File preview (add/edit customer) */
.preview-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.preview-item {
  position: relative;
  width: 80px;
  flex-shrink: 0;
  border-radius: var(--app-radius);
  overflow: hidden;
  background: #f5f5f5;
  box-shadow: var(--app-shadow);
}
.preview-item img { width: 100%; height: 80px; object-fit: cover; display: block; }
.preview-item .preview-pdf {
  width: 100%; height: 80px; display: flex; align-items: center; justify-content: center;
  background: #fff; color: #dc3545; font-size: 1.5rem;
}
.preview-item .preview-remove {
  position: absolute; top: 2px; right: 2px;
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(0,0,0,.7); color: #fff; border: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; line-height: 1; cursor: pointer;
  padding: 0; min-width: 24px;
}
.preview-item .preview-remove:hover { background: #dc3545; }
.preview-item .preview-name { font-size: 0.65rem; padding: 2px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* Forms */
.form-control, .form-select { border-radius: var(--app-radius); }
textarea.form-control { min-height: 100px; }

/* Customer list (cards instead of table on small screens) */
.customer-card {
  border-radius: var(--app-radius);
  transition: box-shadow 0.2s ease;
}
.customer-card:hover { box-shadow: var(--app-shadow-hover); }
.customer-card .action-btns .btn { padding: 0.4rem 0.6rem; }

/* Search */
.search-wrap .form-control { border-radius: var(--app-radius); }

/* No tiny text - minimum readable */
body { font-size: 1rem; }
.small { font-size: 0.9rem; }

/* Mobile responsive - all pages */
html { overflow-x: hidden; }
body { overflow-x: hidden; max-width: 100vw; }
.container { max-width: 100%; }
.app-container .row { margin-left: 0; margin-right: 0; }
.customer-card .action-btns .btn { min-width: 44px; min-height: 44px; }
.navbar-brand { font-size: clamp(0.9rem, 4vw, 1.1rem); }
.modal-body img { max-height: 75vh; }
@media (max-width: 576px) {
  .gallery-grid,
  .document-gallery { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
  .gallery-item .gallery-pdf { font-size: 2rem; }
  .preview-item { width: 72px; }
  .preview-item img, .preview-item .preview-pdf { height: 72px; }
}
@media (max-width: 380px) {
  .action-btns .btn { padding: 0.35rem 0.5rem; }
  .navbar .btn { padding: 0.4rem 0.6rem; font-size: 0.9rem; }
}
