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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: #f5f7fa;
  color: #2c3e50;
  min-height: 100vh;
}

header {
  background: linear-gradient(135deg, #2c7be5, #1a5fbb);
  color: white;
  padding: 16px 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header h1 { font-size: 20px; }
header p { font-size: 13px; opacity: 0.9; margin-top: 4px; }

#map, #admin-map {
  width: 100%;
  height: calc(100vh - 200px);
  min-height: 400px;
}

.action-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  padding: 12px;
  display: flex;
  gap: 8px;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
  z-index: 1000;
}

.btn {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  transition: all 0.2s;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary { background: #2c7be5; color: white; }
.btn-secondary { background: #6c757d; color: white; }
.btn-link { background: transparent; color: #2c7be5; flex: 0 0 auto; padding: 12px 16px; }
.btn-danger { background: #dc3545; color: white; }
.btn-sm { padding: 6px 12px; font-size: 13px; flex: 0 0 auto; }

.btn:hover:not(:disabled) { opacity: 0.9; }

.marker-pin {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: bold; font-size: 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.marker-pin.pending { background: #dc3545; }
.marker-pin.processing { background: #ffc107; color: #333; }
.marker-pin.completed { background: #28a745; }

.popup-content { max-width: 200px; }
.popup-content img { width: 100%; border-radius: 4px; margin-bottom: 6px; }

.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  padding: 12px 24px; border-radius: 8px; z-index: 10000;
  font-size: 14px; box-shadow: 0 2px 12px rgba(0,0,0,0.2);
  max-width: 90%;
  text-align: center;
}
.toast { background: white; border: 1px solid #ddd; }
.toast-success { background: #28a745; color: white; border-color: #28a745; }
.toast-error { background: #dc3545; color: white; border-color: #dc3545; }
.hidden { display: none !important; }

/* v8: Modal de vista previa */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: white;
  border-radius: 12px;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.preview-image-wrap {
  width: 100%;
  background: #f0f0f0;
  overflow: hidden;
  border-radius: 12px 12px 0 0;
}

.preview-image-wrap img {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
  display: block;
}

.preview-info {
  padding: 16px;
}

.preview-gps {
  background: #e8f4fd;
  border: 1px solid #2c7be5;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 14px;
  color: #1a5fbb;
  word-break: break-all;
}

.preview-gps.no-gps {
  background: #fde8e8;
  border-color: #dc3545;
  color: #dc3545;
}

.preview-gps.loading {
  background: #f0f0f0;
  border-color: #999;
  color: #666;
}

.gps-label {
  font-weight: 600;
  margin-right: 4px;
}

.preview-warning {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 12px;
  font-size: 13px;
  color: #856404;
  line-height: 1.5;
}

#preview-description, #preview-reporter {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}

#preview-description:focus, #preview-reporter:focus {
  outline: none;
  border-color: #2c7be5;
}

#preview-description {
  resize: vertical;
  min-height: 60px;
}

.preview-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.preview-actions .btn {
  flex: 1;
}

/* Admin */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #2c7be5, #1a5fbb);
}
.login-box {
  background: white; padding: 32px; border-radius: 12px;
  width: 90%; max-width: 360px; box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.login-box h2 { margin-bottom: 20px; text-align: center; }
.login-box input {
  width: 100%; padding: 12px; margin-bottom: 12px;
  border: 1px solid #ddd; border-radius: 6px; font-size: 15px;
}
.login-box .error { color: #dc3545; font-size: 13px; margin-top: 8px; text-align: center; }

.tabs {
  display: flex; background: white; border-bottom: 1px solid #eee;
  position: sticky; top: 0; z-index: 100;
}
.tab {
  flex: 1; padding: 14px; border: none; background: transparent;
  font-size: 14px; cursor: pointer; color: #666;
  border-bottom: 3px solid transparent;
}
.tab.active { color: #2c7be5; border-bottom-color: #2c7be5; font-weight: 500; }

.tab-content { padding: 12px; }

.reports-list { display: flex; flex-direction: column; gap: 12px; }
.report-card {
  background: white; border-radius: 8px; padding: 12px;
  display: flex; gap: 12px; box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  border-left: 4px solid #ddd;
}
.report-card.status-pending { border-left-color: #dc3545; }
.report-card.status-processing { border-left-color: #ffc107; }
.report-card.status-completed { border-left-color: #28a745; }
.report-img {
  width: 100px; height: 100px; object-fit: cover;
  border-radius: 6px; flex-shrink: 0; cursor: pointer;
}
.report-info { flex: 1; font-size: 13px; line-height: 1.7; }
.report-info select { padding: 4px; border-radius: 4px; border: 1px solid #ddd; }
.empty { text-align: center; color: #999; padding: 40px; }

.stat-cards {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 20px;
}
.stat-card {
  background: white; padding: 16px; border-radius: 8px; text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.stat-card h3 { font-size: 28px; color: #2c7be5; }
.stat-card.pending h3 { color: #dc3545; }
.stat-card.processing h3 { color: #ffc107; }
.stat-card.completed h3 { color: #28a745; }
.stat-card p { font-size: 13px; color: #666; margin-top: 4px; }

.stat-table {
  width: 100%; background: white; border-radius: 8px;
  border-collapse: collapse; overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.stat-table th, .stat-table td { padding: 10px; text-align: left; border-bottom: 1px solid #eee; font-size: 14px; }
.stat-table th { background: #f8f9fa; font-weight: 500; }

@media (max-width: 600px) {
  header h1 { font-size: 17px; }
  .btn { font-size: 13px; padding: 10px; }
  .report-card { flex-direction: column; }
  .report-img { width: 100%; height: 180px; }
  .modal { padding: 8px; }
  .preview-info { padding: 12px; }
}
