/* Estilos base iOS */
:root {
  --primary-color: #007AFF;
  --secondary-color: #5AC8FA;
  --tertiary-color: #34C759;
  --background-color: #F2F2F7;
  --card-color: #FFFFFF;
  --text-primary: #000000;
  --text-secondary: #8E8E93;
  --border-radius: 16px;
  --shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* Reset e estilos gerais */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  background-color: var(--background-color);
  color: var(--text-primary);
  transition: all 0.3s ease;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

/* Container principal */
.container {
  max-width: 100%;
  padding: 16px;
  margin: 0 auto;
}

/* Cabeçalho */
.app-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 24px;
}

.app-title {
  font-size: 34px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.app-subtitle {
  font-size: 17px;
  color: var(--text-secondary);
  font-weight: 400;
}

/* Seletor de data */
.date-display {
  background-color: var(--card-color);
  border-radius: var(--border-radius);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.date-display::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 122, 255, 0.2), transparent);
}

.nav-button {
  background-color: transparent;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-color);
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-appearance: none;
}

.nav-button:active {
  background-color: rgba(0, 122, 255, 0.1);
  transform: scale(0.95);
}

.current-date-container {
  flex: 1;
  text-align: center;
}

.current-date {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Gráfico de marés */
.tide-container {
  background-color: var(--card-color);
  border-radius: var(--border-radius);
  margin-bottom: 16px;
  overflow: hidden;
}

.tide-graph-container {
  position: relative;
  height: 220px;
  margin-bottom: 24px;
}

.tide-graph {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.wave-path {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 4px 10px rgba(0, 122, 255, 0.2));
}

.wave-area {
  fill-opacity: 0.2;
}

.tide-point {
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.3s ease;
}

.tide-point:hover, .tide-point-active {
  transform: scale(1.5);
  filter: drop-shadow(0 0 8px rgba(0, 122, 255, 0.6));
}

/* Eixos do gráfico */
.time-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}

.level-axis {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  padding-right: 8px;
}

/* Tooltip */
.tide-tooltip {
  position: absolute;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: white;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  transform: translate(-50%, -100%) scale(0.9);
  margin-top: -10px;
  z-index: 10;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.tide-tooltip.visible {
  opacity: 1;
  transform: translate(-50%, -100%) scale(1);
}

.tide-tooltip:after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transform: rotate(45deg) translateX(-50%);
}

/* Indicadores de dia */
.day-indicator {
  display: flex;
  justify-content: center;
  margin: 16px 0;
  gap: 8px;
}

.day-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: rgba(0, 122, 255, 0.3);
  transition: all 0.3s ease;
}

.day-dot.active {
  background-color: var(--primary-color);
  transform: scale(1.3);
}

/* Cartões de informação de maré */
.tide-info {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.tide-card {
  background-color: var(--card-color);
  border-radius: var(--border-radius);
  padding: 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-left: none;
  position: relative;
  overflow: visible;
}

.tide-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  transition: all 0.3s ease;
}

.tide-card.high::before {
  background: linear-gradient(to bottom, var(--primary-color), var(--secondary-color));
}

.tide-card.low::before {
  background: linear-gradient(to bottom, var(--secondary-color), var(--tertiary-color));
}

.tide-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.tide-card .tide-type {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  font-weight: 500;
}

.tide-card .tide-level {
  font-size: 18px !important;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.tide-card .tide-time {
  font-size: 17px;
  font-weight: 600;
  color: var(--primary-color);
}

/* Instruções */
.instructions {
  background-color: rgba(0, 122, 255, 0.1);
  border-radius: var(--border-radius);
  padding: 16px;
  margin-top: 24px;
}

.instructions h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 8px;
}

.instructions ul {
  list-style-type: none;
  padding-left: 0;
}

.instructions li {
  position: relative;
  padding-left: 24px;
  margin-bottom: 8px;
  color: var(--text-primary);
  font-size: 15px;
}

.instructions li:before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23007AFF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

/* Animação de swipe */
.swipe-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(0, 122, 255, 0.3);
  font-size: 24px;
  pointer-events: none;
  animation: swipeHint 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  opacity: 0;
}

@keyframes swipeHint {
  0% { opacity: 0; transform: translate(-70%, -50%); }
  50% { opacity: 1; transform: translate(-50%, -50%); }
  100% { opacity: 0; transform: translate(-30%, -50%); }
}

/* Responsividade */
@media (max-width: 768px) {
  .tide-graph-container {
    height: 180px;
  }
  
  .tide-info {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .level-axis, .time-axis {
    font-size: 11px;
  }
  
  .app-title {
    font-size: 28px;
  }
  
  .current-date {
    font-size: 18px;
  }
  
  .tide-container {
    padding: 16px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 12px;
  }
  
  .tide-graph-container {
    height: 160px;
    margin-bottom: 16px;
  }
  
  .tide-info {
    grid-template-columns: 1fr;
  }
  
  .app-title {
    font-size: 24px;
  }
  
  .app-subtitle {
    font-size: 15px;
  }
  
  .tide-container {
    padding: 16px 12px;
  }
  
  .date-display {
    padding: 12px;
  }
  
  .instructions {
    padding: 12px;
  }
  
  .instructions li {
    font-size: 14px;
  }
  
  .tide-card {
    padding: 14px;
  }
  
  .tide-card .tide-level {
    font-size: 22px;
  }
  
  .tide-card .tide-time {
    font-size: 16px;
  }
}

.tide-card.baixo .tide-level,
.tide-card.baixo .tide-time {
  color: #007AFF;
}
.tide-card.alto .tide-level,
.tide-card.alto .tide-time {
  color: #FF3B30;
}