/* Reset y configuración base */
* { 
  margin: 0; 
  padding: 0; 
  box-sizing: border-box; 
}

body { 
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: white;
  min-height: 100vh;
  color: #333;
}

/* Modal de login */
.login-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.3s ease-out;
}

.login-modal-content {
  background: white;
  border-radius: 20px;
  padding: 40px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  animation: slideUp 0.3s ease-out;
  position: relative;
}

.login-header {
  text-align: center;
  margin-bottom: 30px;
}

.login-header h2 {
  color: #333;
  font-size: 24px;
  margin-bottom: 8px;
  font-weight: 600;
}

.login-header p {
  color: #666;
  font-size: 14px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.login-input-group {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.login-input-group input {
  padding: 15px 20px;
  border: 2px solid #e1e1e1;
  border-radius: 12px;
  font-size: 16px;
  transition: all 0.2s ease;
  background: #f8f9fa;
}

.login-input-group input:focus {
  outline: none;
  border-color: #25D366;
  background: white;
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

.login-btn {
  background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
  color: white;
  border: none;
  padding: 15px 25px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(37, 211, 102, 0.3);
}

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

.login-spinner {
  animation: spin 1s linear infinite;
}

.login-error {
  background: #fee;
  color: #c33;
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
  text-align: center;
  border-left: 4px solid #c33;
  display: none;
}

.login-footer {
  text-align: center;
  margin-top: 25px;
  color: #999;
  font-size: 12px;
}

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

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

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Contenedor principal */
.container { 
  max-width: 1400px; 
  margin: 0 auto; 
  padding: 20px;
  background: rgba(255,255,255,0.95);
  border-radius: 15px;
  margin-top: 20px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

/* Header */
h1 { 
  text-align: center; 
  color: #000000; 
  margin-bottom: 30px;
  font-size: 2.5em;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.header {
  background: black;
  color: white;
  padding: 20px;
  border-radius: 15px;
  margin-bottom: 30px;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.header-text {
  text-align: center;
  flex: 1;
}

.logout-btn {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
  padding: 10px 20px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.logout-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-2px);
}

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

@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 15px;
  }
  
  .header-text {
    text-align: center;
  }
}

.header h1 {
  color: white;
}

.header h2 {
  font-size: 1.5em;
  margin-bottom: 10px;
}

/* Sistema de pestañas */
.tabs {
  display: flex;
  background: #f8f9fa;
  border-radius: 10px;
  margin-bottom: 30px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.tab {
  flex: 1;
  padding: 15px 20px;
  background: #f8f9fa;
  border: none;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.tab.active {
  background: #000000;
  color: white;
}

.tab:hover:not(.active) {
  background: #e9ecef;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Contenedores de tabla */
.table-container {
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid #e9ecef;
  vertical-align: top;
}

/* Estilos específicos para la columna de mensaje */
td:nth-child(3) {
  max-width: 400px;
  word-wrap: break-word;
  word-break: break-word;
  white-space: normal;
  line-height: 1.4;
}

/* Estilos para columnas específicas - ajuste de ancho */
/* Columna de estado (5ª columna) - 30px más estrecha */
td:nth-child(5) {
  width: 120px; /* Reducir de ~150px a 120px */
  min-width: 120px;
  max-width: 120px;
}

/* Columna de plantilla (6ª columna) - 60px más estrecha */
td:nth-child(6) {
  width: 140px; /* Reducir de ~200px a 140px */
  min-width: 140px;
  max-width: 140px;
}

/* Estilos para previsualización de mensajes según el remitente */
.message-preview-assistant {
  color: #ff8c00; /* Naranja */
  font-weight: normal;
  font-size: 12px;
}

.message-preview-customer {
  color: #000000; /* Negro */
  font-weight: bold;
  font-size: 12px;
}

th {
  background: #f8f9fa;
  font-weight: 600;
  color: #495057;
}

tr:hover {
  background: #f8f9fa;
}

/* Chips de estado */
.status-chip {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  display: inline-block;
  min-width: 80px;
}

.status-custom {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
  font-weight: 600;
}

.status-template {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f1b0b7;
  font-weight: 600;
}

.status-unknown {
  background: #e2e3e5;
  color: #383d41;
  border: 1px solid #d1d3d4;
}

/* Mantener compatibilidad */
.status-success {
  background: #d4edda;
  color: #155724;
}

.status-warning {
  background: #fff3cd;
  color: #856404;
}

.status-error {
  background: #f8d7da;
  color: #721c24;
}

/* Botones base */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

/* Variantes de botones */
.btn.primary {
  background: #000000;
  color: white;
}

.btn.primary:hover:not(:disabled) {
  background: #333333;
}

.btn.primary:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.btn.secondary {
  background: #f8f9fa;
  color: #6c757d;
  border: 1px solid #dee2e6;
}

.btn.secondary:hover {
  background: #e9ecef;
}

.btn-info {
  background: #17a2b8;
  color: white;
}

.btn-info:hover {
  background: #138496;
}

.btn-success {
  background: #28a745;
  color: white;
}

.btn-success:hover:not(:disabled) {
  background: #218838;
}

.btn-success:disabled {
  background: #6c757d;
  cursor: not-allowed;
}

/* Botones pequeños */
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 4px;
  margin: 2px;
}

/* Selects */
.select {
  padding: 8px 12px;
  border: 1px solid #ced4da;
  border-radius: 6px;
  font-size: 14px;
  min-width: 75px;
  max-width: 120px; /* Hacer más estrecho el selector */
  width: 120px; /* Ancho fijo más estrecho */
}

/* Estados de carga */
.loading {
  text-align: center;
  padding: 40px;
  color: #6c757d;
}

/* Grid de estadísticas */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: white;
  padding: 20px;
  border-radius: 10px;
  text-align: center;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.stat-number {
  font-size: 2em;
  font-weight: bold;
  color: #000000;
  margin-bottom: 10px;
}

/* Grid de plantillas */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.template-card {
  background: white;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  border-left: 4px solid #000000;
  position: relative;
}

.template-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.template-name {
  font-weight: 600;
  font-size: 1.1em;
}

/* Alertas */
.alert {
  padding: 15px;
  border-radius: 8px;
  margin: 20px 0;
}

.alert-info {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

/* Utilidades */
.hidden {
  display: none !important;
}

/* Responsive design */
@media (max-width: 768px) {
  .container {
    margin: 10px;
    padding: 15px;
  }
  
  h1 {
    font-size: 2em;
  }
  
  .tabs {
    flex-direction: column;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .template-grid {
    grid-template-columns: 1fr;
  }
  
  .table-container {
    overflow-x: auto;
  }
  
  /* Solo mantener el ancho mínimo para evitar que la tabla se rompa en móvil */
  table {
    min-width: 600px;
  }
  
  /* Ajustes responsive para vista detallada */
  .chat-detail-header {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }
  
  .chat-info h3 {
    font-size: 1.4em;
  }
  
  .chat-messages-list {
    max-height: 400px;
  }
  
  .action-section {
    margin-bottom: 20px;
  }
  
  .custom-message-form textarea {
    min-height: 80px;
  }
}

/* === VISTA DETALLADA DEL CHAT === */
/* Estilos para header con botón */
.section-header-with-button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 0 10px;
}

.btn-new-chat {
  background: #000000;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-new-chat:hover {
  background: #333333;
  transform: translateY(-2px);
}

/* Estilos para modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
}

.modal-content {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  z-index: 1001;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #eee;
}

.modal-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #666;
  padding: 5px;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 24px;
  border-top: 1px solid #eee;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #333;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #000000;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.contacts-list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #f9f9f9;
}

.contact-item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  transition: background 0.2s ease;
}

.contact-item:hover {
  background: #f0f0f0;
}

.contact-item.selected {
  background: #000000;
  color: white;
}

.contact-item:last-child {
  border-bottom: none;
}

.contact-name {
  font-weight: 600;
  margin-bottom: 4px;
}

.contact-phone {
  font-size: 12px;
  color: #666;
}

.contact-item.selected .contact-phone {
  color: #ccc;
}

.selected-contact {
  background: #f8f9fa;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

.contact-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.contact-note {
  font-size: 0.9em;
  color: #6c757d;
  font-style: italic;
  margin-top: 10px;
  margin-bottom: 0;
}

.loading-contacts {
  padding: 20px;
  text-align: center;
  color: #666;
}

/* Mejorar estilos de template cards */

.template-id {
  font-size: 0.8em;
  color: #6c757d;
  font-family: monospace;
}

.chat-detail-view {
  display: none;
  animation: slideInRight 0.3s ease-out;
}

.chat-detail-view.active {
  display: block;
}

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

/* Header de la vista detallada */
.chat-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  background: linear-gradient(135deg, #000000 0%, #20B954 100%);
  color: white;
  border-radius: 15px;
  margin-bottom: 20px;
  box-shadow: 0 4px 15px rgba(37, 211, 102, 0.2);
}

.back-button {
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.back-button:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateX(-5px);
}

.chat-info h3 {
  margin: 0;
  font-size: 1.6em;
  font-weight: 600;
}

.chat-info p {
  margin: 5px 0 0 0;
  opacity: 0.9;
  font-size: 14px;
}

.chat-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 15px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  backdrop-filter: blur(10px);
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #4CAF50;
  animation: pulse 2s infinite;
}

.status-indicator.closed {
  background: #FF9800;
}

.status-indicator.error {
  background: #F44336;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

/* Contenedor de mensajes */
.chat-messages-container {
  background: white;
  border-radius: 15px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
  overflow: hidden;
}

.chat-messages-list {
  max-height: 500px;
  overflow-y: auto;
  padding: 20px;
}

.chat-message {
  display: flex;
  flex-direction: column;
  margin-bottom: 15px;
  padding: 15px;
  border-radius: 12px;
  background: #F5F5F5;
  border-left: 4px solid #000000;
  transition: all 0.3s ease;
}

/* Mensajes del assistant en naranja */
.chat-message.assistant-message {
  background: #FFF3E0;
  border-left: 4px solid #FF9800;
}

.chat-message.assistant-message .message-sender {
  color: #FF9800;
}

/* Mensajes del usuario en verde */
.chat-message.user-message {
  background: #F5F5F5;
  border-left: 4px solid #000000;
}

.chat-message.user-message .message-sender {
  color: #000000;
}

.chat-message:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.message-sender {
  font-weight: 600;
  color: #000000;
  font-size: 14px;
}

.message-date {
  font-size: 12px;
  color: #666;
  opacity: 0.8;
}

.message-content {
  color: #333;
  line-height: 1.5;
  font-size: 14px;
}

.message-id {
  font-size: 11px;
  color: #999;
  margin-top: 5px;
  text-align: right;
}

/* Acciones del chat */
.chat-actions {
  background: white;
  border-radius: 15px;
  padding: 25px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.action-section {
  margin-bottom: 25px;
  padding: 20px;
  border-radius: 12px;
  border: 2px solid #E0E0E0;
  transition: all 0.3s ease;
}

.action-section.active {
  border-color: #000000;
  background: rgba(37, 211, 102, 0.05);
}

.action-section h4 {
  margin: 0 0 10px 0;
  color: #333;
  font-size: 1.2em;
}

.action-description {
  margin: 0 0 15px 0;
  color: #666;
  font-size: 14px;
  line-height: 1.4;
}

/* Formulario de mensaje personalizado */
.custom-message-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.custom-message-form textarea {
  width: 100%;
  padding: 12px;
  border: 2px solid #E0E0E0;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  min-height: 100px;
  transition: border-color 0.3s ease;
}

.custom-message-form textarea:focus {
  outline: none;
  border-color: #000000;
}

/* Formulario de plantilla */
.template-form {
  display: flex;
  gap: 15px;
  align-items: flex-end;
}

.template-form select {
  flex: 1;
  padding: 12px;
  border: 2px solid #E0E0E0;
  border-radius: 8px;
  font-size: 14px;
  background: white;
  transition: border-color 0.3s ease;
}

.template-form select:focus {
  outline: none;
  border-color: #000000;
}

/* Botones de acción */
.action-button {
  padding: 12px 25px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.action-button.primary {
  background: linear-gradient(135deg, #000000 0%, #20B954 100%);
  color: white;
}

.action-button.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.3);
}

.action-button.secondary {
  background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
  color: white;
}

.action-button.secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(33, 150, 243, 0.3);
}

.action-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Información de ventana */
.window-info {
  text-align: center;
  padding: 15px;
  background: #F8F9FA;
  border-radius: 8px;
  border: 1px solid #E0E0E0;
}

.window-status {
  font-weight: 600;
  margin-bottom: 8px;
}

.window-status.open {
  color: #4CAF50;
}

.window-status.closed {
  color: #FF9800;
}

.window-timer {
  font-size: 14px;
  color: #666;
}

#time-remaining {
  font-weight: 600;
  color: #FF9800;
}

/* === ESTILOS PARA MODAL DE ARCHIVOS === */

/* Estilos para el modal de archivos */
.file-preview {
  margin: 15px 0;
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #f9f9f9;
}

.file-preview img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 4px;
}

.file-preview .file-info {
  margin-top: 10px;
  font-size: 0.9em;
  color: #666;
}

.sender-info {
  background: #e3f2fd;
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 15px;
  font-weight: 500;
  color: #1976d2;
}

/* Botón de archivo */
.btn-success {
  background: #28a745;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s ease;
}

.btn-success:hover {
  background: #218838;
}

/* Estilo para mensajes con archivos en la tabla */
.message-preview-assistant a {
  color: #007bff;
  text-decoration: none;
}

.message-preview-assistant a:hover {
  text-decoration: underline;
}

/* Estilos específicos para el modal de archivos */
#file-upload-modal .form-group {
  margin-bottom: 20px;
}

#file-upload-modal .form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #333;
}

#file-upload-modal .form-group input[type="file"] {
  width: 100%;
  padding: 10px;
  border: 2px solid #E0E0E0;
  border-radius: 6px;
  background: white;
  transition: border-color 0.3s ease;
}

#file-upload-modal .form-group input[type="file"]:focus {
  outline: none;
  border-color: #000000;
}

