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

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow-x: auto;
  overflow-y: auto;
}

/* Prevenir overflow horizontal en zoom */
body {
  overflow-x: hidden;
}

/* Meta viewport para móviles */
@viewport {
  width: device-width;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  line-height: 1.6;
  color: #2c3e50;
}

.screen {
  min-height: 100vh;
}

.hidden {
  display: none;
}

/* Indicador de modo offline */
body.offline-mode::before {
    content: '🔴 MODO OFFLINE';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #721c24;
    color: white;
    text-align: center;
    padding: 8px;
    font-size: 12px;
    font-weight: bold;
    z-index: 999999;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

body.offline-mode {
    padding-top: 30px;
}

/* Login Screen */
#loginScreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  z-index: 9999;
  margin: 0 !important;
  padding: 0 !important;
  transform: none !important;
}

.login-container {
  background: white;
  padding: 2rem;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 400px;
}

.login-container h2 {
  text-align: center;
  margin-bottom: 2rem;
  color: #333;
}

.login-container form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-container input {
  padding: 0.75rem;
  border: 2px solid #ddd;
  border-radius: 5px;
  font-size: 1rem;
}

.login-container button {
  padding: 0.75rem;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.3s;
}

.login-container button:hover {
  background: #5a6fd8;
}

.login-register-link {
  text-align: center;
  margin-top: 1rem;
}

.login-register-link p {
  color: #666;
  font-size: 0.9rem;
}

.login-register-link a {
  color: #667eea;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
}

.login-register-link a:hover {
  color: #764ba2;
  text-decoration: underline;
}

.error {
  color: #e74c3c;
  text-align: center;
  margin-top: 1rem;
}

/* Main App */
header {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  color: white;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.notification-indicator {
  position: relative;
}

.notification-badge {
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.notification-badge:hover {
  transform: scale(1.1);
}

.notification-badge::after {
  content: "";
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background: #e74c3c;
  border-radius: 50%;
  display: none;
}

.notification-badge.has-notifications::after {
  display: block;
  animation: pulse 2s infinite;
}

#logoutBtn {
  background: #e74c3c;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  cursor: pointer;
}

main {
  padding: 2rem 0.5rem;
  max-width: 100%;
  margin: 0;
  position: relative;
  width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: visible;
}

/* Fix para main en zoom 90% - pegado a la izquierda */
@media screen and (max-width: 1280px) and (min-width: 1025px) {
  main {
    margin-left: 0;
    margin-right: 0;
    padding: 2rem 0.25rem;
    width: 100%;
    max-width: 100%;
  }
}

/* Form Section */
.form-section {
  background: white;
  padding: 2rem 1rem;
  border-radius: 16px;
  margin-bottom: 2.5rem;
  margin-left: auto;
  margin-right: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  width: 100%;
  max-width: 800px;
  box-sizing: border-box;
  position: relative;
  scroll-margin-top: 20px;
  overflow: hidden;
}

/* Cuando el formulario está visible (modal), hacerlo más pequeño */
.form-section[style*="display: block"] {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  width: 90% !important;
  max-width: 700px !important;
  max-height: 90vh !important;
  height: auto !important;
  z-index: 99999 !important;
  background: white !important;
  padding: 2rem !important;
  overflow-y: auto !important;
  box-sizing: border-box !important;
  border-radius: 16px !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3) !important;
  margin: 0 !important;
}

/* Fix específico para zoom 90% - pegado a la izquierda */
@media screen and (max-width: 1280px) and (min-width: 1025px) {
  .form-section {
    margin-left: 0;
    margin-right: 0;
    padding: 2rem 0.5rem;
    width: 100%;
    max-width: 100%;
  }

  .form-group input,
  .form-group textarea,
  .form-group select {
    max-width: 100%;
    box-sizing: border-box;
  }
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #2c3e50;
  font-size: 0.95rem;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  max-width: 100%;
  padding: 0.5rem;
  border: 2px solid #e0e6ed;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.9);
  box-sizing: border-box;
}

/* Fix para inputs en zoom 90% */
@media screen and (max-width: 1280px) and (min-width: 1025px) {
  .form-group input,
  .form-group textarea,
  .form-group select {
    max-width: 100%;
    box-sizing: border-box;
    padding: 0.5rem;
  }
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  background: white;
}

.form-group input[type="datetime-local"] {
  font-family: inherit;
}

.form-group textarea {
  height: auto;
  min-height: 44px;
  max-height: 200px;
  resize: none;
  overflow-y: auto;
}

/* Título y ubicación - ajuste vertical para móvil */
#titulo,
#ubicacion,
#descripcion {
  width: 100% !important;
  min-width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 44px !important;
  max-height: 200px !important; /* Límite máximo para evitar que se rompa */
  resize: none !important;
  white-space: normal !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  overflow-y: auto !important;
  padding: 0.5rem !important;
  line-height: 1.2 !important;
  box-sizing: border-box !important;
  transition: height 0.2s ease !important;
}

/* Estados especiales para textareas */
#titulo:focus,
#ubicacion:focus,
#descripcion:focus {
  overflow-y: auto !important;
  max-height: 200px !important;
}

/* Scroll personalizado para textareas */
#titulo::-webkit-scrollbar,
#ubicacion::-webkit-scrollbar,
#descripcion::-webkit-scrollbar {
  width: 6px;
}

#titulo::-webkit-scrollbar-track,
#ubicacion::-webkit-scrollbar-track,
#descripcion::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

#titulo::-webkit-scrollbar-thumb,
#ubicacion::-webkit-scrollbar-thumb,
#descripcion::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

#titulo::-webkit-scrollbar-thumb:hover,
#ubicacion::-webkit-scrollbar-thumb:hover,
#descripcion::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Para desktop mantener comportamiento consistente */
@media (min-width: 769px) {
  #titulo {
    min-height: 44px;
    max-height: 200px;
    resize: none;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow-y: auto;
    overflow-x: hidden;
  }

  #ubicacion {
    height: auto;
    min-height: 44px;
    max-height: 200px;
    resize: none;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow-y: auto;
    overflow-x: hidden;
  }

  #descripcion {
    height: auto;
    min-height: 44px;
    max-height: 200px;
    resize: none;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow-y: auto;
    overflow-x: hidden;
  }
}

/* Corregir campo ubicación en vista de tabla principal */
.mobile-entry-card .mobile-entry-content,
.excel-table td {
  white-space: normal !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  max-width: 200px !important;
}

.excel-table td:nth-child(8), /* Columna de ubicación */
.mobile-entry-card .mobile-entry-row:nth-child(6) .mobile-entry-content {
  white-space: normal !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  max-width: 150px !important;
  hyphens: auto !important;
}

.form-section button {
  background: #27ae60;
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.3s;
  font-weight: 600;
}

