/**
 * Yaraa AI Sales Agent - Leads Page Styles (Responsive).
 *
 * @package Yaraa_AI_Sales_Agent.
 */

/* Page Styles. */
.yaraa-leads-page h1 {
  font-size: 28px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 24px;
}

/* Notice. */
.yaraa-notice {
  background: #fff;
  border-left: 4px solid #dba617;
  padding: 12px 16px;
  margin-bottom: 20px;
}

/* Stats Bar. */
.yaraa-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 24px;
}

.yaraa-stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  flex: 1;
}

.yaraa-stat-item {
  background: #fff;
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  border: 1px solid #e2e8f0;
}

.yaraa-stat-item:nth-child(1) {
  border-left: 4px solid #6366f1;
}
.yaraa-stat-item:nth-child(2) {
  border-left: 4px solid #10b981;
}
.yaraa-stat-item:nth-child(3) {
  border-left: 4px solid #f59e0b;
}
.yaraa-stat-item:nth-child(4) {
  border-left: 4px solid #8b5cf6;
}

.yaraa-stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.yaraa-stat-item:nth-child(1) .yaraa-stat-icon {
  background: #ede9fe;
  color: #7c3aed;
}
.yaraa-stat-item:nth-child(2) .yaraa-stat-icon {
  background: #d1fae5;
  color: #059669;
}
.yaraa-stat-item:nth-child(3) .yaraa-stat-icon {
  background: #fef3c7;
  color: #d97706;
}
.yaraa-stat-item:nth-child(4) .yaraa-stat-icon {
  background: #f3e8ff;
  color: #9333ea;
}

.yaraa-stat-icon .dashicons {
  font-size: 20px;
  width: 20px;
  height: 20px;
}

.yaraa-stat-label {
  display: block;
  font-size: 12px;
  color: #64748b;
  margin-bottom: 4px;
}

.yaraa-stat-value {
  display: block;
  font-size: 26px;
  font-weight: 700;
  color: #1e293b;
}

/* Export Button. */
.yaraa-btn-export {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff !important;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.yaraa-btn-export:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* Table Container. */
.yaraa-table-container {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  border: 1px solid #e2e8f0;
  overflow: hidden;
}

.yaraa-table-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.yaraa-table-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.yaraa-table-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}

.yaraa-table-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.yaraa-bulk-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.yaraa-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}

.yaraa-search-box {
  position: relative;
  flex: 1;
  max-width: 260px;
}

.yaraa-search-box input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 14px;
}

.yaraa-search-box::before {
  content: "\f179";
  font-family: dashicons;
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
}

/* Loading State. */
.yaraa-loading-state {
  text-align: center;
  padding: 60px 20px;
}

.yaraa-loading-state .dashicons {
  font-size: 40px;
  width: 40px;
  height: 40px;
  color: #6366f1;
}

.yaraa-spin {
  animation: yaraa-spin 1s linear infinite;
}

@keyframes yaraa-spin {
  100% {
    transform: rotate(360deg);
  }
}

/* Table. */
.yaraa-leads-table {
  width: 100%;
  border-collapse: collapse;
}

.yaraa-leads-table th {
  background: #f8fafc;
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  border-bottom: 1px solid #e2e8f0;
}

.yaraa-leads-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.yaraa-leads-table tr:hover {
  background: #f8fafc;
}

/* Lead Info Cell. */
.yaraa-lead-info-cell {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.yaraa-lead-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

.yaraa-lead-details-inline strong {
  display: block;
  color: #1e293b;
  font-size: 14px;
  margin-bottom: 4px;
}

.yaraa-lead-contact {
  font-size: 13px;
  color: #64748b;
  margin-top: 4px;
}

.yaraa-contact-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}

.yaraa-contact-row .dashicons {
  font-size: 14px;
  width: 14px;
  height: 14px;
  color: #94a3b8;
}

.yaraa-ghl-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 4px;
}

.yaraa-ghl-badge.synced {
  background: #d1fae5;
  color: #059669;
}

.yaraa-ghl-badge .dashicons {
  font-size: 12px;
  width: 12px;
  height: 12px;
}

/* System Info. */
.yaraa-system-info {
  font-size: 13px;
  color: #334155;
}

.yaraa-info-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}

.yaraa-info-row .dashicons {
  font-size: 14px;
  width: 14px;
  height: 14px;
  color: #94a3b8;
}

