:root {
  --brand: #E60023;
  --muted: #f4f4f4;
  --dark: #111;
}

* {
  box-sizing: border-box
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #fff;
  color: #111;
  min-height: 100vh
}

/* Header */
.header {
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  background: url('../img/prueba_2.png') center/cover no-repeat;
  color: #fff;
}

.logo {
  margin: auto;
  font-weight: 700;
  font-size: 20px
}

.hamburger {
  font-size: 28px;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  transition: transform 0.2s
}

.hamburger:hover {
  transform: scale(1.1)
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--dark);
  color: #fff;
  position: fixed;
  top: 0;
  left: -260px;
  height: 100%;
  padding-top: 80px;
  transition: 0.25s;
  z-index: 2000;
}

.sidebar.open {
  left: 0
}

.sidebar a {
  display: block;
  color: #eee;
  padding: 14px 18px;
  text-decoration: none;
  border-bottom: 1px solid #222;
  transition: background 0.3s
}

.sidebar a:hover {
  background: var(--brand)
}

/* Overlay */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  z-index: 1500
}

.overlay.show {
  display: block
}

/* Hero */
.hero {
  height: 420px;
  background: url('../background.jpg') center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .35)
}

.hero-content {
  position: relative;
  z-index: 1;
  color: #fff;
  text-align: center;
  padding: 20px
}

.btn {
  display: inline-block;
  padding: 10px 18px;
  background: var(--brand);
  color: #fff;
  border-radius: 6px;
  text-decoration: none;
  margin: 8px;
  cursor: pointer;
  transition: background 0.3s, transform 0.2s
}

.btn:hover {
  background: #cc001f;
  transform: translateY(-2px)
}

/* Carousel */
.carousel-section {
  padding: 40px 20px;
  text-align: center;
  max-width: 1400px;
  margin: 0 auto
}

.carousel-wrapper {
  position: relative;
  max-width: 1200px;
  margin: 0 auto
}

.carousel-container {
  display: flex;
  gap: 16px;
  overflow-x: hidden;
  padding: 12px 0;
  scroll-behavior: smooth;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.carousel-container::-webkit-scrollbar {
  display: none;
}

.carousel-card {
  width: 260px;
  flex-shrink: 0;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #ddd;
  overflow: hidden;
  transition: transform 0.3s, box-shadow 0.3s;
  display: flex;
  flex-direction: column;
}

.carousel-card:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3)
}

.carousel-card img {
  width: 100%;
  height: 280px;
  object-fit: cover;
  background: #f1f1f1;
  aspect-ratio: 9/16;
  flex-shrink: 0;
}

.carousel-card .info {
  padding: 20px 24px;
  text-align: left;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.carousel-card .info h3 {
  margin: 0 0 8px 0;
  font-size: 17px;
  font-weight: 600;
}

.carousel-card .info p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}

.carousel-card .info p strong {
  color: #111;
  font-weight: 600;
}

.carousel-card .info .desc {
  margin-top: 8px;
  font-size: 13px;
  color: #888;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: var(--brand);
  color: #fff;
  border: none;
  padding: 12px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  transition: background 0.3s, transform 0.2s
}

.carousel-btn.left {
  left: -20px
}

.carousel-btn.right {
  right: -20px
}

.carousel-btn:hover {
  background: #b8001c;
  transform: scale(1.1)
}

/* Grid */
.grid-section {
  padding: 40px 20px;
  max-width: 1400px;
  margin: 0 auto
}

.grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr))
}

/* Profile Cards - Premium Design */
.profile-card,
.grid-card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.profile-card:hover,
.grid-card:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.profile-card img,
.grid-card img {
  width: 100%;
  height: 280px;
  object-fit: cover;
  background: #f1f1f1;
  transition: transform 0.3s ease;
  aspect-ratio: 9/16;
}

.profile-card:hover img,
.grid-card:hover img {
  transform: scale(1.05);
}

.profile-card .info,
.grid-card .info {
  padding: 20px 24px;
}

.profile-card h3,
.grid-card h3 {
  margin: 0 0 8px 0;
  font-size: 17px;
  font-weight: 600;
  color: #111;
}

.profile-card p,
.grid-card p {
  margin: 4px 0;
  font-size: 14px;
  color: #666;
  line-height: 1.5;
}

.profile-card .desc,
.grid-card .desc {
  margin-top: 8px;
  font-size: 14px;
  color: #888;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Footer */
.footer {
  text-align: center;
  padding: 20px;
  color: #666
}

/* Admin */
.admin-main {
  padding: 30px
}

.admin-panel {
  max-width: 1000px;
  margin: 0 auto
}

.admin-actions {
  margin: 12px 0;
  display: flex;
  gap: 12px;
}

/* Estilos hover para botones mejorados */
#btnRefresh:hover,
#btnNew:hover,
#btnRefreshCiudades:hover,
#btnNewCiudad:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

/* Hover effect para botón helper de optimización de imágenes */
.admin-actions a:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(17, 153, 142, 0.4) !important;
}