.form-section button:hover {
  background: #229954;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

/* Estilo especial para botón de actualizar */
.form-section button.update-mode {
  background: linear-gradient(135deg, #3498db, #2980b9);
  border: 2px solid #2980b9;
  position: relative;
  overflow: hidden;
}

.form-section button.update-mode:hover {
  background: linear-gradient(135deg, #2980b9, #1f5f8b);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

.form-section button.update-mode::before {
  content: "✏️";
  margin-right: 8px;
}

/* Filters Section */
.filters-section {
  background: rgba(255, 255, 255, 0.95);
  padding: 1.2rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  border: 1px solid #e0e6ed;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.filter-row {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .filter-row {
    flex-direction: column;
    gap: 0.75rem;
    align-items: stretch;
  }

  .filter-group {
    width: 100%;
    min-width: auto;
  }

  .filter-actions {
    width: 100%;
    margin-left: 0;
    margin-top: 0.5rem;
    justify-content: center;
  }

  .download-pdf-btn,
  .clear-filters-btn {
    flex: 1;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .filter-actions {
    flex-direction: column;
    gap: 0.5rem;
  }

  .download-pdf-btn,
  .clear-filters-btn {
    width: 100%;
    margin-right: 0;
  }
}

/* Zoom responsive - vista principal tabla y cards */
@media (max-width: 1340px) {
  .excel-table {
    font-size: 0.85rem;
  }

  .excel-table th,
  .excel-table td {
    padding: 8px 10px;
  }

  .mobile-entry-card {
    margin: 0.75rem;
  }

  .mobile-entry-content {
    font-size: 0.85rem;
  }
}

@media (max-width: 1200px) {
  .excel-table {
    font-size: 0.8rem;
    overflow-x: auto;
    display: block;
    max-width: 100%;
  }

  .excel-table th,
  .excel-table td {
    padding: 6px 8px;
    min-width: 80px;
  }

  .excel-table th:nth-child(4), /* Descripción */
  .excel-table td:nth-child(4) {
    min-width: 150px;
  }

  .excel-table th:nth-child(8), /* Usuario */
  .excel-table td:nth-child(8) {
    min-width: 120px;
  }

  .mobile-entry-card {
    margin: 0.5rem;
    padding: 0.75rem;
  }

  .mobile-entry-content {
    font-size: 0.8rem;
  }
}

@media (max-width: 1100px) {
  .excel-table {
    font-size: 0.75rem;
  }

  .excel-table th,
  .excel-table td {
    padding: 4px 6px;
  }

  .mobile-entry-card {
    margin: 0.25rem;
    padding: 0.5rem;
  }

  .mobile-entry-content {
    font-size: 0.75rem;
  }

  .mobile-foto {
    width: 40px;
    height: 40px;
  }
}

.filter-group {
  flex: 1;
  min-width: 140px;
}

.filter-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-left: 1rem;
  min-width: 130px;
}

.filter-group input,
.filter-group select {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #e0e6ed;
  border-radius: 8px;
  font-size: 0.9rem;
  background: white;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.date-input {
  padding: 0.5rem !important;
  border: 2px solid #e0e6ed !important;
  border-radius: 6px !important;
  font-size: 0.85rem !important;
  background: white !important;
  transition: all 0.2s ease !important;
}

.date-input:hover {
  border-color: #667eea !important;
}

.date-input:focus {
  outline: none !important;
  border-color: #667eea !important;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
}

.filter-group input:focus,
.filter-group select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  transform: translateY(-1px);
}

.download-pdf-btn {
  background: linear-gradient(135deg, #27ae60, #229954);
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
  transition: all 0.3s ease;
}

.download-pdf-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(39, 174, 96, 0.3);
}

.clear-filters-btn {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
  transition: all 0.3s ease;
}

.clear-filters-btn:hover {
  background: linear-gradient(135deg, #5a6268, #495057);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(108, 117, 125, 0.4);
}

/* Entries Section */
.entries-section {
  background: white;
  padding: 2rem 0.5rem;
  border-radius: 16px;
  margin-bottom: 2.5rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  width: 100%;
  box-sizing: border-box;
  position: relative;
  margin-left: 0;
  margin-right: 0;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.title-section {
  display: flex;
  align-items: baseline;
  gap: 1rem;
}

.entries-counter {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
  }
  50% {
    transform: scale(1.02);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
  }
}

.counter-number {
  font-size: 1.2rem;
  font-weight: bold;
  margin-right: 0.3rem;
}

.counter-text {
  font-size: 0.8rem;
  opacity: 0.9;
}

.header-buttons {
  display: flex;
  gap: 1rem;
  align-items: center;
}

  .manage-users-btn {
    background: linear-gradient(135deg, #9b59b6, #8e44ad) !important;
    color: white !important;
    border: none !important;
    padding: 0.5rem 1rem !important;
    border-radius: 5px !important;
    cursor: pointer !important;
    font-size: 0.85rem !important;
    transition: background 0.3s !important;
    align-items: center !important;
    gap: 0.3rem !important;
    box-shadow: 0 2px 8px rgba(155, 89, 182, 0.3) !important;
  }

  .manage-users-btn:hover {
    background: linear-gradient(135deg, #8e44ad, #7d3c98) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(155, 89, 182, 0.4) !important;
  }

.manage-users-btn:hover {
  background: #8e44ad;
}

.new-entry-btn {
  background: #27ae60;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.3s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.new-entry-btn:hover {
  background: #229954;
}

.form-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.cancel-btn {
  background: #e74c3c;
  color: white;
  border: none;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s;
}

.cancel-btn:hover {
  background: #c0392b;
}

.entry-card {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  background: #f9f9f9;
}

.entry-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.entry-date {
  color: #666;
  font-size: 0.9rem;
}

.entry-state {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: bold;
}

.entry-photos {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.entry-photos img {
  max-width: 200px;
  height: 150px;
  object-fit: cover;
  border-radius: 5px;
  cursor: pointer;
  transition: transform 0.2s;
}

.entry-photos img:hover {
  transform: scale(1.05);
}

/* Excel Table */
.excel-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-family: Arial, sans-serif;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  table-layout: fixed;
}

/* Contenedor principal para tabla con encabezados fijos */
.table-wrapper {
  position: relative;
  margin-top: 4rem;
}

/* Tabla de encabezados fijos */
.table-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: white;
  border: 1px solid #e0e6ed;
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.table-header .excel-table {
  margin: 0;
  border: none;
  box-shadow: none;
  border-radius: 0;
}

.table-header .excel-table th {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-bottom: 2px solid #5a6fd8;
}

/* Contenedor del cuerpo de la tabla */
.table-body-container {
  max-height: 65vh;
  overflow-y: auto;
  border: 1px solid #e0e6ed;
  border-top: none;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.table-body-container .excel-table {
  margin: 0;
  border: none;
  box-shadow: none;
  border-radius: 0;
}

.table-body-container .excel-table th {
  display: none;
}

.excel-table th,
.excel-table td {
  border: 1px solid #e8ecf1;
  padding: 8px;
  text-align: left;
  overflow: hidden;
}

.excel-table th {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  font-weight: 600;
  color: white;
  border-bottom: 2px solid #5a6fd8;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
}

/* Override para encabezados fijos en contenedor */
.table-container .excel-table th {
  position: sticky;
  top: 0;
  z-index: 101;
}

.excel-table tbody tr:nth-child(even) {
  background-color: #f9f9f9;
}

.excel-table tbody tr:hover {
  background-color: #f5f5f5;
}

.excel-table td {
  vertical-align: top;
  line-height: 1.4;
}

.excel-table td:nth-child(3) {
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  width: auto;
  max-width: 300px;
}

.archivos-container {
  display: flex;
  gap: 3px;
  align-items: center;
}

.fotos-container {
  display: flex;
  gap: 5px;
  align-items: center;
}

.mini-photo {
  width: 30px;
  height: 25px;
  object-fit: cover;
  border-radius: 3px;
  cursor: pointer;
  transition: transform 0.2s;
  position: relative;
  z-index: 1;
}

.mini-photo:hover {
  transform: scale(1.2);
}

.file-icon-preview {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1.2rem;
}

.file-icon-preview:hover {
  transform: scale(1.1);
  background: #e9ecef;
}

.more-photos {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  padding: 4px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
  display: inline-block !important;
  border: 1px solid #fff;
  position: relative;
  z-index: 5;
}

.more-photos:hover {
  background: linear-gradient(135deg, #5a67d8, #6b46a1);
  transform: scale(1.1);
  box-shadow: 0 3px 8px rgba(102, 126, 234, 0.4);
}

.no-photos {
  color: #999;
  font-style: italic;
  font-size: 0.9rem;
}

.edit-btn {
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: white;
  border: 1px solid #2980b9;
  padding: 6px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.3s ease;
  white-space: nowrap;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
  min-width: 110px;
  height: 30px;
  margin-right: 2px;
  vertical-align: top;
  font-family: inherit;
}

.edit-btn:hover {
  background: linear-gradient(135deg, #2980b9, #21618c);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
  border-color: #21618c;
}

.delete-btn {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: white;
  border: 1px solid #c0392b;
  padding: 6px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.3s ease;
  white-space: nowrap;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
  min-width: 110px;
  height: 30px;
  vertical-align: top;
  font-family: inherit;
 }

.delete-btn:hover {
  background: linear-gradient(135deg, #c0392b, #a93226);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
  border-color: #a93226;
}

.no-delete {
  color: #ccc;
  font-size: 1rem;
}

/* Modal de fotos mejorado */
.photo-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.3s ease;
}

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

.modal-content {
  background: white;
  padding: 2.5rem;
  border-radius: 16px;
  max-width: 98vw;
  max-height: 98vh;
  width: 95vw;
  height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #f0f0f0;
}

.modal-header h3 {
  color: #2c3e50;
  font-size: 1.5rem;
  font-weight: 600;
}

.close-modal {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.close-modal:hover {
  transform: scale(1.1) rotate(90deg);
  box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

.photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  padding: 0.5rem;
}

.photos-grid img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.photos-grid img:hover {
  transform: scale(1.05) translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  padding: 1rem;
}

.file-item {
  background: white;
  border: 1px solid #e0e6ed;
  border-radius: 12px;
  padding: 1rem;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.file-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.file-item img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 0.5rem;
}

.file-icon-large {
  width: 100%;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
  border: 2px dashed #dee2e6;
  border-radius: 8px;
  font-size: 4rem;
  cursor: pointer;
  margin-bottom: 0.75rem;
  transition: all 0.3s ease;
}

.file-icon-large:hover {
  background: #e9ecef;
  border-color: #667eea;
}

.file-details {
  text-align: center;
}

.file-details .file-name {
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 0.5rem;
  word-break: break-all;
  line-height: 1.3;
}

.file-details .file-size {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.download-btn {
  background: linear-gradient(135deg, #27ae60, #229954);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
}

.download-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
}

.fullscreen-image-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20000;
  animation: fadeIn 0.3s ease;
}

.fullscreen-content {
  position: relative;
  max-width: 95vw;
  max-height: 95vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.fullscreen-content img {
  max-width: 95vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.fullscreen-info {
  color: white;
  margin-top: 1rem;
  font-size: 1.1rem;
  text-align: center;
  max-width: 90vw;
  word-break: break-all;
}

.fullscreen-close {
  position: absolute;
  top: -50px;
  right: 0;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 2px solid white;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 20001;
}

.fullscreen-close:hover {
  background: rgba(255, 255, 255, 0.4);
  transform: rotate(90deg);
}
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
}

.download-btn:hover {
  background: linear-gradient(135deg, #229954, #1e8449);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

/* Animaciones adicionales */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  10%,
  30%,
  50%,
  70%,
  90% {
    transform: translateX(-5px);
  }
  20%,
  40%,
  60%,
  80% {
    transform: translateX(5px);
  }
}

.form-section {
  animation: fadeInUp 0.5s ease;
}

.entries-section {
  animation: fadeInUp 0.6s ease;
}

.excel-table tbody tr {
  transition: all 0.3s ease;
}

.excel-table tbody tr:hover {
  background-color: #f0f8ff;
  transform: scale(1.01);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.new-entry-btn:hover {
  animation: bounce 0.6s ease;
}

@keyframes bounce {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

.mini-photo:hover {
  animation: rotate360 0.5s ease;
}

@keyframes rotate360 {
  from {
    transform: rotate(0deg) scale(1.2);
  }
  to {
    transform: rotate(360deg) scale(1.2);
  }
}

/* Preview de archivos */
.file-preview {
  margin-top: 1rem;
  padding: 1rem;
  background: rgba(102, 126, 234, 0.05);
  border: 2px dashed rgba(102, 126, 234, 0.3);
  border-radius: 8px;
  animation: fadeIn 0.3s ease;
}

.file-preview h4 {
  color: #667eea;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.file-preview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.file-preview-item {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  animation: zoomIn 0.3s ease;
  border: 2px solid #667eea;
  background: white;
}

.file-preview-add-more {
  border: 2px dashed #667eea;
  background: rgba(102, 126, 234, 0.1);
  cursor: pointer;
  transition: all 0.3s ease;
}

.file-preview-add-more:hover {
  background: rgba(102, 126, 234, 0.2);
  transform: scale(1.05);
}

.add-more-icon {
  font-size: 2rem;
  color: #667eea;
  font-weight: bold;
  margin-bottom: 0.25rem;
}

.add-more-text {
  font-size: 0.6rem;
  color: #667eea;
  font-weight: 600;
}

.file-preview-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
}

.file-preview-content img {
  width: 100%;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
}

.file-icon {
  font-size: 2rem;
  margin-bottom: 0.25rem;
}

.file-name {
  font-size: 0.6rem;
  word-break: break-all;
  line-height: 1.1;
  padding: 0 0.25rem;
  max-height: 2.2rem;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.file-size {
  font-size: 0.5rem;
  color: #666;
}

@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.file-info {
  color: #667eea;
  font-size: 0.85rem;
  font-style: italic;
  margin: 0;
}

/* Update warning para fotos */
.update-warning {
  margin-top: 1rem;
  padding: 1.25rem;
  background: linear-gradient(135deg, #fff3cd, #f8d7da);
  border: 2px solid #f5c6cb;
  border-radius: 8px;
  animation: fadeIn 0.5s ease;
  box-shadow: 0 4px 15px rgba(220, 53, 69, 0.1);
}

.checkbox-container {
  display: flex;
  align-items: flex-start;
  cursor: pointer;
  user-select: none;
  gap: 0.75rem;
}

.checkbox-container input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: #dc3545;
  margin-top: 2px;
}

.warning-icon {
  color: #dc3545;
  font-size: 1.2rem;
  margin-right: 0.5rem;
  animation: pulse 2s infinite;
}

.checkbox-text {
  flex: 1;
  color: #721c24;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.4;
}

@keyframes warningPulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.8;
  }
}

.warning-icon {
  animation: warningPulse 1.5s infinite;
}

/* Responsive mejorado */
@media (max-width: 768px) {
  main {
    padding: 0.25rem;
    max-width: 100%;
    width: 100%;
    overflow-x: hidden;
    overflow-y: visible;
    position: relative;
    margin: 0;
  }

  .entries-section {
    padding: 1.25rem 0.75rem;
    border-radius: 8px;
    margin-bottom: 1.25rem;
    margin-left: 0;
    margin-right: 0;
    width: 100%;
    max-width: 100%;
  }

  /* Formulario de nueva entrada en móvil - más pequeño y centrado */
  .form-section[style*="display: block"] {
    width: 95% !important;
    max-width: 500px !important;
    max-height: 90vh !important;
    padding: 1.5rem !important;
  }

  /* Resto de estilos normales para el formulario */
  .form-section .form-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 1rem !important;
    padding: 0 !important;
  }

  .entries-section {
    backdrop-filter: none !important;
    background: white !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
  }

  header {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
    padding: 0.5rem 0.75rem;
  }
  
  .user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  #userName {
    font-size: 0.8rem;
    font-weight: 600;
  }
  
  #userRole {
    font-size: 0.75rem;
  }
  
  .notification-container {
    position: relative;
  }
  
  .notification-btn {
    font-size: 1.1rem !important;
    padding: 0.3rem !important;
    border-radius: 50%;
  }
  
  #logoutBtn {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 4px;
  }

  .section-header {
    flex-direction: column;
    gap: 0.75rem;
    align-items: stretch;
  }

  .header-buttons {
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
  }

  .new-entry-btn,
  .manage-users-btn {
    width: 100%;
    justify-content: center;
    padding: 0.875rem;
    font-size: 0.95rem;
  }

  /* Convertir tabla a tarjetas solo en móvil */
  .table-container .excel-table thead {
    display: none;
  }

  .excel-table tbody {
    display: block;
  }

  .excel-table tbody tr {
    display: block;
    background: white;
    border: 1px solid #e0e6ed;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    padding: 1rem;
    width: 100%;
    box-sizing: border-box;
    white-space: normal;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    clear: both;
  }

  .excel-table td {
    display: block;
    padding: 0.75rem 0;
    border: none;
    position: relative;
    padding-left: 85px;
    width: 100%;
    box-sizing: border-box;
    min-height: 20px;
  }

  /* Solo ajustar botones en móvil */
  @media (max-width: 768px) {
    .table-container {
      overflow: visible;
      max-height: none;
    }
    
    .table-container .excel-table {
      display: block;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      min-width: 700px;
      border: 1px solid #e0e0e0;
      border-radius: 8px;
    }

    /* Ajustar botones para móvil */
    .excel-table td:nth-child(8) {
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
      padding-left: 0 !important;
      position: static !important;
    }

    .excel-table td:nth-child(8):before {
      position: static;
      margin-bottom: 0.5rem;
      display: block;
      width: 100%;
    }

    .edit-btn,
    .delete-btn {
      padding: 0.5rem 0.75rem;
      font-size: 0.8rem;
      margin: 0;
      width: 100%;
      box-sizing: border-box;
    }

    .more-photos {
      font-size: 0.6rem;
      padding: 2px 3px;
    }

    .mini-photo {
      width: 30px;
      height: 30px;
    }

    .entries-list {
      width: 100%;
      overflow-x: auto;
    }
  }

  .entries-list {
    clear: both;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
  }

  .mobile-entry-card {
    display: block;
    background: white;
    border: 1px solid #e0e6ed;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
    clear: both;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: transform;
  }

  .mobile-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #f0f0f0;
  }

  .mobile-entry-date {
    font-size: 0.9rem;
    color: #666;
    font-weight: 600;
    width: 100%;
  }

  .mobile-entry-title {
    font-size: 1.1rem;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 0.75rem;
    line-height: 1.3;
  }

  .mobile-entry-row {
    display: flex;
    margin-bottom: 0.75rem;
    align-items: flex-start;
  }

  .mobile-entry-label {
    font-weight: bold;
    color: #667eea;
    min-width: 70px;
    font-size: 0.9rem;
    margin-right: 0.75rem;
  }

  .mobile-entry-content {
    flex: 1;
    font-size: 0.95rem;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
  }

  .mobile-entry-description {
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    margin-bottom: 0.75rem;
    line-height: 1.5;
  }

  .mobile-archivos-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0.75rem 0;
  }

  .mobile-fotos-container {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 0.75rem 0;
  }

  .mobile-foto {
    width: 35px;
    height: 35px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #667eea;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    z-index: 1;
  }

  .mobile-foto:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
  }

  .mobile-file-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border: 2px solid #667eea;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.5rem;
  }

  .mobile-file-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    background: #e9ecef;
  }

  .mobile-more-photos {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    display: flex !important;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    height: 50px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    border: 2px solid #fff;
    position: relative;
    z-index: 10;
  }

  .mobile-more-photos:hover {
    background: linear-gradient(135deg, #5a67d8, #6b46a1);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  }

  .mobile-actions {
    width: 100%;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f0f0f0;
    box-sizing: border-box;
  }

  .mobile-actions-container {
    display: flex;
    gap: 0.5rem;
    width: 100%;
    box-sizing: border-box;
    flex-wrap: wrap;
    clear: both;
    overflow: hidden;
  }

  .mobile-action-btn {
    padding: 0.4rem 0.8rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    font-weight: 500;
    white-space: nowrap;
    box-sizing: border-box;
    flex: 1;
    min-width: 100px;
  }

  .mobile-edit-btn {
    background: #3498db;
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.2);
    width: 100px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    margin: 0 1px;
    white-space: nowrap;
  }

  .mobile-edit-btn:hover {
    background: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
  }

  .mobile-delete-btn {
    background: #e74c3c;
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.2);
    width: 100px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    margin: 0 1px;
    white-space: nowrap;
  }

  .mobile-delete-btn:hover {
    background: #c0392b;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
  }

  .no-fotos-mobile {
    color: #999;
    font-style: italic;
    font-size: 0.9rem;
    margin: 0.75rem 0;
  }
}

/* Limpiar floats */
.excel-table tbody {
  overflow: hidden;
}

.excel-table th,
.excel-table td {
  padding: 6px 4px;
  white-space: nowrap;
  overflow: hidden;
}

.excel-table td:nth-child(2),
.excel-table td:nth-child(3),
.excel-table td:nth-child(4),
.excel-table td:nth-child(6) {
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  line-height: 1.4;
  vertical-align: top;
}

.excel-table td:nth-child(2) {
  /* Título */
  max-width: 150px;
  min-width: 80px;
}

.excel-table td:nth-child(3) {
  /* Descripción */
  max-width: 200px;
  min-width: 120px;
}

.excel-table td:nth-child(4) {
  /* Ubicación */
  max-width: 150px;
  min-width: 80px;
  vertical-align: top;
}

.excel-table td:nth-child(6) {
  /* Usuario */
  max-width: 120px;
  min-width: 80px;
  word-break: break-all;
  vertical-align: top;
}

.excel-table td:nth-child(7) {
  /* Usuario */
  max-width: 120px;
  min-width: 80px;
  word-break: break-all;
  vertical-align: top;
}

.excel-table td:nth-child(8) {
  /* Fotos */
  width: 150px;
  white-space: nowrap;
  padding: 8px;
  vertical-align: top;
  text-align: left;
}

.excel-table td:nth-child(9) {
  /* Acciones */
  width: 260px;
  white-space: nowrap;
  padding: 8px;
  vertical-align: top;
  text-align: left;
}

.form-group {
  margin-bottom: 1rem;
}

.form-section button {
  width: 100%;
  padding: 0.75rem;
}

.mini-photo {
  width: 35px;
  height: 25px;
}

.more-photos {
  font-size: 0.55rem;
  padding: 1px 3px;
}

@media (max-width: 480px) {
  html,
  body {
    overflow-x: hidden;
  }

  main {
    padding: 0.5rem;
    max-width: 100%;
    width: 100%;
    overflow-x: hidden;
    position: relative;
  }

  .form-section,
  .entries-section {
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    width: 100%;
    box-sizing: border-box;
  }

  header {
    padding: 0.75rem;
  }

  .excel-table {
    font-size: 0.7rem;
  }

  .excel-table th,
  .excel-table td {
    padding: 6px 4px;
  }

  /* Formulario optimizado para móvil */
  .form-section {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 0 0 1.25rem 0;
    padding: 0.75rem 0.5rem;
    box-sizing: border-box;
    left: 0;
    right: 0;
    border-radius: 8px;
    overflow: hidden;
  }

  .form-header {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #f0f0f0;
  }

  .form-group {
    margin-bottom: 0.75rem;
    width: 100%;
    padding: 0;
  }

  .form-group label {
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
    color: #2c3e50;
    font-weight: 600;
    display: block;
    padding: 0 0.25rem;
  }

  .form-group input,
  .form-group textarea,
  .form-group select {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0.75rem 0.5rem;
    font-size: 16px !important;
    min-height: 44px;
    border: 2px solid #ddd;
    border-radius: 8px;
    box-sizing: border-box !important;
    -webkit-box-sizing: border-box !important;
    -moz-box-sizing: border-box !important;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.2s ease !important;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    margin: 0;
  }

  .form-group input:focus,
  .form-group textarea:focus,
  .form-group select:focus {
    outline: none;
    border-color: #27ae60;
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.1);
  }

  .form-group textarea {
    min-height: 60px;
    resize: vertical;
    height: auto;
    overflow-y: hidden;
    line-height: 1.3;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }

  .form-section button {
    width: 100%;
    padding: 0.75rem 0.5rem;
    font-size: 1rem;
    border-radius: 8px;
    margin-top: 0.5rem;
    min-height: 48px;
    font-weight: 600;
    box-sizing: border-box;
  }

  .modal-content {
    padding: 1.5rem;
    margin: 1rem;
  }

  .photos-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
  }

  .photos-grid img {
    height: 180px;
  }
}

#titulo,
#ubicacion {
  width: 100% !important;
  min-width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 44px !important;
  resize: none !important;
  white-space: normal !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  overflow-y: auto !important;
  padding: 0.5rem !important;
  line-height: 1.2 !important;
  box-sizing: border-box !important;
}