#file-upload-modal .form-group textarea {
  width: 100%;
  min-height: 80px;
  padding: 12px;
  border: 2px solid #E0E0E0;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.3s ease;
}

#file-upload-modal .form-group textarea:focus {
  outline: none;
  border-color: #000000;
}

#file-upload-modal .form-group small {
  display: block;
  margin-top: 5px;
  font-size: 12px;
  color: #666;
  font-style: italic;
}

/* === ESTILOS PARA PREVISUALIZACIONES DE GOOGLE DRIVE === */

/* Contenedor principal de previsualización */
.google-drive-preview {
  margin: 10px 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  background: #f8f9fa;
}

/* Thumbnail clickeable */
.file-thumbnail {
  position: relative;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.file-thumbnail:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Previsualización de imágenes */
.image-preview .drive-thumbnail {
  width: 200px;
  height: 150px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}

/* Previsualización de PDFs */
.pdf-preview {
  display: flex;
  align-items: center;
  padding: 15px;
  background: linear-gradient(135deg, #ff6b6b, #ee5a52);
  color: white;
}

.pdf-preview .file-icon {
  font-size: 2.5em;
  margin-right: 15px;
}

.file-details {
  flex: 1;
}

.file-type {
  font-weight: bold;
  font-size: 1.1em;
  display: block;
  margin-bottom: 5px;
}

/* Previsualización de archivos genéricos */
.file-preview {
  display: flex;
  align-items: center;
  padding: 15px;
  background: linear-gradient(135deg, #4ecdc4, #44a08d);
  color: white;
}

.file-preview .file-icon {
  font-size: 2.5em;
  margin-right: 15px;
}

/* Overlay de hover */
.preview-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.7);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  font-weight: bold;
  font-size: 14px;
}

.file-thumbnail:hover .preview-overlay {
  opacity: 1;
}

/* Enlaces de Google Drive reemplazados */
.drive-link-replaced {
  background: #e3f2fd;
  color: #1976d2;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.9em;
  font-style: italic;
}

/* === MODAL DE GOOGLE DRIVE === */
.google-drive-modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.8);
  justify-content: center;
  align-items: center;
}

