/* Unidades Page Specific Styles - Mobile First Approach */
:root {
  --unit-card-bg: #ffffff;
  --unit-card-border: #e8e8e8;
  --unit-card-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  --unit-card-hover-shadow: 0 8px 25px rgba(193, 52, 118, 0.15);
  --unit-header-bg: linear-gradient(
    135deg,
    var(--primary-color),
    var(--primary-hover)
  );
}

/* Page Header */
.page-header {
  background: #fdf5f8;
  color: var(--primary-color);
  padding: 100px 0 40px 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.page-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: -50%;
  width: 200%;
  height: 100%;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(193, 52, 118, 0.1) 0%,
    transparent 70%
  );
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0%,
  100% {
    transform: translateX(0px);
  }
  50% {
    transform: translateX(20px);
  }
}

.page-header .container {
  position: relative;
  z-index: 1;
}

.page-header h1 {
  font-size: 28px;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 15px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Units Description */
.info-sections {
  padding: 60px 0;
  background: linear-gradient(135deg, #fff 0%, #fdf5f8 50%, #fff 100%);
}

.info-sections .container > div:first-child {
  text-align: center;
  max-width: 800px;
  margin: 0 auto 50px;
  padding: 0 15px;
}

.info-sections p {
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-color);
  margin: 0;
}

/* Units Grid */
.units-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 25px;
  padding: 0 15px;
  align-items: stretch;
}

/* Links inside units grid */
.units-grid a {
  text-decoration: none;
  height: 100%;
  display: block;
}

/* Unit Card */
.unit-card {
  background: var(--unit-card-bg);
  border: 2px solid var(--unit-card-border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--unit-card-shadow);
  transition: all 0.3s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 320px;
}

.unit-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--unit-card-hover-shadow);
  border-color: var(--primary-color);
}

/* Map Iframe */
.unit-card iframe {
  width: 100%;
  height: 200px;
  border: none;
  display: block;
  transition: filter 0.3s ease;
}

.unit-card:hover iframe {
  filter: brightness(1.05);
}

/* Unit Content */
.unit-content {
  padding: 20px;
  text-align: center;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.unit-content h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--title-color);
  margin-bottom: 8px;
  transition: color 0.3s ease;
}

.unit-card:hover .unit-content h3 {
  color: var(--primary-color);
}

.unit-content p {
  font-size: 14px;
  color: var(--text-color);
  line-height: 1.4;
  margin: 0;
}

/* Loading Animation for Maps */
.unit-card iframe {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Card Loading State */
.unit-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.8),
    transparent
  );
  transition: left 0.5s ease;
  z-index: 1;
}

.unit-card:hover::before {
  left: 100%;
}

/* Mobile Optimizations */
@media (max-width: 480px) {
  .page-header {
    padding: 80px 0 30px 0;
  }

  .page-header h1 {
    font-size: 24px;
  }

  .info-sections {
    padding: 40px 0;
  }

  .info-sections p {
    font-size: 14px;
  }

  .units-grid {
    gap: 20px;
    padding: 0 10px;
  }

  .unit-card {
    min-height: 300px;
  }

  .unit-content {
    padding: 15px;
  }

  .unit-content h3 {
    font-size: 16px;
  }

  .unit-content p {
    font-size: 13px;
  }
}

/* ===== CONVÊNIOS SECTION ===== */

/* Convênios Section */
.convenios-section {
  background: linear-gradient(135deg, #f8f9ff 0%, #fdf5f8 50%, #f8f9ff 100%);
  padding: 60px 0;
  position: relative;
  overflow: hidden;
}

.convenios-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: -50%;
  width: 200%;
  height: 100%;
  background: radial-gradient(
    circle at 70% 30%,
    rgba(193, 52, 118, 0.05) 0%,
    transparent 60%
  );
  animation: floatReverse 8s ease-in-out infinite;
}

@keyframes floatReverse {
  0%,
  100% {
    transform: translateX(0px) rotate(0deg);
  }
  50% {
    transform: translateX(-30px) rotate(1deg);
  }
}

