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

:root {
  --primary-orange: #ff6b35;
  --primary-blue: #2e86ab;
  --primary-white: #ffffff;
  --light-gray: #f8f9fa;
  --dark-gray: #6c757d;
  --success-green: #28a745;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 8px 15px rgba(0, 0, 0, 0.2);
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, var(--light-gray) 0%, #e3f2fd 100%);
  min-height: 100vh;
  color: #333;
}

/* Estilos para login y registro */
.auth-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

.auth-card {
  background: var(--primary-white);
  padding: 40px;
  border-radius: 20px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 400px;
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.auth-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
}

.logo {
  font-size: 28px;
  font-weight: bold;
  color: var(--primary-blue);
  margin-bottom: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.logo::before {
  content: "📊";
  font-size: 32px;
}

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

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--dark-gray);
  font-weight: 500;
}

.form-control {
  width: 100%;
  padding: 15px;
  border: 2px solid #e9ecef;
  border-radius: 10px;
  font-size: 16px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(46, 134, 171, 0.1);
}

.btn {
  padding: 15px 30px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-orange) 0%, #ff8a50 100%);
  color: var(--primary-white);
  width: 100%;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.btn-secondary {
  background: var(--primary-blue);
  color: var(--primary-white);
}

.btn-secondary:hover {
  background: #1e5f7a;
}

.auth-link {
  margin-top: 20px;
  color: var(--primary-blue);
  text-decoration: none;
  font-weight: 500;
}

.auth-link:hover {
  text-decoration: underline;
}

/* Layout del panel */
.dashboard {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 280px;
  background: var(--primary-white);
  box-shadow: var(--shadow);
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  z-index: 1000;
}

.sidebar-header {
  padding: 30px 20px;
  border-bottom: 1px solid #e9ecef;
  text-align: center;
}

.sidebar-header .logo {
  font-size: 20px;
  margin-bottom: 10px;
}

.user-info {
  color: var(--dark-gray);
  font-size: 14px;
}

.sidebar-menu {
  padding: 20px 0;
}

.menu-item {
  display: block;
  padding: 15px 25px;
  color: #333;
  text-decoration: none;
  transition: all 0.3s ease;
  border-left: 4px solid transparent;
}

.menu-item:hover,
.menu-item.active {
  background: linear-gradient(90deg, rgba(255, 107, 53, 0.1) 0%, rgba(255, 107, 53, 0.05) 100%);
  border-left-color: var(--primary-orange);
  color: var(--primary-orange);
}

.menu-item i {
  margin-right: 12px;
  width: 20px;
}

.main-content {
  flex: 1;
  margin-left: 280px;
  padding: 30px;
  background: var(--light-gray);
}

.welcome-header {
  background: var(--primary-white);
  padding: 25px;
  border-radius: 15px;
  box-shadow: var(--shadow);
  margin-bottom: 30px;
}

.welcome-title {
  font-size: 28px;
  color: var(--primary-blue);
  margin-bottom: 5px;
}

.welcome-subtitle {
  color: var(--dark-gray);
}

