/* Custom styles for Lead Generator */

/* ========================================
   SMOOTH TRANSITIONS
   ======================================== */
* {
  transition-property: background-color, border-color, color, fill, stroke, opacity, transform, box-shadow;
  transition-timing-function: ease-in-out;
  transition-duration: 150ms;
}

/* ========================================
   DARK MODE CONTRAST FIXES
   ======================================== */
.dark input,
.dark select,
.dark textarea {
  background-color: #374151 !important;
  border-color: #4b5563 !important;
  color: #f9fafb !important;
}

.dark input::placeholder,
.dark textarea::placeholder {
  color: #9ca3af !important;
  opacity: 1;
}

.dark .card,
.dark .bg-white {
  background-color: var(--card-bg) !important;
}

.dark table tbody tr:hover {
  background-color: rgba(99, 102, 241, 0.1) !important;
}

/* ========================================
   FOCUS STATES (ACCESSIBILITY)
   ======================================== */
input:focus,
select:focus,
textarea:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
  border-color: #6366f1 !important;
}

button:focus,
a:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
}

/* Focus visible for keyboard users */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

/* ========================================
   BUTTON IMPROVEMENTS
   ======================================== */
.btn {
  position: relative;
  overflow: hidden;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

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

/* Loading state for buttons */
.btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

.btn.loading .btn-text {
  visibility: hidden;
}

.btn.loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Secondary button improvements */
.btn-secondary:hover {
  background-color: #f3f4f6;
  border-color: #6366f1;
  color: #4f46e5;
}

.dark .btn-secondary {
  background-color: #374151;
  border-color: #4b5563;
  color: #e5e7eb;
}

.dark .btn-secondary:hover {
  background-color: #4b5563;
  border-color: #6366f1;
  color: #f9fafb;
}

/* ========================================
   TABLE & ROW HOVER EFFECTS
   ======================================== */
tbody tr {
  transition: background-color 0.15s ease, transform 0.15s ease;
}

tbody tr:hover {
  background-color: rgba(99, 102, 241, 0.05);
}

/* Sortable header styling */
th[data-sort] {
  cursor: pointer;
  user-select: none;
}

th[data-sort]:hover {
  background-color: rgba(99, 102, 241, 0.1);
}

th[data-sort]:hover .sort-icon {
  color: #6366f1;
}

/* ========================================
   CARD HOVER EFFECTS
   ======================================== */
.card-interactive {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card-interactive:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  border-color: #a5b4fc;
}

/* ========================================
   MOBILE RESPONSIVE TABLES
   ======================================== */
@media (max-width: 768px) {
  /* Make table rows stack on mobile */
  .mobile-cards tbody tr {
    display: block;
    margin-bottom: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1rem;
    background: white;
  }

  .mobile-cards thead {
    display: none;
  }

  .mobile-cards tbody td {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border: none;
  }

  .mobile-cards tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #6b7280;
    margin-right: 1rem;
  }

  /* Checkbox column on mobile */
  .mobile-cards tbody td:first-child {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
  }

  .dark .mobile-cards tbody tr {
    background: var(--card-bg);
    border-color: var(--border-color);
  }
}

/* Larger touch targets on mobile */
@media (max-width: 768px) {
  input[type="checkbox"] {
    width: 20px;
    height: 20px;
  }

  button, .btn {
    min-height: 44px;
    padding: 12px 16px;
  }

  input, select, textarea {
    min-height: 44px;
    font-size: 16px; /* Prevent zoom on iOS */
  }
}

/* ========================================
   SKELETON LOADER
   ======================================== */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

.dark .skeleton {
  background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
  background-size: 200% 100%;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 1rem;
  margin-bottom: 0.5rem;
}

.skeleton-text-sm {
  height: 0.75rem;
  width: 60%;
}

.skeleton-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

/* ========================================
   SCROLLBAR STYLING
   ======================================== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

.dark ::-webkit-scrollbar-track {
  background: #1f2937;
}

.dark ::-webkit-scrollbar-thumb {
  background: #4b5563;
}

.dark ::-webkit-scrollbar-thumb:hover {
  background: #6b7280;
}

/* ========================================
   TOOLTIP STYLING
   ======================================== */
