/* UI Polish and Enhancement Styles */

/* Smooth animations for page transitions */
.page {
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
  display: none;
}

.page.active {
  opacity: 1;
  transform: translateY(0);
  display: block;
}

/* Enhanced buttons */
.btn-primary, .btn-secondary {
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
}

.btn-primary::after,
.btn-secondary::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.4s, height 0.4s;
}

.btn-primary:active::after,
.btn-secondary:active::after {
  width: 200px;
  height: 200px;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(8, 108, 132, 0.3);
}

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

.btn-primary:active,
.btn-secondary:active {
  transform: translateY(0);
}

/* Improved cards */
.card {
  background: var(--white);
  border-radius: 12px;
  border: 1px solid var(--gray-200);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Enhanced stat cards */
.stat-card {
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  opacity: 0;
  transition: opacity 0.3s;
}

.stat-card:hover::before {
  opacity: 1;
}

/* Quick action cards enhancement */
.quick-action-card {
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.quick-action-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 8px 20px rgba(8, 108, 132, 0.15);
}

.quick-action-card:active {
  transform: translateY(0);
}

/* Improved table styling */
.leads-table {
  border-collapse: separate;
  border-spacing: 0;
}

.leads-table th {
  background: var(--gray-50);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--gray-600);
  padding: 14px 16px;
}

.leads-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-100);
  transition: background 0.15s;
}

.leads-table tbody tr:hover td {
  background: var(--gray-50);
}

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}

.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-badge.new {
  background: #dbeafe;
  color: #1e40af;
}

.status-badge.new::before {
  background: #3b82f6;
}

.status-badge.contacted {
  background: #fef3c7;
  color: #92400e;
}

.status-badge.contacted::before {
  background: #f59e0b;
}

.status-badge.qualified {
  background: #d1fae5;
  color: #065f46;
}

.status-badge.qualified::before {
  background: #10b981;
}

.status-badge.negotiation {
  background: #fce7f3;
  color: #9d174d;
}

.status-badge.negotiation::before {
  background: #ec4899;
}

/* Enhanced modal */
.modal {
  backdrop-filter: blur(4px);
}

.modal-content {
  transform: scale(0.95);
  opacity: 0;
  transition: all 0.2s ease;
}

.modal.active .modal-content {
  transform: scale(1);
  opacity: 1;
}

.modal-header {
  background: linear-gradient(135deg, var(--gray-50), var(--white));
  border-bottom: 1px solid var(--gray-200);
}

/* Form inputs enhancement */
.form-input {
  transition: all 0.2s ease;
}

.form-input:hover {
  border-color: var(--gray-300);
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
  outline: none;
}

/* Pipeline board improvements */
.workflow-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.workflow-column {
  background: var(--gray-50);
  border-radius: 12px;
  min-height: 400px;
  transition: background 0.2s;
}

.workflow-column:hover {
  background: var(--gray-100);
}

.workflow-column.drag-over {
  background: var(--primary-light);
  border: 2px dashed var(--primary);
}