/* Tarjetas */
.card {
  background: var(--primary-white);
  border-radius: 15px;
  box-shadow: var(--shadow);
  padding: 25px;
  margin-bottom: 25px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.card-title {
  font-size: 20px;
  color: var(--primary-blue);
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Barra de progreso */
.progress-container {
  margin: 20px 0;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-weight: 500;
}

.progress-bar {
  width: 100%;
  height: 12px;
  background: #e9ecef;
  border-radius: 6px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--success-green) 0%, #34ce57 100%);
  border-radius: 6px;
  transition: width 0.8s ease;
  position: relative;
}

.progress-fill::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Chat de mensajes */
.chat-container {
  height: 400px;
  border: 1px solid #e9ecef;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
}

.chat-messages {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  background: #f8f9fa;
}

.message {
  margin-bottom: 15px;
  padding: 12px 15px;
  border-radius: 15px;
  max-width: 70%;
  word-wrap: break-word;
}

.message.sent {
  background: var(--primary-blue);
  color: var(--primary-white);
  margin-left: auto;
  border-bottom-right-radius: 5px;
}

.message.received {
  background: var(--primary-white);
  border: 1px solid #e9ecef;
  border-bottom-left-radius: 5px;
}

.message-time {
  font-size: 12px;
  opacity: 0.7;
  margin-top: 5px;
}

.chat-input {
  display: flex;
  padding: 15px;
  border-top: 1px solid #e9ecef;
  background: var(--primary-white);
}

.chat-input input {
  flex: 1;
  padding: 10px 15px;
  border: 1px solid #e9ecef;
  border-radius: 25px;
  margin-right: 10px;
}

.chat-input button {
  padding: 10px 20px;
  background: var(--primary-orange);
  color: var(--primary-white);
  border: none;
  border-radius: 25px;
  cursor: pointer;
}

/* Tabla de usuarios */
.table-container {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--primary-white);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

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

.table th {
  background: var(--primary-blue);
  color: var(--primary-white);
  font-weight: 600;
}

.table tr:hover {
  background: rgba(255, 107, 53, 0.05);
}

/* Lista de archivos */
.file-list {
  list-style: none;
}

.file-item {
  display: flex;
  align-items: center;
  padding: 15px;
  border: 1px solid #e9ecef;
  border-radius: 10px;
  margin-bottom: 10px;
  background: var(--primary-white);
  transition: all 0.3s ease;
}

.file-item:hover {
  border-color: var(--primary-orange);
  transform: translateX(5px);
}

.file-icon {
  font-size: 24px;
  margin-right: 15px;
  color: var(--primary-blue);
}

.file-info {
  flex: 1;
}

.file-name {
  font-weight: 500;
  margin-bottom: 5px;
}

.file-date {
  font-size: 12px;
  color: var(--dark-gray);
}

/* Toggle switches */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary-orange);
}

input:checked + .slider:before {
  transform: translateX(26px);
}

/* Alertas */
.alert {
  padding: 15px 20px;
  border-radius: 10px;
  margin-bottom: 20px;
  border-left: 4px solid;
}

.alert-success {
  background: #d4edda;
  color: #155724;
  border-left-color: var(--success-green);
}

.alert-error {
  background: #f8d7da;
  color: #721c24;
  border-left-color: #dc3545;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
  background-color: var(--primary-white);
  margin: 5% auto;
  padding: 30px;
  border-radius: 15px;
  width: 90%;
  max-width: 500px;
  box-shadow: var(--shadow-hover);
}

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.close:hover {
  color: #000;
}