/* Lazy loading y optimizaciones de rendimiento */
.lazy-image {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lazy-image.loaded {
  opacity: 1;
}

.image-placeholder,
.mini-image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f0f0;
  border: 2px dashed #ddd;
  border-radius: 4px;
  font-size: 1.2rem;
  color: #999;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}

.mini-image-placeholder {
  font-size: 0.6rem;
  width: 30px;
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-foto-container {
  position: relative;
  width: 35px;
  height: 35px;
}

.mini-photo-container {
  position: relative;
  width: 30px;
  height: 25px;
}

/* Paginación y loading */
.pagination-info {
  text-align: center;
  margin: 1rem 0;
  color: #666;
  font-size: 0.9rem;
  font-style: italic;
}

.counter-total {
  font-size: 0.8rem;
  opacity: 0.8;
  margin-left: 0.5rem;
}

.entries-loader {
  text-align: center;
  margin: 1rem 0;
  padding: 1rem;
}

.loader-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 0.5rem;
}

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

.load-more-btn {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border: none;
  padding: 0.75rem 2rem;
  border-radius: 25px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.load-more-btn:hover {
  background: linear-gradient(135deg, #5a6fd8, #6a5acd);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.load-more-btn:disabled {
  opacity: 0.6;
}

.load-more-container {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.load-more-btn {
  min-width: 250px;
}

/* Additional zoom optimizations for desktop browsers */
@media screen and (min-width: 769px) {
  /* Chrome/Safari zoom fixes */
  .form-section {
    max-width: calc(100vw - 2rem) !important;
    margin-left: auto;
    margin-right: auto;
  }

  /* Firefox zoom fixes */
  @supports (-moz-appearance: none) {
    .form-section {
      max-width: calc(100vw - 2rem) !important;
    }
  }

  /* Edge zoom fixes */
  @supports (-ms-ime-align: auto) {
    .form-section {
      max-width: calc(100vw - 2rem) !important;
    }
  }
}

/* 90% Zoom Specific Fixes */
@media screen and (max-width: 1440px) and (min-width: 1200px) {
  main {
    width: calc(100vw - 1rem) !important;
    max-width: calc(100vw - 1rem) !important;
    padding: 1.5rem 0.5rem !important;
  }

  .form-section {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .form-group {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .form-group input,
  .form-group textarea,
  .form-group select {
    max-width: 100% !important;
    min-width: 200px !important;
    box-sizing: border-box !important;
  }
}

/* Zoom level specific fixes */
@media screen and (max-width: 1280px) and (min-width: 1024px) {
  /* 90% zoom fixes */
  .form-group input,
  .form-group textarea,
  .form-group select {
    font-size: 0.9rem;
    padding: 0.65rem;
  }

  .form-section {
    padding: 2rem 1.25rem;
  }
}

@media screen and (max-width: 1152px) and (min-width: 1024px) {
  /* 80% zoom fixes */
  .form-group input,
  .form-group textarea,
  .form-group select {
    font-size: 0.85rem;
    padding: 0.6rem;
  }

  .form-section {
    padding: 1.75rem 1rem;
  }
}

/* Container overflow prevention - AGGRESSIVE */
.container-wrapper {
  overflow-x: hidden;
  width: 100vw;
  max-width: 100vw;
  min-width: 320px;
  position: relative;
}

body {
  overflow-x: hidden !important;
  width: 100vw !important;
  max-width: 100vw !important;
}

html {
  overflow-x: hidden !important;
}

/* Form overflow fixes - AGGRESSIVE */
#bitacoraForm {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.form-grid {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  margin: 0;
  padding: 0;
}

.form-group {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  overflow: hidden;
  margin-bottom: 1rem;
  padding: 0;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: calc(100% - 0.5rem) !important;
  max-width: calc(100% - 0.5rem) !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  border: 1px solid #e0e6ed !important;
  margin: 0;
  padding: 0.5rem !important;
  font-size: 0.9rem !important;
}

/* Flexible grid for form elements - SIMPLIFIED */
.form-grid {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.form-group {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  overflow: hidden;
  margin-bottom: 1rem;
}

/* Simplified layout - single column always */
@media screen and (min-width: 768px) {
  .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .form-group {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .form-group.full-width {
    grid-column: 1 / -1;
    width: 100% !important;
  }

  /* Skeleton loading */
  .skeleton {
    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;
    }
  }

  /* Validación de campos obligatorios */
  .required {
    color: #e74c3c;
    font-weight: bold;
    margin-left: 4px;
  }

  /* Errores de validación */
  .validation-error-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10002;
    animation: fadeIn 0.3s ease;
  }

  .validation-error-content {
    background: white;
    border-radius: 12px;
    padding: 0;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
  }

  .validation-error-header {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    padding: 1.5rem;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .validation-error-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
  }

  .validation-error-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .validation-error-close:hover {
    background: rgba(255, 255, 255, 0.2);
  }

  .validation-error-list {
    padding: 1.5rem;
    background: #f8f9fa;
  }

  .validation-error-item {
    padding: 0.75rem;
    margin: 0.5rem 0;
    background: white;
    border-left: 4px solid #e74c3c;
    border-radius: 0 6px 6px 0;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    animation: slideInLeft 0.3s ease;
  }

  .validation-error-actions {
    padding: 1.5rem;
    text-align: center;
    border-top: 1px solid #e0e0e0;
  }

  .validation-error-ok {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
  }

  .validation-error-ok:hover {
    background: linear-gradient(135deg, #5a6fd8, #6a5acd);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
  }

  /* Resaltar campos con errores */
  .form-group.validation-error {
    animation: shakeError 0.5s ease;
  }

  .form-group.validation-error label {
    color: #e74c3c;
    font-weight: 600;
  }

  .form-group.validation-error input,
  .form-group.validation-error textarea,
  .form-group.validation-error select {
    border-color: #e74c3c;
    border-width: 3px;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
    background: #fff5f5;
  }

  .form-group.validation-error input:focus,
  .form-group.validation-error textarea:focus,
  .form-group.validation-error select:focus {
    border-color: #c0392b;
    box-shadow: 0 0 0 3px rgba(192, 60, 43, 0.2);
  }

  @keyframes slideInLeft {
    from {
      opacity: 0;
      transform: translateX(-20px);
    }
    to {
      opacity: 1;
      transform: translateX(0);
    }
  }

  @keyframes shakeError {
    0%,
    100% {
      transform: translateX(0);
    }
    10%,
    30%,
    50%,
    70%,
    90% {
      transform: translateX(-5px);
    }
    20%,
    40%,
    60%,
    80% {
      transform: translateX(5px);
    }
  }

  /* ===== ESTILOS PARA SISTEMA DE COMENTARIOS ===== */

  /* Archivos en comentarios */


  .comment-files-label {
    color: #17a2b8;
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.75rem;
  }

  .comment-files-label-small {
    color: #17a2b8;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
  }

  #commentFiles {
    width: 100%;
    padding: 0.5rem;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
  }

  #commentFiles:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  }

  .comment-files-preview {
    margin-top: 0.75rem;
    padding: 1rem;
    background: rgba(102, 126, 234, 0.05);
    border: 2px dashed rgba(102, 126, 234, 0.3);
    border-radius: 8px;
    animation: fadeIn 0.3s ease;
  }

  .comment-files-preview h4 {
    color: #667eea;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    font-weight: 600;
  }

  .comment-files-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
  }



  .comment-file-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: #667eea;
  }

  .comment-file-name {
    font-size: 0.75rem;
    font-weight: 500;
    color: #2c3e50;
    text-align: center;
    word-break: break-all;
    line-height: 1.2;
  }

  .comment-file-size {
    font-size: 0.65rem;
    color: #666;
    text-align: center;
  }

  .comment-files-info {
    color: #667eea;
    font-size: 0.85rem;
    font-style: italic;
    margin: 0.5rem 0 0 0;
  }

  /* Vista previa pequeña para respuestas */
  .comment-files-preview-small {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: rgba(102, 126, 234, 0.05);
    border: 1px dashed rgba(102, 126, 234, 0.3);
    border-radius: 6px;
    animation: fadeIn 0.3s ease;
  }

  .comment-files-preview-small .comment-files-preview-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.5rem;
  }

  /* Archivos adjuntos en comentarios mostrados */
  .comment-files-list {
    margin-top: 1.25rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 1px solid #dee2e6;
    border-radius: 10px;
    border-left: 4px solid #17a2b8;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  }

  .comment-files-list-small {
    margin-top: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    border-left: 3px solid #17a2b8;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  }

  .comment-files-header {
    font-size: 1rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 1rem;
  }

  .comment-files-header-small {
    font-size: 0.9rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.75rem;
  }

  .comment-files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
  }

  .comment-files-grid-small {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.5rem;
  }

  .comment-file-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  }

  .comment-file-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #17a2b8;
    background: #f8f9fa;
  }

  .comment-file-item-small {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  }

  .comment-file-item-small:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: #17a2b8;
    background: #f8f9fa;
  }





  .comment-file-icon-large {
    font-size: 2rem;
    color: #17a2b8;
    margin-right: 0.75rem;
    min-width: 50px;
    text-align: center;
  }

  .comment-file-icon-small {
    font-size: 1.5rem;
    color: #17a2b8;
    margin-right: 0.5rem;
    min-width: 40px;
    text-align: center;
  }

  .comment-file-info {
    flex: 1;
    min-width: 0;
  }

  .comment-file-info-small {
    flex: 1;
    min-width: 0;
  }

  .comment-file-name-display {
    font-size: 0.85rem;
    font-weight: 500;
    color: #2c3e50;
    word-break: break-all;
    line-height: 1.2;
    margin-bottom: 0.25rem;
  }

  .comment-file-name-display-small {
    font-size: 0.75rem;
    font-weight: 500;
    color: #2c3e50;
    word-break: break-all;
    line-height: 1.2;
    margin-bottom: 0.2rem;
  }

  .comment-file-size-display {
    font-size: 0.75rem;
    color: #666;
  }

  .comment-file-size-display-small {
    font-size: 0.65rem;
    color: #666;
  }

  /* Responsive para archivos en comentarios */
  @media (max-width: 768px) {
    .comment-files-section {
      margin: 0.75rem 0;
      padding: 0.75rem;
    }

    .comment-files-preview-grid {
      grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
      gap: 0.5rem;
    }

    .comment-files-grid {
      grid-template-columns: 1fr;
      gap: 0.75rem;
    }

    .comment-file-item {
      padding: 0.5rem;
    }

    .comment-file-thumbnail {
      width: 40px;
      height: 40px;
      margin-right: 0.5rem;
    }

    .comment-file-icon-large {
      font-size: 1.5rem;
      margin-right: 0.5rem;
      min-width: 40px;
    }
  }

  


  .comments-modal-content {
    background: white;
    border-radius: 16px;
    width: 95%;
    max-width: 900px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    display: flex;
    flex-direction: column;
  }

  .comments-modal-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 1.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 16px 16px 0 0;
  }

  .comments-modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .close-comments-modal {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
  }

  .close-comments-modal:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1) rotate(90deg);
  }

  .comments-modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
  }

  /* Lista de Comentarios */
  .comments-list {
    max-height: 500px;
    overflow-y: auto;
    padding-right: 0.5rem;
    min-height: 400px;
  }

  .comments-list::-webkit-scrollbar {
    width: 8px;
  }

  .comments-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
  }

  .comments-list::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
  }

  .comments-list::-webkit-scrollbar-thumb:hover {
    background: #5a6fd8;
  }

  .comment-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    animation: fadeInUp 0.3s ease;
  }

  .comment-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
  }

  .comment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e9ecef;
  }

  .comment-user {
    flex: 1;
  }

  .comment-user strong {
    color: #2c3e50;
    font-size: 0.95rem;
    font-weight: 600;
  }

  .comment-role {
    color: #667eea;
    font-size: 0.8rem;
    font-weight: 500;
    margin-left: 0.5rem;
  }

  .comment-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
  }

  .comment-date {
    color: #666;
    font-size: 0.8rem;
    font-style: italic;
  }

  .comment-actions {
    display: flex;
    gap: 0.25rem;
  }

  .comment-edit-btn,
  .comment-delete-btn {
    background: none;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    width: 100px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    white-space: nowrap;
  }

  .comment-edit-btn {
    color: #3498db;
  }

  .comment-edit-btn:hover {
    background: #3498db;
    color: white;
  }

  .comment-delete-btn {
    color: #e74c3c;
  }

  .comment-delete-btn:hover {
    background: #e74c3c;
    color: white;
  }

  .comment-content {
    color: #2c3e50;
    line-height: 1.5;
    font-size: 0.95rem;
    word-wrap: break-word;
    white-space: pre-wrap;
  }

  /* Edición de Comentarios */
  .comment-edit-textarea {
    width: 100%;
    min-height: 80px;
    padding: 0.75rem;
    border: 2px solid #667eea;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    margin-bottom: 0.75rem;
    box-sizing: border-box;
  }

  .comment-edit-textarea:focus {
    outline: none;
    border-color: #5a6fd8;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  }

  .comment-edit-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
  }

  .comment-save-btn,
  .comment-cancel-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
  }

  .comment-save-btn {
    background: linear-gradient(135deg, #27ae60, #229954);
    color: white;
  }

  .comment-save-btn:hover {
    background: linear-gradient(135deg, #229954, #1e8449);
    transform: translateY(-1px);
  }

  .comment-cancel-btn {
    background: #e74c3c;
    color: white;
  }

  .comment-cancel-btn:hover {
    background: #c0392b;
    transform: translateY(-1px);
  }

  /* Sección de Agregar Comentario */
  .add-comment-section {
    border-top: 2px solid #e9ecef;
    padding-top: 2rem;
  }

  .comment-user-info {
    margin-bottom: 1rem;
    color: #667eea;
    font-weight: 500;
    font-size: 1rem;
  }

  #newComment {
    width: 100%;
    min-height: 100px;
    padding: 1rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    margin-bottom: 1rem;
    box-sizing: border-box;
    transition: all 0.2s ease;
  }

  #newComment:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  }

  #newComment::placeholder {
    color: #999;
    font-style: italic;
  }

  #submitComment {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
  }

  #submitComment:hover {
    background: linear-gradient(135deg, #5a6fd8, #6a5acd);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
  }

  #submitComment:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
  }

  /* Mensaje cuando no hay comentarios */
  .no-comments {
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 2rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #e9ecef;
  }