[title] {
  position: relative;
}

/* ========================================
   ALERT IMPROVEMENTS
   ======================================== */
.alert {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  border-radius: 0.75rem;
  animation: slideIn 0.3s ease;
}

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

.alert-success {
  background-color: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.alert-error {
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.alert-warning {
  background-color: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

.dark .alert-success {
  background-color: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

.dark .alert-error {
  background-color: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.dark .alert-warning {
  background-color: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fcd34d;
}

/* ========================================
   PROGRESS BAR IMPROVEMENTS
   ======================================== */
.progress-bar {
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background-color: #e5e7eb;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
}

.dark .progress-bar {
  background-color: #374151;
}

/* ========================================
   BADGE/TAG IMPROVEMENTS
   ======================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  transition: transform 0.15s ease;
}

.badge:hover {
  transform: scale(1.05);
}

/* ========================================
   LOADING ANIMATION
   ======================================== */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Status dot animation */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.active {
  animation: pulse 1.5s ease-in-out infinite;
}

/* ========================================
   COPY BUTTON FEEDBACK
   ======================================== */
.copy-btn {
  transition: color 0.15s ease, transform 0.15s ease;
}

.copy-btn:hover {
  transform: scale(1.1);
}

.copy-btn:active {
  transform: scale(0.95);
}

/* ========================================
   MODAL IMPROVEMENTS
   ======================================== */
.modal-backdrop {
  animation: fadeIn 0.2s ease;
}

.modal-content {
  animation: slideUp 0.3s ease;
}

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

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

/* ========================================
   EMPTY STATES
   ======================================== */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: #6b7280;
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  color: #d1d5db;
}

.dark .empty-state {
  color: #9ca3af;
}

.dark .empty-state-icon {
  color: #4b5563;
}

/* ========================================
   SELECTION HIGHLIGHT
   ======================================== */
tr.selected {
  background-color: rgba(99, 102, 241, 0.1) !important;
}

.dark tr.selected {
  background-color: rgba(99, 102, 241, 0.2) !important;
}

/* ========================================
   LINK IMPROVEMENTS
   ======================================== */
a:not(.btn):not(.nav-link) {
  transition: color 0.15s ease;
}

a:not(.btn):not(.nav-link):hover {
  text-decoration: underline;
}

/* External link indicator */
a[target="_blank"]::after {
  content: " ↗";
  font-size: 0.75em;
  opacity: 0.7;
}

/* ========================================
   INPUT GROUP STYLING
   ======================================== */
.input-group {
  display: flex;
  gap: 0.5rem;
}

.input-group input {
  flex: 1;
}

.input-group button {
  flex-shrink: 0;
}

/* ========================================
   FLOATING LABEL (optional future use)
   ======================================== */
.floating-label {
  position: relative;
}

.floating-label input:placeholder-shown + label {
  transform: translateY(0);
  font-size: 1rem;
  color: #9ca3af;
}

.floating-label input:focus + label,
.floating-label input:not(:placeholder-shown) + label {
  transform: translateY(-1.5rem);
  font-size: 0.75rem;
  color: #6366f1;
}

/* ========================================
   TAB NAVIGATION
   ======================================== */
.settings-tab {
  transition: all 0.15s ease;
}

.settings-tab:hover:not(.active) {
  background-color: rgba(99, 102, 241, 0.05);
}

.dark .settings-tab {
  color: #9ca3af;
}

.dark .settings-tab:hover:not(.active) {
  color: #e5e7eb;
  background-color: rgba(99, 102, 241, 0.1);
  border-color: #4b5563;
}

.dark .settings-tab.active {
  color: #a5b4fc;
  border-color: #6366f1;
}

.dark .border-gray-200 {
  border-color: #374151;
}

/* Tab panel transitions */
.tab-panel {
  animation: fadeIn 0.2s ease;
}

.tab-panel.hidden {
  display: none;
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
  .no-print,
  nav,
  .btn,
  button {
    display: none !important;
  }

  body {
    background: white !important;
    color: black !important;
  }

  .card {
    box-shadow: none !important;
    border: 1px solid #e5e7eb !important;
  }
}
