/* Estilos personalizados para Connectum Instaladores */

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

.fade-in {
  animation: fadeIn 0.3s ease-out;
}

/* Estilos de scrollbar personalizados */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 8px;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 8px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Cards de tickets - Mejorados */
.ticket-card {
  @apply bg-white rounded-xl border border-slate-200 p-4 cursor-pointer;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-bottom: 12px;
}

.ticket-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  border-color: #0ea5e9;
}

.ticket-card:active {
  transform: translateY(-2px);
}

/* Badge de estado */
.status-badge {
  @apply inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium;
}

.status-solicitado {
  @apply bg-slate-100 text-slate-700;
}

.status-enproceso {
  @apply bg-amber-100 text-amber-700;
}

.status-completado {
  @apply bg-emerald-100 text-emerald-700;
}

/* Badge de prioridad */
.priority-badge {
  @apply inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium;
}

.priority-alta {
  @apply bg-red-100 text-red-700;
}

.priority-media {
  @apply bg-yellow-100 text-yellow-700;
}

.priority-baja {
  @apply bg-blue-100 text-blue-700;
}

/* ========== GLASSMORPHISM EFFECTS ========== */
.glass {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Auth Screen Glass Card */
.auth-glass-card {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 
    0 8px 32px 0 rgba(31, 38, 135, 0.15),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.8);
}

/* Auth Tabs */
.auth-tab {
  background: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(203, 213, 225, 0.3);
  color: #64748b;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.auth-tab:hover:not(.active) {
  background: rgba(255, 255, 255, 0.5);
  border-color: rgba(148, 163, 184, 0.4);
  color: #475569;
  transform: translateY(-1px);
}

.auth-tab.active {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.1) 0%, rgba(59, 130, 246, 0.1) 100%);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(14, 165, 233, 0.3);
  color: #0284c7;
  font-weight: 700;
  box-shadow: 
    0 4px 16px rgba(14, 165, 233, 0.2),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.5);
}

/* Auth Inputs */
.auth-input {
  background: rgba(248, 250, 252, 0.8);
  backdrop-filter: blur(8px);
  border: 1.5px solid rgba(226, 232, 240, 0.6);
  box-shadow: 
    0 1px 3px rgba(0, 0, 0, 0.05),
    inset 0 1px 2px rgba(255, 255, 255, 0.8);
  color: #1e293b;
  font-weight: 500;
}

.auth-input:focus {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(14, 165, 233, 0.5);
  box-shadow: 
    0 0 0 3px rgba(14, 165, 233, 0.1),
    0 4px 12px rgba(14, 165, 233, 0.15),
    inset 0 1px 2px rgba(255, 255, 255, 0.9);
}

.auth-input::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

/* Submit Buttons with Gradient */
.auth-submit-btn {
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 50%, #0369a1 100%);
  box-shadow: 
    0 4px 16px rgba(14, 165, 233, 0.4),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(2, 132, 199, 0.5);
}

.auth-submit-btn:hover {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 50%, #075985 100%);
  box-shadow: 
    0 6px 24px rgba(14, 165, 233, 0.5),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.3);
}

.auth-submit-btn-register {
  background: linear-gradient(135deg, #10b981 0%, #059669 50%, #047857 100%);
  box-shadow: 
    0 4px 16px rgba(16, 185, 129, 0.4),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(5, 150, 105, 0.5);
}

.auth-submit-btn-register:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 50%, #065f46 100%);
  box-shadow: 
    0 6px 24px rgba(16, 185, 129, 0.5),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.3);
}

/* Form Container Transitions */
.auth-form-container {
  animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ========== OFFCANVAS MENU ========== */
.nav-menu-btn:hover {
  transform: translateY(-1px);
}

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

#offcanvas-menu.show {
  transform: translateX(0);
}

#offcanvas-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.offcanvas-item {
  transition: all 0.2s ease;
}

.offcanvas-item.active {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.15) 0%, rgba(59, 130, 246, 0.15) 100%);
  color: #0284c7;
}

.offcanvas-item.active .h-10 {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.2) 0%, rgba(59, 130, 246, 0.2) 100%);
}

/* User Filter Buttons */
.user-filter-btn {
  transition: all 0.2s ease;
}

.user-filter-btn.active {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.15) 0%, rgba(59, 130, 246, 0.15) 100%);
  border-color: rgba(14, 165, 233, 0.4);
  color: #0284c7;
  font-weight: 600;
}

/* Transiciones suaves para modales */
#ticket-modal,
#login-screen {
  transition: opacity 0.3s ease-out;
}

#ticket-modal.hidden,
#login-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