#btnRefresh:active,
#btnNew:active,
#btnRefreshCiudades:active,
#btnNewCiudad:active {
  transform: translateY(0);
}

.profile-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid #eee;
  margin-bottom: 8px
}

.profile-row img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 6px
}

.small-btn {
  padding: 8px 10px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.3s, transform 0.2s
}

.small-btn:hover {
  background: #b8001c;
  transform: translateY(-2px)
}

.form-card {
  padding: 12px;
  border: 1px solid #ddd;
  background: #fff;
  margin-top: 12px
}

.form-card label {
  display: block;
  margin: 8px 0 4px
}

.form-card input[type="text"],
.form-card input[type="number"],
.form-card input[type="password"],
.form-card textarea,
.form-card select {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 6px
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
  display: none;
  opacity: 0;
  pointer-events: none;
}

.modal-content {
  background: #fff;
  padding: 24px;
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.close-modal {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: #666;
}

.close-modal:hover {
  color: #000;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* Pantallas extra grandes (1400px+) */
@media (min-width: 1400px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
  }

  .grid-section,
  .carousel-section {
    padding: 50px 40px;
  }
}

/* Tablets y pantallas medianas (768px - 1399px) */
@media (min-width: 768px) and (max-width: 1399px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
  }

  .grid-section,
  .carousel-section {
    padding: 40px 24px;
  }
}

/* Móviles grandes (481px - 767px) */
@media (max-width: 767px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
  }

  .grid-section,
  .carousel-section {
    padding: 30px 16px;
  }

  .profile-card img,
  .grid-card img,
  .carousel-card img {
    height: 240px;
  }

  .hero {
    height: 320px;
  }

  .carousel-btn.left {
    left: 6px
  }

  .carousel-btn.right {
    right: 6px
  }
}

/* Móviles pequeños (hasta 480px) */
@media (max-width: 480px) {
  .grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .profile-card img,
  .grid-card img,
  .carousel-card img {
    height: 220px;
  }

  .carousel-card {
    width: 200px;
  }

  .profile-card .info,
  .grid-card .info,
  .carousel-card .info {
    padding: 16px 18px;
  }

  .hero {
    height: 280px;
  }

  .hero h1 {
    font-size: 28px;
  }
}

/* ========================================
   FOOTER STYLES
   ======================================== */

.footer {
  background: linear-gradient(135deg, #e60023 0%, #c9001f 100%);
  color: white;
  padding: 32px 24px 16px;
  margin-top: 60px;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 32px;
  margin-bottom: 20px;
}

.footer-section h3 {
  font-size: 24px;
  margin: 0 0 12px 0;
  font-weight: 700;
}

.footer-section h4 {
  font-size: 18px;
  margin: 0 0 16px 0;
  font-weight: 600;
}

.footer-section p {
  margin: 0;
  opacity: 0.9;
  font-size: 14px;
}

.footer-links,
.footer-contact {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li,
.footer-contact li {
  margin-bottom: 12px;
}

.footer-links a,
.footer-contact a {
  color: white;
  text-decoration: none;
  opacity: 0.9;
  transition: opacity 0.3s, transform 0.3s;
  display: inline-block;
}

.footer-links a:hover,
.footer-contact a:hover {
  opacity: 1;
  transform: translateX(5px);
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  padding-top: 16px;
  text-align: center;
}

.footer-bottom p {
  margin: 0;
  font-size: 14px;
  opacity: 0.8;
}

/* Footer Responsive */
@media (max-width: 768px) {
  .footer {
    padding: 24px 16px 12px;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .footer-section {
    text-align: center;
  }

  .footer-links a:hover,
  .footer-contact a:hover {
    transform: translateX(0);
  }
}

/* ========================================
   PAGINATION STYLES
   ======================================== */

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 40px 0 20px;
  flex-wrap: wrap;
}

.page-btn {
  min-width: 44px;
  height: 44px;
  padding: 8px 12px;
  background: white;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  color: #333;
  cursor: pointer;
  transition: all 0.3s;
}

.page-btn:hover {
  border-color: #e60023;
  color: #e60023;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(230, 0, 35, 0.2);
}

.page-btn.active {
  background: linear-gradient(135deg, #e60023 0%, #c9001f 100%);
  border-color: #e60023;
  color: white;
  cursor: default;
  box-shadow: 0 4px 12px rgba(230, 0, 35, 0.3);
}

.page-btn.active:hover {
  transform: translateY(0);
}

/* Pagination Responsive */
@media (max-width: 768px) {
  .page-btn {
    min-width: 40px;
    height: 40px;
    font-size: 14px;
    padding: 6px 10px;
  }

  .pagination {
    gap: 6px;
    margin: 30px 0 15px;
  }
}