.google-drive-modal .modal-content {
  background: white;
  border-radius: 12px;
  max-width: 90vw;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

/* Modal para imágenes */
.image-modal-content {
  width: auto;
  min-width: 400px;
}

.image-container {
  text-align: center;
  padding: 20px;
}

.modal-image {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Modal para PDFs */
.pdf-modal-content {
  width: 80vw;
  height: 80vh;
}

.pdf-container {
  height: 600px;
  border-radius: 8px;
  overflow: hidden;
}

/* Modal para archivos genéricos */
.file-modal-content {
  width: 400px;
}

.file-info-container {
  text-align: center;
  padding: 40px 20px;
}

.file-icon-large {
  font-size: 4em;
  margin-bottom: 20px;
}

/* Header del modal */
.google-drive-modal .modal-header {
  background: #f8f9fa;
  padding: 15px 20px;
  border-bottom: 1px solid #dee2e6;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.google-drive-modal .modal-header h3 {
  margin: 0;
  color: #333;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: #333;
  background: #e9ecef;
  border-radius: 50%;
}

/* Footer del modal */
.google-drive-modal .modal-footer {
  background: #f8f9fa;
  padding: 15px 20px;
  border-top: 1px solid #dee2e6;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* Responsive */
@media (max-width: 768px) {
  .image-preview .drive-thumbnail {
    width: 150px;
    height: 120px;
  }
  
  .google-drive-modal .modal-content {
    margin: 10px;
    max-width: calc(100vw - 20px);
  }
  
  .pdf-modal-content {
    width: 95vw;
    height: 70vh;
  }
  
  .pdf-container {
    height: 400px;
  }
}