#ticket-modal:not(.hidden),
#login-screen:not(.hidden) {
  opacity: 1;
}

/* Estilos para formularios */
input:focus,
textarea:focus,
select:focus {
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

/* Radio buttons personalizados para tipo de servicio */
input[type="radio"]:checked + div {
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.2);
}

/* Hover effects para botones */
button {
  transition: all 0.2s ease-out;
}

button:active {
  transform: scale(0.98);
}

/* Loader spinner */
.spinner {
  border: 3px solid rgba(14, 165, 233, 0.1);
  border-top-color: #0ea5e9;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  animation: spin 0.6s linear infinite;
}

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

/* Estados empty para tableros */
.board-empty {
  @apply flex flex-col items-center justify-center py-12 text-center text-slate-400;
}

.board-empty i {
  @apply text-4xl mb-3;
}

.board-empty p {
  @apply text-sm;
}

/* Drag and drop visual feedback */
.dragging {
  opacity: 0.5;
}

.drag-over {
  @apply bg-primary-50 border-primary-300;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .ticket-card {
    padding: 12px;
  }
  
  .status-badge,
  .priority-badge {
    font-size: 10px;
    padding: 2px 6px;
  }
}

/* Print styles */
@media print {
  .no-print {
    display: none !important;
  }
  
  .ticket-card {
    page-break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
  }
}

/* Tooltip styles */
.tooltip {
  @apply absolute z-50 bg-slate-900 text-white text-xs px-2 py-1 rounded shadow-lg;
  bottom: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.tooltip-trigger:hover .tooltip {
  opacity: 1;
}

/* Skeleton loading */
.skeleton {
  @apply animate-pulse bg-slate-200 rounded;
}

.skeleton-text {
  @apply h-4 bg-slate-200 rounded;
}

.skeleton-avatar {
  @apply w-10 h-10 bg-slate-200 rounded-full;
}

/* Success/Error messages */
.alert {
  @apply px-4 py-3 rounded-lg border;
}

.alert-success {
  @apply bg-emerald-50 border-emerald-200 text-emerald-800;
}

.alert-error {
  @apply bg-red-50 border-red-200 text-red-800;
}

.alert-warning {
  @apply bg-amber-50 border-amber-200 text-amber-800;
}

.alert-info {
  @apply bg-blue-50 border-blue-200 text-blue-800;
}

/* Timeline styles for ticket history */
.timeline {
  @apply relative;
}

.timeline::before {
  content: '';
  @apply absolute left-4 top-0 bottom-0 w-0.5 bg-slate-200;
}

.timeline-item {
  @apply relative pl-10 pb-6;
}

.timeline-dot {
  @apply absolute left-2 top-1 w-4 h-4 rounded-full border-2 border-white bg-primary-500;
  box-shadow: 0 0 0 2px #0ea5e9;
}

/* Custom scrollbar for modal */
.modal-body {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 #f1f5f9;
}

/* Pulse animation for notifications */
@keyframes pulse-ring {
  0% {
    transform: scale(0.8);
    opacity: 1;
  }
  100% {
    transform: scale(1.4);
    opacity: 0;
  }
}

.notification-pulse::before {
  content: '';
  @apply absolute inset-0 rounded-full bg-red-500;
  animation: pulse-ring 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Grid layout improvements */
.grid-auto-fit {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

/* Backdrop blur effect */
.backdrop-blur-sm {
  backdrop-filter: blur(8px);
}

.backdrop-blur {
  backdrop-filter: blur(12px);
}

/* Focus visible improvements for accessibility */
*:focus-visible {
  outline: 2px solid #0ea5e9;
  outline-offset: 2px;
}

/* Dark mode support (preparado para futuro) */
@media (prefers-color-scheme: dark) {
  /* Estilos para modo oscuro si se requiere */
}

/* Tab styles */
.tab-button {
  transition: all 0.2s ease;
}

.tab-button.active {
  color: #0ea5e9;
  border-color: #0ea5e9;
}

.tab-button:not(.active):hover {
  color: #334155;
  border-color: #cbd5e1;
}

/* CSV Import styles */
#csv-file-input:focus + label {
  outline: 2px solid #0ea5e9;
  outline-offset: 2px;
}

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

.csv-table th {
  background: #f1f5f9;
  padding: 8px;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid #cbd5e1;
  font-size: 0.75rem;
}

.csv-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.75rem;
}

.csv-table tr:hover {
  background: #f8fafc;
}

/* Drag and drop styles */
.drag-drop-zone.drag-over {
  border-color: #0ea5e9;
  background: #f0f9ff;
}

/* OS Tabs styles */
.os-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 16px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.os-tab {
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #64748b;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  margin-bottom: -2px;
}

.os-tab:hover {
  color: #0ea5e9;
  background: #f0f9ff;
}

.os-tab.active {
  color: #0ea5e9;
  border-bottom-color: #0ea5e9;
  font-weight: 600;
}

.os-content {
  display: none;
}

.os-content.active {
  display: block;
  animation: fadeIn 0.3s ease-out;
}

/* Board spacing improvements */
#boards-container > div {
  display: flex;
  flex-direction: column;
}