/* Convênios Header */
.convenios-header {
  text-align: center;
  margin-bottom: 50px;
  position: relative;
  z-index: 2;
}

.convenios-header h2 {
  font-size: 28px;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 15px;
  position: relative;
}

.convenios-header h2::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--primary-color),
    var(--primary-hover)
  );
  border-radius: 2px;
}

.convenios-header p {
  font-size: 16px;
  color: var(--text-color);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Convênios Wrapper */
.convenios-wrapper {
  position: relative;
  z-index: 2;
}

/* Convênios Grid */
.convenios-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  padding: 0 15px;
}

/* Convênio Card */
.convenio-card {
  background: #fff;
  border: 2px solid #f0f0f0;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  position: relative;
  overflow: hidden;
}

.convenio-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(193, 52, 118, 0.1),
    transparent
  );
  transition: left 0.6s ease;
}

.convenio-card:hover::before {
  left: 100%;
}

.convenio-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary-color);
  box-shadow: 0 8px 20px rgba(193, 52, 118, 0.15);
}

.convenio-card img {
  max-width: 100%;
  max-height: 50px;
  object-fit: contain;
  transition: transform 0.3s ease;
  filter: grayscale(0.3);
}

.convenio-card:hover img {
  transform: scale(1.05);
  filter: grayscale(0);
}

/* Convenios Info */
.convenios-info {
  text-align: center;
  margin-top: 50px;
  padding: 30px 20px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 16px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(193, 52, 118, 0.1);
  position: relative;
  z-index: 2;
}

.convenios-info p {
  font-size: 16px;
  color: var(--text-color);
  margin-bottom: 20px;
}

.convenios-info strong {
  color: var(--primary-color);
}

/* Tablet */
@media (min-width: 600px) {
  .page-header h1 {
    font-size: 32px;
  }

  .units-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
  }

  .unit-card {
    min-height: 350px;
  }

  .unit-card iframe {
    height: 220px;
  }

  .unit-content {
    padding: 25px;
  }

  .unit-content h3 {
    font-size: 20px;
  }

  .unit-content p {
    font-size: 15px;
  }

  /* Convênios Tablet */
  .convenios-header h2 {
    font-size: 32px;
  }

  .convenios-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
  }

  .convenio-card {
    padding: 25px;
    min-height: 90px;
  }

  .convenio-card img {
    max-height: 55px;
  }
}

/* Desktop Small */
@media (min-width: 900px) {
  .page-header {
    padding: 120px 0 50px 0;
  }

  .page-header h1 {
    font-size: 36px;
  }

  .info-sections {
    padding: 80px 0;
  }

  .info-sections p {
    font-size: 18px;
  }

  .units-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 35px;
  }

  .unit-card {
    min-height: 370px;
  }

  .unit-card iframe {
    height: 240px;
  }

  /* Convênios Desktop Small */
  .convenios-section {
    padding: 80px 0;
  }

  .convenios-header h2 {
    font-size: 36px;
  }

  .convenios-header p {
    font-size: 18px;
  }

  .convenios-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
  }

  .convenio-card {
    padding: 30px 25px;
    min-height: 100px;
  }

  .convenio-card img {
    max-height: 60px;
  }

  .convenios-info {
    margin-top: 60px;
    padding: 40px 30px;
  }

  .convenios-info p {
    font-size: 18px;
  }
}

/* Desktop Large */
@media (min-width: 1200px) {
  .page-header h1 {
    font-size: 42px;
  }

  .units-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 40px;
  }

  .unit-card {
    min-height: 400px;
  }

  .unit-card iframe {
    height: 260px;
  }

  .unit-content {
    padding: 30px 25px;
  }

  .unit-content h3 {
    font-size: 22px;
    margin-bottom: 12px;
  }

  .unit-content p {
    font-size: 16px;
  }

  /* Convênios Desktop Large */
  .convenios-header h2 {
    font-size: 42px;
  }

  .convenios-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 35px;
  }

  .convenio-card {
    padding: 35px 30px;
    min-height: 110px;
  }

  .convenio-card img {
    max-height: 65px;
  }
}