/* Header móvil */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--primary-white);
  box-shadow: var(--shadow);
  z-index: 1002;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.mobile-logo {
  font-size: 20px;
  font-weight: bold;
  color: var(--primary-blue);
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-logo::before {
  content: "📊";
  font-size: 24px;
}

.mobile-menu-btn {
  background: var(--primary-orange);
  color: var(--primary-white);
  border: none;
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.3s ease;
}

.mobile-menu-btn:hover {
  background: #e55a2b;
  transform: scale(1.05);
}

/* Responsive */
@media (max-width: 768px) {
  .mobile-header {
    display: flex !important;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    z-index: 1001;
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .sidebar.active .sidebar-header {
    text-align: center;
  }

  .sidebar.active .sidebar-header .logo {
    font-size: 24px;
    margin-bottom: 20px;
    justify-content: center;
  }

  .sidebar.active .sidebar-header .user-info {
    text-align: center;
  }

  /* Overlay cuando el menú está abierto */
  .sidebar.active::after {
    content: "";
    position: fixed;
    top: 0;
    left: 280px;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
  }

  .main-content {
    margin-left: 0;
    padding: 80px 15px 20px 15px;
    min-height: 100vh;
  }

  .auth-card {
    padding: 25px 15px;
    margin: 10px;
  }

  .welcome-header {
    padding: 15px;
    margin-bottom: 20px;
  }

  .welcome-title {
    font-size: 20px;
  }

  .welcome-subtitle {
    font-size: 14px;
  }

  .card {
    padding: 15px;
    margin-bottom: 15px;
  }

  .card-title {
    font-size: 18px;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  /* Formularios móviles */
  .form-group {
    margin-bottom: 15px;
  }

  .form-control {
    padding: 12px;
    font-size: 16px;
  }

  .btn {
    padding: 12px 20px;
    font-size: 14px;
    width: 100%;
    margin-bottom: 10px;
  }

  .btn-secondary {
    width: auto;
    padding: 8px 15px;
    font-size: 12px;
    margin: 2px;
  }

  /* Tablas completamente responsive */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: -15px;
    padding: 15px;
  }

  .table {
    min-width: 100%;
    font-size: 12px;
    border-radius: 0;
  }

  .table th,
  .table td {
    padding: 8px 6px;
    font-size: 11px;
    white-space: nowrap;
    min-width: 80px;
  }

  .table th:first-child,
  .table td:first-child {
    min-width: 40px;
  }

  .table th:last-child,
  .table td:last-child {
    min-width: 100px;
    text-align: center;
  }

  /* Botones en tablas más compactos */
  .table .btn {
    padding: 4px 8px;
    font-size: 10px;
    margin: 1px;
    width: auto;
    min-width: 30px;
  }

  .table .btn i {
    margin: 0;
    font-size: 10px;
  }

  /* Ocultar texto en botones móviles, solo iconos */
  .table .btn-secondary {
    padding: 6px;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Formularios en línea más compactos */
  .table form {
    display: inline-block;
    margin: 0;
  }

  /* Chat móvil */
  .chat-container {
    height: 300px;
    margin: -15px;
    border-radius: 0;
  }

  .chat-messages {
    padding: 10px;
  }

  .message {
    max-width: 85%;
    font-size: 14px;
    padding: 10px 12px;
    margin-bottom: 10px;
  }

  .message-time {
    font-size: 10px;
  }

  .chat-input {
    padding: 10px;
  }

  .chat-input input {
    padding: 8px 12px;
    font-size: 14px;
  }

  .chat-input button {
    padding: 8px 15px;
    font-size: 14px;
  }

  /* Archivos móviles */
  .file-list {
    margin: -15px;
    padding: 0;
  }

  .file-item {
    margin: 0 0 10px 0;
    padding: 10px;
    border-radius: 0;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }

  .file-icon {
    margin-bottom: 5px;
    margin-right: 0;
  }

  .file-info {
    margin-bottom: 10px;
    width: 100%;
  }

  .file-name {
    font-size: 14px;
    word-break: break-word;
  }

  .file-date {
    font-size: 11px;
  }

  /* Formularios de archivos */
  .card form > div[style*="display: flex"] {
    display: flex !important;
    flex-direction: column !important;
    gap: 15px !important;
  }

  .card form > div[style*="display: flex"] > div {
    flex: none !important;
  }

  .card form > div[style*="display: flex"] > button {
    align-self: stretch;
  }

  /* Mensajes en empresa - layout móvil */
  .card > div[style*="display: flex"] {
    display: flex !important;
    flex-direction: column !important;
    gap: 15px !important;
  }

  .card > div[style*="display: flex"] > div {
    flex: none !important;
  }

  /* Lista de clientes en mensajes */
  .card > div[style*="display: flex"] > div:first-child ul {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }

  .card > div[style*="display: flex"] > div:first-child li {
    flex: 1;
    min-width: calc(50% - 5px);
    margin-bottom: 0 !important;
  }

  .card > div[style*="display: flex"] > div:first-child .btn {
    width: 100% !important;
    padding: 10px !important;
    font-size: 12px !important;
    text-align: center !important;
  }

  /* Modal móvil */
  .modal-content {
    margin: 10% 5%;
    padding: 20px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
  }

  /* Alertas móviles */
  .alert {
    margin: -15px -15px 15px -15px;
    border-radius: 0;
    padding: 12px 15px;
    font-size: 14px;
  }

  /* Progreso móvil */
  .progress-container {
    margin: 15px 0;
  }

  .progress-info {
    font-size: 14px;
    margin-bottom: 8px;
  }

  .progress-bar {
    height: 10px;
  }

  /* Configuraciones móviles */
  .toggle-switch {
    width: 50px;
    height: 28px;
  }

  .slider:before {
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
  }

  input:checked + .slider:before {
    transform: translateX(22px);
  }

  /* Mostrar elementos móviles */
  .mobile-menu-btn {
    display: block !important;
  }

  /* Mejorar legibilidad */
  body {
    font-size: 14px;
    line-height: 1.4;
  }

  /* Espaciado general */
  .dashboard {
    min-height: 100vh;
  }

  /* Evitar scroll horizontal */
  body,
  html {
    overflow-x: hidden;
    width: 100%;
  }

  .main-content {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .card {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }
}

/* Ocultar el botón móvil en desktop */
@media (min-width: 769px) {
  .mobile-menu-btn {
    display: none !important;
  }

  .mobile-header {
    display: none !important;
  }
}

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

.card,
.auth-card {
  animation: fadeIn 0.6s ease;
}

/* Utilidades */
.text-center {
  text-align: center;
}
.text-right {
  text-align: right;
}
.mb-20 {
  margin-bottom: 20px;
}
.mt-20 {
  margin-top: 20px;
}
.hidden {
  display: none;
}
.flex {
  display: flex;
}
.justify-between {
  justify-content: space-between;
}
.align-center {
  align-items: center;
}
.gap-10 {
  gap: 10px;
}

.mobile-menu-btn {
  display: none;
  background: var(--primary-orange);
  color: var(--primary-white);
  border: none;
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.3s ease;
}

.mobile-menu-btn:hover {
  background: #e55a2b;
  transform: scale(1.05);
}

/* Mejoras para tablas en móvil */
@media (max-width: 768px) {
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table {
    min-width: 600px;
    font-size: 14px;
  }

  .table th,
  .table td {
    padding: 10px 8px;
    white-space: nowrap;
  }

  .table th {
    font-size: 13px;
  }

  .table td {
    font-size: 12px;
  }

  /* Botones en tablas más pequeños en móvil */
  .table .btn {
    padding: 8px 12px;
    font-size: 12px;
  }

  .table .btn i {
    margin-right: 4px;
  }

  /* Ajustar formularios en línea */
  .table form {
    display: inline-block;
  }

  /* Mejorar espaciado en acciones */
  .table td:last-child {
    min-width: 120px;
  }

  /* Hacer que las tablas sean más legibles */
  .table tr:nth-child(even) {
    background-color: rgba(248, 249, 250, 0.5);
  }

  /* Ajustar el contenedor de chat en móvil */
  .chat-container {
    height: 250px;
  }

  /* Mejorar la vista de mensajes en móvil */
  .message {
    max-width: 90%;
    font-size: 14px;
  }

  .message-time {
    font-size: 11px;
  }

  /* Ajustar formularios de archivos en móvil */
  .form-group {
    margin-bottom: 15px;
  }

  /* Mejorar el layout de archivos en empresa */
  .card > div[style*="display: flex"] {
    flex-direction: column !important;
    gap: 15px !important;
  }

  .card > div[style*="display: flex"] > div {
    flex: none !important;
  }

  /* Ajustar el formulario de subida de archivos */
  .card form > div[style*="display: flex"] {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .card form > div[style*="display: flex"] > div {
    flex: none !important;
    margin-bottom: 15px;
  }

  .card form > div[style*="display: flex"] > button {
    align-self: flex-start;
  }
}

/* Botón ver/ocultar contraseña */
.btn-toggle-password {
    position: absolute;
    right: 10px;
    top: 38px;
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    font-size: 16px;
    padding: 5px;
    transition: color 0.2s;
}

.btn-toggle-password:hover {
    color: #2e86ab;
}

/* Botón eliminar */
.btn-delete {
    color: #dc3545 !important;
    background: none !important;
    border: none !important;
    padding: 5px 8px !important;
    cursor: pointer;
    font-size: 16px;
    transition: color 0.2s;
}

.btn-delete:hover {
    color: #c82333 !important;
}