#boards-container > div > div:last-child {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* OS Badge */
.os-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: #e0f2fe;
  color: #0369a1;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Ticket Internal Search */
#ticket-search-bar {
  animation: slideDown 0.3s ease-out;
}

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

.search-highlight {
  background: #fef3c7;
  border: 2px solid #fbbf24;
  animation: pulse 0.6s ease-in-out;
}

@keyframes pulse {
  0%, 100% {
    border-color: #fbbf24;
  }
  50% {
    border-color: #f59e0b;
  }
}

.os-tab.search-match {
  background: #fef3c7;
  position: relative;
}

.os-tab.search-match::after {
  content: "●";
  color: #f59e0b;
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 8px;
}

/* ========== Main Form Tabs ========== */
.main-tab {
  transition: all 0.2s ease;
  white-space: nowrap;
}

.main-tab.active {
  background: white;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  border: 1px solid #e2e8f0;
  color: #0ea5e9;
}

.main-tab:not(.active):hover {
  background: rgba(255, 255, 255, 0.6);
}

.main-tab-content {
  display: none;
}

.main-tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease-out;
}

/* ========== Status Move Buttons ========== */
.status-move-btn.active {
  outline: 2px solid;
  outline-offset: 2px;
}

.status-move-btn[data-move-to="solicitados"].active {
  background: #f1f5f9;
  border-color: #64748b;
  box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.2);
}

.status-move-btn[data-move-to="enproceso"].active {
  background: #fef3c7;
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

.status-move-btn[data-move-to="completados"].active {
  background: #d1fae5;
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

/* ========== Observaciones ========== */
.observacion-item {
  @apply bg-slate-50 border border-slate-200 rounded-lg p-3;
  animation: fadeIn 0.3s ease-out;
}

.observacion-item .observacion-header {
  @apply flex items-start justify-between gap-2;
}

.observacion-item .observacion-title {
  @apply font-medium text-slate-800 text-sm;
}

.observacion-item .observacion-date {
  @apply text-xs text-slate-500;
}

.observacion-item .observacion-body {
  @apply text-xs text-slate-600 mt-1;
}

.observacion-item .observacion-os-badge {
  @apply inline-flex items-center gap-1 mt-2 px-2 py-0.5 bg-primary-100 text-primary-700 rounded-full text-xs;
}

/* ========== Image Upload ========== */
#image-drop-zone.drag-over {
  border-color: #0ea5e9;
  background: rgba(14, 165, 233, 0.05);
}

#image-drop-zone.drag-over i {
  color: #0ea5e9;
  animation: bounce 0.5s ease infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.image-preview-item {
  @apply relative rounded-lg overflow-hidden border border-slate-200 bg-slate-100;
  aspect-ratio: 1;
}

.image-preview-item img {
  @apply w-full h-full object-cover;
}

.image-preview-item .image-overlay {
  @apply absolute inset-0 bg-black/50 opacity-0 transition flex items-center justify-center gap-2;
}

.image-preview-item:hover .image-overlay {
  opacity: 1;
}

.image-preview-item .remove-image-btn {
  @apply w-8 h-8 rounded-full bg-red-500 text-white flex items-center justify-center hover:bg-red-600 transition;
}

.image-preview-item .os-indicator {
  @apply absolute bottom-0 left-0 right-0 bg-black/60 text-white text-xs px-2 py-1 truncate;
}

.image-preview-item.uploading::after {
  content: '';
  @apply absolute inset-0 bg-white/80 flex items-center justify-center;
}

.image-preview-item.uploading::before {
  content: '';
  @apply absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-6 h-6 border-2 border-primary-600 border-t-transparent rounded-full;
  animation: spin 0.6s linear infinite;
}

/* ========== Image Processing Progress ========== */
.image-processing-bar {
  @apply h-1 bg-slate-200 rounded-full overflow-hidden;
}

.image-processing-bar .progress {
  @apply h-full bg-primary-600 transition-all duration-300;
}

/* ========== Location Toggle ========== */
#ubicacion-ajustada-toggle:checked ~ #ubicacion-ajustada-fields {
  display: block;
}