/* Extra Large Screens */
@media (min-width: 1600px) {
  .unit-card iframe {
    height: 280px;
  }
}

/* Extra Large Screens */
@media (min-width: 1600px) {
  .units-grid {
    gap: 50px;
  }

  .unit-card {
    min-height: 420px;
  }

  .unit-card iframe {
    height: 280px;
  }

  /* Convênios Extra Large */
  .convenios-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 40px;
  }

  .convenio-card {
    padding: 40px 35px;
    min-height: 120px;
  }

  .convenio-card img {
    max-height: 70px;
  }
}

/* Fade in animation for cards */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.unit-card {
  animation: fadeInUp 0.6s ease forwards;
}

.unit-card:nth-child(1) {
  animation-delay: 0.1s;
}
.unit-card:nth-child(2) {
  animation-delay: 0.2s;
}
.unit-card:nth-child(3) {
  animation-delay: 0.3s;
}
.unit-card:nth-child(4) {
  animation-delay: 0.4s;
}
.unit-card:nth-child(5) {
  animation-delay: 0.5s;
}
.unit-card:nth-child(6) {
  animation-delay: 0.6s;
}
.unit-card:nth-child(7) {
  animation-delay: 0.7s;
}
.unit-card:nth-child(8) {
  animation-delay: 0.8s;
}

/* Convênio Cards Animation */
.convenio-card {
  animation: fadeInUp 0.4s ease forwards;
  opacity: 0;
}

.convenio-card:nth-child(1) {
  animation-delay: 0.1s;
}
.convenio-card:nth-child(2) {
  animation-delay: 0.15s;
}
.convenio-card:nth-child(3) {
  animation-delay: 0.2s;
}
.convenio-card:nth-child(4) {
  animation-delay: 0.25s;
}
.convenio-card:nth-child(5) {
  animation-delay: 0.3s;
}
.convenio-card:nth-child(6) {
  animation-delay: 0.35s;
}
.convenio-card:nth-child(7) {
  animation-delay: 0.4s;
}
.convenio-card:nth-child(8) {
  animation-delay: 0.45s;
}
.convenio-card:nth-child(9) {
  animation-delay: 0.5s;
}
.convenio-card:nth-child(10) {
  animation-delay: 0.55s;
}
.convenio-card:nth-child(11) {
  animation-delay: 0.6s;
}
.convenio-card:nth-child(12) {
  animation-delay: 0.65s;
}
.convenio-card:nth-child(13) {
  animation-delay: 0.7s;
}
.convenio-card:nth-child(14) {
  animation-delay: 0.75s;
}
.convenio-card:nth-child(15) {
  animation-delay: 0.8s;
}
.convenio-card:nth-child(16) {
  animation-delay: 0.85s;
}
.convenio-card:nth-child(17) {
  animation-delay: 0.9s;
}
.convenio-card:nth-child(18) {
  animation-delay: 0.95s;
}
.convenio-card:nth-child(19) {
  animation-delay: 1s;
}
.convenio-card:nth-child(20) {
  animation-delay: 1.05s;
}
.convenio-card:nth-child(n + 21) {
  animation-delay: 1.1s;
}

/* Focus states for accessibility */
.unit-card:focus-within {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.unit-card iframe:focus {
  outline: none;
}

.convenio-card:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Print styles */
@media print {
  .unit-card iframe {
    display: none;
  }

  .unit-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .unit-content::after {
    content: " - Visite nosso site para ver a localização no mapa";
    font-style: italic;
    color: #666;
  }

  .convenios-section {
    background: #fff !important;
  }

  .convenios-section::before {
    display: none;
  }

  .convenio-card {
    break-inside: avoid;
    page-break-inside: avoid;
    border: 1px solid #ccc;
    background: #fff;
  }

  .convenios-info {
    background: #f9f9f9;
    border: 1px solid #ccc;
  }
}