/* Location Info. */
.yaraa-location-info {
  font-size: 13px;
  color: #334155;
}

.yaraa-location-info .yaraa-info-row .dashicons {
  color: #6366f1;
}

.yaraa-sub-info {
  padding-left: 20px;
  color: #64748b;
  font-size: 12px;
}

/* Date Info. */
.yaraa-date-info {
  font-size: 13px;
  color: #334155;
}

/* Actions. */
.yaraa-actions {
  display: flex;
  gap: 6px;
}

.yaraa-action-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  transition: all 0.15s;
}

.yaraa-action-btn:hover {
  background: #f8fafc;
  color: #334155;
}

.yaraa-action-btn.view:hover {
  background: #ede9fe;
  border-color: #c4b5fd;
  color: #7c3aed;
}

.yaraa-action-btn.edit:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #2563eb;
}

.yaraa-action-btn.delete:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
}

.yaraa-action-btn .dashicons {
  font-size: 16px;
  width: 16px;
  height: 16px;
}

/* Empty State. */
.yaraa-empty-state-container {
  padding: 60px 20px;
}

.yaraa-empty-state {
  text-align: center;
  max-width: 400px;
  margin: 0 auto;
}

.yaraa-empty-state-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  background: #ede9fe;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.yaraa-empty-state-icon .dashicons {
  font-size: 36px;
  width: 36px;
  height: 36px;
  color: #7c3aed;
}

.yaraa-empty-state h3 {
  margin: 0 0 8px;
  font-size: 18px;
  color: #1e293b;
}

.yaraa-empty-state p {
  margin: 0;
  color: #64748b;
  font-size: 14px;
}

/* Pagination. */
.yaraa-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

.yaraa-pagination-info {
  font-size: 14px;
  color: #64748b;
}

.yaraa-pagination-buttons {
  display: flex;
  gap: 4px;
  align-items: center;
}

.yaraa-pagination-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 6px;
  font-size: 13px;
  color: #64748b;
  cursor: pointer;
}

.yaraa-pagination-btn:hover:not(:disabled):not(.active) {
  background: #f8fafc;
  color: #334155;
}

.yaraa-pagination-btn.active {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-color: transparent;
  color: #fff;
}

.yaraa-pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Modal. */
.yaraa-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.yaraa-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
}

.yaraa-modal-container {
  position: relative;
  background: #fff;
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.yaraa-modal-sm {
  max-width: 400px;
}

.yaraa-modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
}

.yaraa-modal-header h3 {
  margin: 0;
  font-size: 18px;
}

.yaraa-modal-close {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: #64748b;
  padding: 0;
  line-height: 1;
}

.yaraa-modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.yaraa-modal-footer {
  padding: 16px 20px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Lead Details Modal. */
.yaraa-lead-details-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e2e8f0;
}

.yaraa-lead-avatar-lg {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 20px;
}

.yaraa-lead-details-title h4 {
  margin: 0 0 4px;
  font-size: 18px;
  color: #1e293b;
}

.yaraa-lead-details-title span {
  color: #64748b;
  font-size: 13px;
}

.yaraa-lead-details-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.yaraa-detail-section h5 {
  margin: 0 0 12px;
  font-size: 14px;
  color: #1e293b;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
}

.yaraa-detail-item {
  margin-bottom: 10px;
}

.yaraa-detail-label {
  display: block;
  font-size: 12px;
  color: #64748b;
  margin-bottom: 2px;
}

.yaraa-detail-value {
  font-size: 14px;
  color: #1e293b;
}

/* Edit Form. */
.yaraa-form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.yaraa-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.yaraa-form-group label {
  font-size: 13px;
  font-weight: 500;
  color: #334155;
}

.yaraa-input {
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 14px;
}

.yaraa-input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.dashicons,
.dashicons-before:before {
  margin-top: 4px;
}

.yaraa-btn-delete-bulk {
  background-color: #dc3545;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
}

.yaraa-btn-delete-bulk:hover {
  background-color: #c82333;
  transform: translateY(-1px);
}

.yaraa-btn-delete-bulk .dashicons {
  font-size: 16px;
  width: 16px;
  height: 16px;
}