.comments-btn {
    background: linear-gradient(135deg, #28a745, #218838);
    color: white;
    padding: 4px 8px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.65rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.1rem;
    justify-content: center;
    min-width: 60px !important;
    height: 28px !important;
    white-space: nowrap;
  }

.comments-btn:hover {
    background: linear-gradient(135deg, #218838, #1e7e34);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
  }

  .comments-btn:active {
    transform: translateY(0px);
  }

/* Estilos específicos para botones de comentarios en versión móvil - MANTENER VERDE */
.mobile-action-btn.comments-btn {
    flex: 1;
    min-width: 98px;
    justify-content: center;
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
    height: 32px;
    background: linear-gradient(135deg, #28a745, #218838) !important;
    color: white !important;
    border: none !important;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.2) !important;
  }

.mobile-action-btn.comments-btn:hover {
    background: linear-gradient(135deg, #218838, #1e7e34) !important;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3) !important;
    transform: translateY(-1px) !important;
  }



/* Icono de comentarios normal */
  .comments-btn::before {
    content: "💬";
    font-size: 0.8rem;
    margin-right: 0.15rem;
  }

  /* Contador de comentarios */
  .comment-count {
    background: #e74c3c;
    color: white;
    font-size: 0.55rem;
    font-weight: bold;
    padding: 1px 4px;
    border-radius: 6px;
    margin-left: 0.2rem;
    min-width: 12px;
    height: 12px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    top: -1px;
  }

  .comment-count:empty {
    display: none;
  }

  .comment-count.has-many {
    font-size: 0.5rem;
    padding: 1px 3px;
  }

  .comments-read .comment-count {
    background: #6c757d;
    color: white;
  }

  /* Asegurar que todos los contadores sean visibles */
  .comments-btn .comment-count,
.mobile-action-btn.comments-btn .comment-count {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 1px 4px;
    border-radius: 8px;
    font-size: 0.65rem;
    font-weight: 600;
    margin-left: 2px;
    min-width: 14px;
    text-align: center;
    display: inline-block;
  }

  /* Estilo especial cuando hay muchos comentarios */
  .comment-count.has-many {
    background: linear-gradient(135deg, #ff4757, #ff3838);
    animation: bounce 1s ease-in-out infinite;
  }

  /* Animación bounce para muchos comentarios */
  @keyframes bounce {
    0%,
    100% {
      transform: scale(1);
    }
    50% {
      transform: scale(1.1);
    }
  }

  /* Estilos para botones de comentarios leídos */
  .comments-read {
    opacity: 0.8;
  }

  .comments-read .comment-count {
    background: linear-gradient(135deg, #6c757d, #5a6268);
    animation: none;
    box-shadow: none;
  }

  /* Indicador de comentarios no leídos */
  .comments-btn:not(.comments-read):hover,
.mobile-action-btn.comments-btn:not(.comments-read):hover {
    background: linear-gradient(135deg, #218838, #1e7e34) !important;
    border-color: #1e7e34 !important;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3) !important;
    transform: translateY(-1px) !important;
  }

  .mobile-action-btn.comments-btn:not(.comments-read) .comment-count {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 1px 4px;
    border-radius: 8px;
    font-size: 0.65rem;
    font-weight: 600;
    margin-left: 2px;
    min-width: 14px;
    text-align: center;
    display: inline-block;
  }

  .mobile-action-btn.comments-btn:not(.comments-read) .comment-count::before {
    content: "🔴";
    margin-right: 2px;
    animation: pulse 1.5s infinite;
  }

  /* Efecto de brillo para comentarios nuevos */
  .comments-btn:not(.comments-read) .comment-count,
  .mobile-comments-btn:not(.comments-read) .comment-count {
    animation: commentPulse 1.5s infinite;
  }

  /* Eliminar duplicados - regla principal arriba */

  .comments-btn:not(.comments-read) .comment-count::before,
  .mobile-comments-btn:not(.comments-read) .comment-count::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
      45deg,
      transparent,
      rgba(255, 255, 255, 0.3),
      transparent
    );
    animation: shine 3s infinite;
  }

  @keyframes shine {
    0% {
      transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }
    100% {
      transform: translateX(100%) translateY(100%) rotate(45deg);
    }
  }

  @keyframes pulse {
    0% {
      transform: scale(1);
      opacity: 1;
    }
    50% {
      transform: scale(1.1);
      opacity: 0.9;
    }
    100% {
      transform: scale(1);
      opacity: 1;
    }
  }





  /* Asegurar que el modal de comentarios se vea bien en móviles */
@media (max-width: 768px) {
    .comments-modal-content {
        width: 95%;
        max-width: none;
        margin: 0.5rem;
        max-height: 95vh;
    }
    
    .comments-modal-header {
        padding: 1.25rem;
    }
    
    .comments-modal-header h3 {
        font-size: 1.25rem;
    }
    
    .comments-modal-body {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .comments-modal-content {
        width: 98%;
        margin: 0.25rem;
    }
    
    .comments-modal-header {
        padding: 1rem;
    }
    
    .comments-modal-header h3 {
        font-size: 1.1rem;
    }
    
    .comments-modal-body {
        padding: 1rem;
    }
    
    .comment-item {
        padding: 0.75rem;
    }
    
    .comment-content {
        font-size: 0.9rem;
    }
    
    #newComment {
        font-size: 0.9rem;
        min-height: 80px;
    }
    
    #submitComment {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }
}

/* Animaciones para comentarios */
  @keyframes fadeIn {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }

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

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

  /* Efecto de resaltado para nuevos comentarios */
  .comment-item.new-comment {
    background: linear-gradient(135deg, #e8f5e8, #f0fff0);
    border-color: #27ae60;
    animation: highlightNewComment 2s ease;
  }

  @keyframes highlightNewComment {
    0% {
      background: linear-gradient(135deg, #d4edda, #c3e6cb);
      transform: scale(1.02);
    }
    50% {
      background: linear-gradient(135deg, #e8f5e8, #f0fff0);
      transform: scale(1.01);
    }
    100% {
      background: linear-gradient(135deg, #e8f5e8, #f0fff0);
      transform: scale(1);
    }
  }

  /* ===== ESTILOS PARA RESPUESTAS A COMENTARIOS ===== */

  .comment-actions-row {
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid #e9ecef;
  }

  .comment-reply-btn {
    background: linear-gradient(135deg, #28a745, #218838);
    color: rgb(179, 9, 9);
    border: 1px solid #218838;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    justify-content: center;
    min-width: 90px;
    height: 30px;
    white-space: nowrap;
    font-family: inherit;
  }

  .comment-reply-btn:hover {
    background: linear-gradient(135deg, #218838, #1e7e34);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
    border-color: #1e7e34;
  }

  .reply-section {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    animation: slideDown 0.3s ease;
  }

  .reply-input-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .reply-textarea {
    width: 100%;
    min-height: 80px;
    padding: 0.75rem;
    border: 2px solid #667eea;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    box-sizing: border-box;
    transition: all 0.2s ease;
  }

  .reply-textarea:focus {
    outline: none;
    border-color: #5a6fd8;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  }

  .reply-textarea::placeholder {
    color: #999;
    font-style: italic;
  }

  .reply-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
  }

  .reply-send-btn,
  .reply-cancel-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
  }

  .reply-send-btn {
    background: linear-gradient(135deg, #27ae60, #229954);
    color: white;
  }

  .reply-send-btn:hover {
    background: linear-gradient(135deg, #229954, #1e8449);
    transform: translateY(-1px);
  }

  .reply-cancel-btn {
    background: #e74c3c;
    color: white;
  }

  .reply-cancel-btn:hover {
    background: #c0392b;
    transform: translateY(-1px);
  }

  /* Sección de respuestas */
  .replies-section {
    margin-top: 1.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 8px;
    border-left: 4px solid #17a2b8;
  }

  .replies-header {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #dee2e6;
    color: #495057;
    font-size: 0.9rem;
  }

  .reply-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    margin-left: 1rem;
    position: relative;
    animation: fadeInReply 0.3s ease;
  }

  .reply-item::before {
    content: "↳";
    position: absolute;
    left: -1.5rem;
    top: 0.75rem;
    color: #17a2b8;
    font-size: 1rem;
    font-weight: bold;
  }

  .reply-item:last-child {
    margin-bottom: 0;
  }

  .reply-item .comment-header {
    margin-bottom: 0.5rem;
  }

  .reply-item .comment-content {
    font-size: 0.9rem;
    line-height: 1.4;
  }

  .reply-item .comment-date {
    font-size: 0.8rem;
  }

  .reply-item .comment-actions {
    margin-top: 0.25rem;
  }

  .reply-item .comment-actions button {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    width: 90px;
    height: 28px;
    border-radius: 6px;
    white-space: nowrap;
  }

  /* Animaciones */
  @keyframes slideDown {
    from {
      opacity: 0;
      max-height: 0;
      transform: translateY(-10px);
    }
    to {
      opacity: 1;
      max-height: 300px;
      transform: translateY(0);
    }
  }

  @keyframes fadeInReply {
    from {
      opacity: 0;
      transform: translateX(-10px);
    }
    to {
      opacity: 1;
      transform: translateX(0);
    }
  }

  /* Responsive para respuestas */
  @media (max-width: 768px) {
    .comment-reply-btn {
      background: #28a745 !important;
      color: white !important;
      border: none !important;
      padding: 8px 16px !important;
      border-radius: 6px !important;
      cursor: pointer !important;
      font-size: 14px !important;
      font-weight: 600 !important;
      transition: all 0.3s ease !important;
      display: inline-flex !important;
      align-items: center !important;
      gap: 4px !important;
      justify-content: center !important;
      min-width: 100px !important;
      height: 36px !important;
      white-space: nowrap !important;
      font-family: inherit !important;
      box-shadow: 0 2px 8px rgba(40, 167, 69, 0.2) !important;
    }

    .comment-reply-btn:hover {
      background: linear-gradient(135deg, #218838, #1e7e34) !important;
      transform: translateY(-1px) !important;
      box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3) !important;
    }

    .comment-reply-btn:active {
      transform: translateY(0) !important;
    }

    /* Forzar color verde en móvil con máxima prioridad */
    @media (max-width: 768px) {
      .comment-reply-btn {
        background: #28a745 !important;
        background-image: none !important;
        color: white !important;
        border: 1px solid #218838 !important;
        box-shadow: 0 2px 8px rgba(40, 167, 69, 0.2) !important;
      }

      .comment-reply-btn:hover {
        background: #218838 !important;
        background-image: none !important;
        border-color: #1e7e34 !important;
      }
    }

    .reply-section {
      margin-top: 1rem !important;
      padding: 1rem !important;
      background: #f8f9fa !important;
      border-radius: 8px !important;
      border: 1px solid #e9ecef !important;
      animation: slideDown 0.3s ease !important;
    }

    .reply-input-container {
      display: flex !important;
      flex-direction: column !important;
      gap: 0.75rem !important;
    }

    .reply-textarea {
      width: 100% !important;
      min-height: 80px !important;
      padding: 0.75rem !important;
      border: 2px solid #667eea !important;
      border-radius: 8px !important;
      font-family: inherit !important;
      font-size: 0.95rem !important;
      resize: vertical !important;
      box-sizing: border-box !important;
      transition: all 0.2s ease !important;
    }

    .reply-textarea:focus {
      outline: none !important;
      border-color: #5a6fd8 !important;
      box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
    }

    .reply-textarea::placeholder {
      color: #999 !important;
      font-style: italic !important;
    }

    .reply-buttons {
      display: flex !important;
      gap: 0.5rem !important;
      justify-content: flex-end !important;
    }

    .reply-send-btn,
    .reply-cancel-btn {
      padding: 0.5rem 1rem !important;
      border-radius: 6px !important;
      cursor: pointer !important;
      font-size: 0.9rem !important;
      font-weight: 500 !important;
      transition: all 0.2s ease !important;
      border: none !important;
    }

    .replies-section {
      padding: 0.75rem;
      margin-top: 1rem;
    }

    .reply-item {
      margin-left: 0.5rem;
      padding: 0.5rem;
    }

    .reply-item::before {
      left: -1rem;
      font-size: 0.8rem;
    }
  }
}

/* ===== SISTEMA DE NOTIFICACIONES ===== */

.notification-container {
    position: relative;
    display: inline-block;
}

.notification-btn {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    position: relative;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.notification-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.notification-btn.has-notifications {
    animation: bellShake 0.5s ease-in-out;
}

@keyframes bellShake {
    0%, 100% { transform: rotate(0); }
    20% { transform: rotate(15deg); }
    40% { transform: rotate(-15deg); }
    60% { transform: rotate(10deg); }
    80% { transform: rotate(-10deg); }
}

.notification-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e74c3c;
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
}

.notification-count.visible {
    display: inline-flex !important;
}

.notification-count.hidden {
    display: none !important;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 350px;
    max-height: 400px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    overflow: hidden;
    animation: dropdownSlide 0.2s ease;
}

@keyframes dropdownSlide {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.notification-header h4 {
    margin: 0;
    font-size: 1rem;
}

.mark-all-read-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.3s;
}

.mark-all-read-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.notification-list {
    max-height: 320px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
}

.notification-item:hover {
    background: #f8f9fa;
}

.notification-item.unread {
    background: #e8f4fd;
    border-left: 3px solid #667eea;
}

.notification-item.unread:hover {
    background: #d4e8f7;
}

.notification-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: #2c3e50;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notification-message {
    font-size: 0.8rem;
    color: #666;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.notification-time {
    font-size: 0.7rem;
    color: #999;
    margin-top: 0.25rem;
}

.no-notifications {
    text-align: center;
    padding: 2rem;
    color: #999;
    font-size: 0.9rem;
}

/* Responsive para móviles */
@media (max-width: 768px) {
    .notification-dropdown {
        position: fixed !important;
        top: 60px !important;
        right: 10px !important;
        left: 10px !important;
        width: auto !important;
        max-height: 70vh !important;
        z-index: 99999 !important;
    }

    .notification-container {
        display: inline-block !important;
        position: relative !important;
    }

    .notification-btn {
        font-size: 1.3rem !important;
        padding: 0.4rem !important;
        position: relative !important;
    }

    .notification-count {
        position: absolute !important;
        top: -2px !important;
        right: -2px !important;
        font-size: 0.65rem !important;
        min-width: 20px !important;
        height: 20px !important;
        z-index: 10 !important;
    }

    .notification-count.visible {
        display: inline-flex !important;
    }
}

/* Modal de Gestión de Invitaciones */
.invitation-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    animation: fadeIn 0.3s ease;
}

.invitation-modal-content {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    width: 90%;
}

.invitation-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f0f0f0;
}

.invitation-modal-header h3 {
    color: #2c3e50;
    font-size: 1.5rem;
    font-weight: 600;
}

.close-invitation-modal {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.close-invitation-modal:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

.invitation-modal-body {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.create-code-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1.5rem;
    border-radius: 12px;
    color: white;
}

.create-code-section h4 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.create-code-section .form-group {
    margin-bottom: 1rem;
}

.create-code-section label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.create-code-section input,
.create-code-section select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: #2c3e50;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.create-code-section input:focus,
.create-code-section select:focus {
    outline: none;
    border-color: #fff;
    background: white;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

.create-code-section small {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.8rem;
    opacity: 0.9;
}

.generate-code-btn {
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: white;
    color: #667eea;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.generate-code-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.generated-code-result {
    margin-top: 1.5rem;
}

.generated-code-box {
    background: rgba(255, 255, 255, 0.15);
    padding: 1.5rem;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.code-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.code-value {
    font-size: 2rem;
    font-weight: bold;
    letter-spacing: 0.2rem;
    text-align: center;
    background: white;
    color: #667eea;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    text-transform: uppercase;
}

.copy-code-btn {
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: #27ae60;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

.copy-code-btn:hover {
    background: #229954;
    transform: translateY(-2px);
}

.code-instructions {
    margin-top: 1rem;
    font-size: 0.85rem;
    line-height: 1.4;
}

.codes-list-section h4 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.codes-list {
    display: grid;
    gap: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

.code-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e6ed;
    transition: all 0.3s ease;
}

.code-item.used {
    opacity: 0.6;
    background: #e9ecef;
}

.code-item:hover {
    background: #f0f8ff;
    border-color: #667eea;
    transform: translateX(5px);
}

.code-info {
    flex: 1;
}

.code-text {
    font-weight: 700;
    color: #2c3e50;
    font-size: 1.1rem;
    letter-spacing: 0.1rem;
    margin-bottom: 0.25rem;
}

.code-meta {
    font-size: 0.85rem;
    color: #666;
}

.code-role {
    font-size: 0.85rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    color: white;
    display: inline-block;
    margin-left: 0.5rem;
}

.code-role.admin {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.code-role.contratista {
    background: linear-gradient(135deg, #27ae60, #229954);
}

.code-role.interventoria {
    background: linear-gradient(135deg, #3498db, #2980b9);
}

.code-role.supervision {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
}

.code-role.ordenador_gasto {
    background: linear-gradient(135deg, #f39c12, #d68910);
}

.code-status {
    font-size: 0.8rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    background: #27ae60;
    color: white;
    display: inline-block;
}

.code-status.used {
    background: #95a5a6;
}

.code-status.expired {
    background: #e74c3c;
}

.loading-codes {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 2rem;
}

.no-codes {
    text-align: center;
    color: #999;
    padding: 2rem;
    font-style: italic;
}

.delete-code-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.delete-code-btn:hover {
    background: #c0392b;
    transform: scale(1.1);
}

/* Modal de Registro con Código */
.register-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    animation: fadeIn 0.3s ease;
}

.register-modal-content {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    width: 90%;
    position: relative;
    z-index: 2;
}

.register-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f0f0f0;
}

.register-modal-header h3 {
    color: #2c3e50;
    font-size: 1.5rem;
    font-weight: 600;
}

.close-register-modal {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
    position: relative;
    z-index: 10;
}

.close-register-modal:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

.register-modal-body .form-group {
    margin-bottom: 1.5rem;
}

.register-modal-body label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9rem;
}

.register-modal-body input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e0e6ed;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
    box-sizing: border-box;
}

.register-modal-body input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: white;
}

.register-modal-body small {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: #666;
}

.register-btn {
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.register-btn:hover {
    background: linear-gradient(135deg, #5a6fd8, #6b46a1);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.login-link {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e0e6ed;
}

.login-link p {
    color: #666;
    font-size: 0.9rem;
}

.login-link a {
    color: #667eea;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
}

.login-link a:hover {
    color: #764ba2;
    text-decoration: underline;
}

@media (max-width: 768px) {
    .invitation-modal-content,
    .register-modal-content {
        width: 95% !important;
        max-width: none !important;
        padding: 1.5rem !important;
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        margin: 0 !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
    }

    .code-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .codes-list {
        max-height: 300px;
    }

    .code-value {
        font-size: 1.5rem;
    }
  
    .close-register-modal {
        width: 36px;
        height: 36px;
        font-size: 1.2rem;
        position: relative;
        z-index: 10 !important;
        flex-shrink: 0;
    }
  
    .register-modal-header {
        position: relative;
        z-index: 5;
    }
}
