body {
  font-family: roboto, Arial, sans-serif;
  margin: 2em;
  color: #3d3d3d;
  --mdc-theme-primary: #007f8b;
  --mdc-theme-on-primary: #f1f3f4;
  background-color: #f9f9f9;
}

h1 {
  color: #007f8b;
  text-align: center;
  margin-bottom: 1.5em;
}

h2 {
  clear: both;
  color: #006069;
  border-bottom: 1px solid #e0e0e0;
  padding-bottom: 0.3em;
  margin-top: 0;
}

video {
  clear: both;
  display: block;
}

section {
  opacity: 1;
  transition: opacity 500ms ease-in-out;
  max-width: 1200px;
  margin: 0 auto;
}

.mdc-button.mdc-button--raised.removed {
  display: none;
}

.removed {
  display: none;
}

.invisible {
  display: none;
}

.section-container {
  max-width: 840px;
  margin: 0 auto 40px;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  overflow: hidden;
  padding: 20px;
}

.webcam-container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  position: relative;
}

/* Botão da webcam */
#webcamButton {
  display: block;
  margin: 0 auto 20px;
}

.upload-section {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

.upload-container {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.file-input {
  width: 0.1px;
  height: 0.1px;
  opacity: 0;
  overflow: hidden;
  position: absolute;
  z-index: -1;
}

.upload-button {
  cursor: pointer;
  padding: 10px 20px;
  display: inline-block;
}

.preview-container {
  position: relative;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  background-color: #e0e0e0;
  margin-bottom: 20px;
  min-height: 300px;
  max-height: 600px;
}

.preview-container img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.preview-container canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.uploadPreview {
  margin-top: 20px;
}

.videoContainer {
  position: relative;
  width: 100%;
  margin: 10px 0;
  border-radius: 8px;
  overflow: hidden;
  background-color: #e0e0e0;
  height: 480px;
  clear: both;
}

.videoContainer video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: none;
}

.videoContainer canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: none;
}

.segmentControls {
  margin-top: 20px;
  padding: 15px;
  background-color: #f1f3f4;
  border-radius: 5px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.webcam-controls {
  margin-top: 20px;
}

.segmentControls #processImageButton {
  display: block;
  margin: 15px auto 5px;
  width: 100%;
  max-width: 250px;
}

.segmentControl {
  margin: 10px 0;
  display: flex;
  align-items: center;
}

label {
  margin-left: 10px;
  cursor: pointer;
}

input[type="checkbox"] {
  cursor: pointer;
  width: 18px;
  height: 18px;
}

/* Clearfix for floating elements */
section::after {
  content: "";
  display: table;
  clear: both;
}

/* Responsive adjustments */
@media (max-width: 768px) {  
  body {
    margin: 1em;
  }
}

/* Estilos para estatísticas de elementos */
.element-stats-container {
  margin: 10px 0 20px;
  padding: 10px;
  background-color: white;
  border-radius: 5px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.element-stats-container h3 {
  margin: 0 0 10px;
  font-size: 16px;
  color: #007f8b;
}

.element-stat {
  display: flex;
  align-items: center;
  margin: 5px 0;
  font-size: 14px;
  background-color: white;
  padding: 3px 5px;
  border-radius: 3px;
}

.color-indicator {
  display: block;
  width: 12px;
  height: 12px;
  min-width: 12px;
  min-height: 12px;
  max-width: 12px;
  max-height: 12px;
  margin-right: 10px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.1);
  flex-shrink: 0;
  flex-grow: 0;
  box-sizing: border-box;
}

.analysis-result {
  font-size: 15px;
}

.images-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 20px;
  flex-direction: row;
  justify-content: flex-start;
}

.image-container {
  position: relative;
  width: calc(20% - 12px);
  min-height: 150px;
  border-radius: 8px;
  overflow: visible;
  background-color: #e0e0e0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  margin-bottom: 150px;
}

.image-container img,
.image-container canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.image-label {
  position: absolute;
  bottom: -25px;
  left: 0;
  width: 100%;
  text-align: center;
  font-weight: bold;
  padding: 3px 0;
  border-radius: 0 0 8px 8px;
  font-size: 12px;
}

.bald-label {
  background-color: #4CAF50; /* Verde */
  color: white;
}

.not-bald-label {
  background-color: #f44336; /* Vermelho */
  color: white;
}

.image-stats {
  position: absolute;
  top: calc(100% + 30px);
  left: 0;
  width: 100%;
  background-color: #f5f5f5;
  border-radius: 5px;
  padding: 6px;
  font-size: 11px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  border: 1px solid #007f8b;
  z-index: 10;
}

.stat-item {
  margin: 2px 0;
  line-height: 1.2;
  background-color: white;
  padding: 2px 5px;
  border-radius: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
}

.stat-item .color-indicator {
  display: block;
  width: 12px;
  height: 12px;
  min-width: 12px;
  min-height: 12px;
  max-width: 12px;
  max-height: 12px;
  margin-right: 5px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.1);
  flex-shrink: 0;
  flex-grow: 0;
  box-sizing: border-box;
}

.stat-item span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-grow: 1;
}

.stat-item strong {
  color: #007f8b;
}

/* Estilos responsivos para o grid de imagens */
@media (max-width: 1200px) {
  .image-container {
    width: calc(25% - 12px);
    margin-bottom: 120px;
  }
}

@media (max-width: 900px) {
  .image-container {
    width: calc(33.333% - 12px);
    margin-bottom: 120px;
  }
}

@media (max-width: 600px) {
  .image-container {
    width: calc(50% - 12px);
    margin-bottom: 120px;
  }
}

@media (max-width: 480px) {
  .image-container {
    width: 100%;
    margin-bottom: 120px;
  }
}

/* Modal styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  justify-content: center;
  align-items: center;
}

.modal-content {
  background-color: white;
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  text-align: center;
  max-width: 500px;
  width: 90%;
}

/* Loading modal */
.loading-modal .spinner {
  border: 5px solid #f3f3f3;
  border-top: 5px solid #007f8b;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin: 0 auto 15px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-modal p {
  font-size: 18px;
  margin: 10px 0 0;
  color: #333;
}

/* Webcam modal */
.webcam-modal .modal-content {
  min-height: 120px;
}

#webcam-message {
  margin-bottom: 20px;
  font-size: 16px;
  line-height: 1.5;
}

.success-message {
  color: #2e7d32;
}

.error-message {
  color: #c62828;
}

#close-webcam-modal {
  background-color: #007f8b;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  transition: background-color 0.2s;
}

#close-webcam-modal:hover {
  background-color: #006069;
} 