/* Tablet Responsive (max-width: 1024px). */
@media (max-width: 1024px) {
  .yaraa-leads-page h1 {
    font-size: 24px;
  }

  .yaraa-stats-bar {
    grid-template-columns: repeat(2, 1fr);
  }

  .yaraa-table-actions {
    flex-wrap: wrap;
  }

  .yaraa-table-left {
    width: 100%;
    order: 2;
  }

  .yaraa-table-right {
    width: 100%;
    order: 1;
    justify-content: flex-end;
  }

  .yaraa-search-box {
    max-width: 100%;
  }

  .yaraa-lead-details-grid {
    grid-template-columns: 1fr;
  }

  /* Make table scrollable on tablet */
  .yaraa-table-container {
    overflow-x: auto;
  }

  .yaraa-leads-table {
    min-width: 900px;
  }
}

/* Mobile Responsive (max-width: 768px). */
@media (max-width: 768px) {
  .yaraa-leads-page h1 {
    font-size: 20px;
    margin-bottom: 16px;
  }

  .yaraa-page-header {
    flex-direction: column;
    gap: 16px;
  }

  .yaraa-stats-bar {
    width: 100%;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .yaraa-stat-item {
    padding: 12px 16px;
  }

  .yaraa-stat-icon {
    width: 36px;
    height: 36px;
    margin-bottom: 8px;
  }

  .yaraa-stat-value {
    font-size: 22px;
  }

  .yaraa-btn-export {
    width: 100%;
    justify-content: center;
  }

  .yaraa-btn-delete-bulk {
    width: 100%;
    justify-content: center;
    margin-right: 0;
    margin-bottom: 8px;
  }

  .yaraa-table-header {
    padding: 12px 16px;
  }

  .yaraa-table-actions {
    flex-direction: column;
    gap: 12px;
  }

  .yaraa-table-left {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .yaraa-table-right {
    width: 100%;
    flex-direction: column;
  }

  .yaraa-checkbox-label {
    justify-content: center;
  }

  .yaraa-search-box {
    max-width: 100%;
  }

  /* Card-based layout for mobile */
  .yaraa-leads-table {
    display: block;
  }

  .yaraa-leads-table thead {
    display: none;
  }

  .yaraa-leads-table tbody {
    display: block;
  }

  .yaraa-leads-table tr {
    display: block;
    margin-bottom: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    background: #fff;
    position: relative;
  }

  .yaraa-leads-table tr:hover {
    background: #fff;
  }

  .yaraa-leads-table td {
    display: block;
    padding: 8px 0;
    border: none;
    text-align: left;
  }

  .yaraa-leads-table td::before {
    content: attr(data-label);
    display: block;
    font-weight: 600;
    font-size: 12px;
    color: #64748b;
    margin-bottom: 4px;
    text-transform: uppercase;
  }

  .yaraa-leads-table td:first-child {
    position: absolute;
    top: 16px;
    right: 16px;
    padding: 0;
  }

  .yaraa-leads-table td:first-child::before {
    display: none;
  }

  .yaraa-lead-info-cell {
    margin-top: 8px;
  }

  .yaraa-actions {
    justify-content: flex-start;
    margin-top: 12px;
  }

  .yaraa-pagination {
    flex-direction: column;
    gap: 12px;
    padding: 12px 16px;
  }

  .yaraa-pagination-info {
    font-size: 13px;
  }

  .yaraa-pagination-buttons {
    flex-wrap: wrap;
    justify-content: center;
  }

  .yaraa-modal-container {
    width: 95%;
    max-height: 85vh;
  }

  .yaraa-modal-header {
    padding: 12px 16px;
  }

  .yaraa-modal-header h3 {
    font-size: 16px;
  }

  .yaraa-modal-body {
    padding: 16px;
  }

  .yaraa-modal-footer {
    padding: 12px 16px;
    flex-wrap: wrap;
  }

  .yaraa-modal-footer .button {
    flex: 1;
    min-width: 120px;
  }

  .yaraa-lead-details-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .yaraa-lead-avatar-lg {
    width: 50px;
    height: 50px;
    font-size: 18px;
  }

  .yaraa-lead-details-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .yaraa-form-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

/* Small Mobile (max-width: 480px). */
@media (max-width: 480px) {
  .yaraa-stats-bar {
    grid-template-columns: 1fr;
  }

  .yaraa-stat-value {
    font-size: 20px;
  }

  .yaraa-action-btn {
    width: 28px;
    height: 28px;
  }

  .yaraa-action-btn .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
  }

  .yaraa-pagination-btn {
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    font-size: 12px;
  }
}

.yaraa-leads-table th:first-child {
  width: 40px;
}