.workflow-header {
  padding: 16px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.workflow-title {
  font-weight: 600;
  color: var(--gray-700);
}

.workflow-count {
  background: var(--white);
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.workflow-card {
  background: var(--white);
  border-radius: 8px;
  padding: 16px;
  margin: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  cursor: grab;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.workflow-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.workflow-card:active {
  cursor: grabbing;
}

.workflow-card[data-status="new"] { border-left-color: #3b82f6; }
.workflow-card[data-status="contacted"] { border-left-color: #f59e0b; }
.workflow-card[data-status="qualified"] { border-left-color: #10b981; }
.workflow-card[data-status="negotiation"] { border-left-color: #ec4899; }

/* Task items enhancement */
.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 8px;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.task-item:hover {
  background: var(--gray-50);
  border-color: var(--gray-200);
}

.task-item.completed {
  opacity: 0.6;
}

.task-item.completed .task-title {
  text-decoration: line-through;
  color: var(--gray-400);
}

.task-checkbox {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--primary);
}

.task-priority {
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.task-priority.high {
  background: #fee2e2;
  color: #dc2626;
}

.task-priority.medium {
  background: #fef3c7;
  color: #d97706;
}

.task-priority.low {
  background: #dbeafe;
  color: #2563eb;
}

.task-priority.done {
  background: #d1fae5;
  color: #059669;
}

/* Empty states */
.empty-state-compact {
  text-align: center;
  padding: 32px 20px;
}

.empty-icon {
  width: 48px;
  height: 48px;
  background: var(--gray-100);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  color: var(--gray-400);
  font-size: 20px;
}

.empty-icon.success {
  background: #d1fae5;
  color: #059669;
}

.empty-state-compact h4 {
  font-size: 14px;
  color: var(--gray-700);
  margin-bottom: 4px;
}

.empty-state-compact p {
  font-size: 13px;
  color: var(--gray-500);
  margin-bottom: 16px;
}

/* Toast notifications */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 20px;
  background: var(--gray-800);
  color: white;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1000;
  font-size: 14px;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success {
  background: #059669;
}

.toast.error {
  background: #dc2626;
}

.toast.info {
  background: #2563eb;
}

/* Page loading state */
.page-loading::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-loading::before {
  content: '';
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  z-index: 1000;
}

@keyframes spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Hot leads styling */
.hot-lead-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.hot-lead-item:hover {
  background: var(--gray-50);
  border-color: var(--gray-200);
}

.hot-lead-avatar {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 13px;
}

.hot-lead-info {
  flex: 1;
  min-width: 0;
}

.hot-lead-name {
  font-weight: 600;
  color: var(--gray-900);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hot-lead-meta {
  font-size: 12px;
  color: var(--gray-500);
}

.hot-lead-value {
  font-weight: 700;
  color: var(--primary);
  font-size: 14px;
}

.hot-lead-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}

.hot-lead-item:hover .hot-lead-actions {
  opacity: 1;
}

.hot-lead-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--white);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
  transition: all 0.2s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.hot-lead-btn:hover {
  background: var(--primary);
  color: white;
}

/* Activity feed */
.activity-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  transition: background 0.2s;
}

.activity-item:hover {
  background: var(--gray-50);
}

.activity-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}

.activity-icon.lead {
  background: #dbeafe;
  color: #2563eb;
}

.activity-icon.task {
  background: #d1fae5;
  color: #059669;
}

.activity-icon.email {
  background: #fce7f3;
  color: #db2777;
}

.activity-icon.call {
  background: #fef3c7;
  color: #d97706;
}

.activity-icon.note {
  background: #f3e8ff;
  color: #7c3aed;
}

.activity-content {
  flex: 1;
}

.activity-text {
  font-size: 13px;
  color: var(--gray-700);
  line-height: 1.4;
}

.activity-time {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 2px;
}

/* Pipeline overview bars */
.pipeline-stages {
  padding: 20px;
}

.pipeline-stage {
  margin-bottom: 20px;
}

.pipeline-stage:last-child {
  margin-bottom: 0;
}

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

.stage-name {
  font-weight: 600;
  color: var(--gray-700);
  font-size: 14px;
}

.stage-count {
  background: var(--gray-100);
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
}

.stage-bar {
  height: 8px;
  background: var(--gray-100);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}

.stage-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.stage-fill.new { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.stage-fill.contacted { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.stage-fill.qualified { background: linear-gradient(90deg, #10b981, #34d399); }
.stage-fill.negotiation { background: linear-gradient(90deg, #ec4899, #f472b6); }

.stage-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-600);
}

/* Goal card styling */
.goal-progress {
  margin-bottom: 20px;
}

.goal-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.goal-label {
  font-size: 13px;
  color: var(--gray-600);
}

.goal-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-900);
}

.progress-bar {
  height: 8px;
  background: var(--gray-100);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 4px;
  transition: width 0.5s ease;
}

.goal-footer {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

.goal-percentage {
  color: var(--success);
  font-weight: 600;
}

.goal-remaining {
  color: var(--gray-500);
}

.goal-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--gray-100);
}

.goal-stat {
  text-align: center;
}

.goal-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 4px;
}

.goal-stat-label {
  font-size: 12px;
  color: var(--gray-500);
}

/* Lead table actions */
.btn-icon {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
  transition: all 0.2s;
}

.btn-icon:hover {
  background: var(--gray-100);
  color: var(--gray-700);
}

.btn-icon:hover[style*="--danger"] {
  background: #fee2e2;
  color: #dc2626;
}

/* Lead info in table */
.lead-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lead-avatar {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 12px;
}

.lead-name {
  font-weight: 600;
  color: var(--gray-900);
  font-size: 14px;
}

.lead-company {
  font-size: 12px;
  color: var(--gray-500);
}

/* Empty table cell */
.empty-table-cell {
  padding: 40px;
  text-align: center;
}

/* Follow-up items */
.followup-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  transition: all 0.2s;
  border-left: 3px solid var(--danger);
  background: var(--gray-50);
}

.followup-item:hover {
  background: var(--gray-100);
}

.followup-urgent {
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  flex-shrink: 0;
}

.followup-content {
  flex: 1;
}

.followup-title {
  font-weight: 600;
  color: var(--gray-900);
  font-size: 14px;
  margin-bottom: 2px;
}

.followup-due {
  font-size: 12px;
  color: var(--danger);
  font-weight: 500;
}

.followup-btn {
  padding: 6px 14px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
  cursor: pointer;
  transition: all 0.2s;
}

.followup-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Responsive improvements */
@media (max-width: 1200px) {
  .workflow-board {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .workflow-board {
    grid-template-columns: 1fr;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .quick-actions {
    grid-template-columns: repeat(2, 1fr);
  }
}
