/* Custom styles for Inspection Report App */

/* Smooth page transitions */
.view-transition {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.view-hidden {
  display: none;
  opacity: 0;
  transform: translateY(10px);
}

.view-visible {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* Photo grid */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.5rem;
}

.photo-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.photo-grid img:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Photo item container */
.photo-item {
  position: relative;
  border-radius: 0.5rem;
  overflow: hidden;
}

.photo-item .delete-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.9);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 10;
}

.photo-item:hover .delete-btn {
  opacity: 1;
}

/* Always show on mobile (no hover) */
@media (hover: none) {
  .photo-item .delete-btn {
    opacity: 1;
  }
}

/* Voice recording pulse animation */
@keyframes pulse-ring {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 12px rgba(239, 68, 68, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

.voice-active {
  animation: pulse-ring 1.5s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
  background-color: #ef4444 !important;
}

/* Map container */
#map-container {
  border-radius: 0.75rem;
  overflow: hidden;
  z-index: 1;
}

/* Leaflet map fixes for dark mode */
.dark .leaflet-tile-pane {
  filter: brightness(0.8) contrast(1.1) saturate(0.8);
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 0.75rem 1.5rem;
  border-radius: 0.75rem;
  color: white;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast-success {
  background: linear-gradient(135deg, #059669, #10b981);
}

.toast-error {
  background: linear-gradient(135deg, #dc2626, #ef4444);
}

.toast-info {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.4);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.6);
}

/* Modal overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: white;
  border-radius: 1rem;
  padding: 1.5rem;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

.dark .modal-content {
  background: #1e293b;
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

/* Report card hover effect */
.report-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.report-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Input focus styles */
input:focus, textarea:focus, select:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

/* Camera video preview */
#camera-preview {
  width: 100%;
  max-height: 60vh;
  object-fit: cover;
  border-radius: 0.75rem;
}

/* Loading spinner */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

/* Bottom navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding-bottom: env(safe-area-inset-bottom);
}

/* Hide file input */
.hidden-input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

/* Prevent body scroll when modal is open */
body.modal-open {
  overflow: hidden;
}

/* PDF generation hidden area */
#pdf-render-area {
  position: fixed;
  top: -9999px;
  left: -9999px;
  width: 595px; /* A4 width at 72 DPI */
  z-index: -1;
}

/* Smooth scroll */
html {
  scroll-behavior: smooth;
}

/* Safe area padding for notched phones */
.safe-bottom {
  padding-bottom: calc(4rem + env(safe-area-inset-bottom));
}
