/* Frontend Styles for Capital Credit Lookup */

.pdlt-lookup-container {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  max-width: 100%;
  margin: 20px 0;
}

/* Data Area with Loading Overlay */
.pdlt-data-area {
  position: relative;
  min-height: 400px;
}

/* Loading Overlay (only covers data area) */
.pdlt-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  min-height: 400px;
  border-radius: 8px;
}

.pdlt-loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.pdlt-loading-content p {
  margin: 0;
  font-size: 16px;
  color: #666;
  font-weight: 500;
}

.pdlt-loading-content .loader {
  width: 48px;
  height: 48px;
}

/* Controls Section */
.pdlt-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 20px;
  align-items: center;
  justify-content: space-between;
}

.pdlt-search-wrapper {
  flex: 1;
  min-width: 250px;
  position: relative;
}

.pdlt-search-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 16px;
  border: 2px solid #ddd;
  border-radius: 8px;
  transition: border-color 0.3s;
}

.pdlt-search-input:focus {
  outline: none;
  border-color: #4a90e2;
}

.pdlt-loading {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
}

/* Animated Loader */
.loader {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  position: relative;
  animation: rotate 1s linear infinite;
}

.loader::before,
.loader::after {
  content: "";
  box-sizing: border-box;
  position: absolute;
  inset: 0px;
  border-radius: 50%;
  border: 3px solid #ddd;
  animation: prixClipFix 2s linear infinite;
}

.loader::after {
  border-color: #4a90e2;
  animation: prixClipFix 2s linear infinite, rotate 0.5s linear infinite reverse;
  inset: 3px;
}

@keyframes rotate {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

@keyframes prixClipFix {
  0% {
    clip-path: polygon(50% 50%, 0 0, 0 0, 0 0, 0 0, 0 0);
  }

  25% {
    clip-path: polygon(50% 50%, 0 0, 100% 0, 100% 0, 100% 0, 100% 0);
  }

  50% {
    clip-path: polygon(50% 50%, 0 0, 100% 0, 100% 100%, 100% 100%, 100% 100%);
  }

  75% {
    clip-path: polygon(50% 50%, 0 0, 100% 0, 100% 100%, 0 100%, 0 100%);
  }

  100% {
    clip-path: polygon(50% 50%, 0 0, 100% 0, 100% 100%, 0 100%, 0 0);
  }
}

/* Export Buttons */
.pdlt-export-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pdlt-btn {
  padding: 10px 16px;
  border: 1px solid #ddd;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  font-weight: 500;
}

.pdlt-btn:hover {
  background: #f5f5f5;
  border-color: #999;
}

.pdlt-btn:active {
  transform: scale(0.98);
}

.pdlt-btn-icon {
  font-size: 16px;
}

/* Info Section and Entries Control */
.pdlt-info-wrapper {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin-bottom: 15px;
}

.pdlt-entries-control {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #666;
}

.pdlt-entries-select {
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  background: white;
}

.pdlt-entries-select:focus {
  outline: none;
  border-color: #4a90e2;
}

.pdlt-info {
  color: #666;
  font-size: 14px;
}

.pdlt-start,
.pdlt-end,
.pdlt-total {
  font-weight: 600;
  color: #333;
}

/* Pagination Controls */
.pdlt-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.pdlt-pagination-btn {
  padding: 8px 16px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.pdlt-pagination-btn:hover:not(:disabled) {
  background: #f5f5f5;
  border-color: #999;
}

.pdlt-pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pdlt-pagination-numbers {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pdlt-pagination-number {
  min-width: 40px;
  padding: 8px 12px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.pdlt-pagination-number:hover {
  background: #f5f5f5;
  border-color: #999;
}

.pdlt-pagination-number.active {
  background: #4a90e2;
  color: white;
  border-color: #4a90e2;
  font-weight: 600;
}

.pdlt-pagination-ellipsis {
  padding: 8px 4px;
  color: #999;
  font-size: 14px;
}

/* Desktop Table View */
.pdlt-desktop-view {
  display: block;
}

.pdlt-mobile-view {
  display: none;
}

.pdlt-table-wrapper {
  overflow-x: auto;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: white;
}

.pdlt-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

.pdlt-table thead {
  background: #f8f9fa;
  position: sticky;
  top: 0;
  z-index: 10;
}

.pdlt-table th {
  padding: 14px 12px;
  text-align: left;
  font-weight: 600;
  color: #333;
  border-bottom: 2px solid #ddd;
  font-size: 14px;
  white-space: nowrap;
}

.pdlt-table th.pdlt-sortable {
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}

.pdlt-table th.pdlt-sortable:hover {
  background: #e9ecef;
}

.pdlt-header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pdlt-sort-arrows {
  display: flex;
  flex-direction: column;
  font-size: 10px;
  line-height: 0.6;
  opacity: 0.3;
  transition: opacity 0.2s;
}

.pdlt-table th.pdlt-sortable:hover .pdlt-sort-arrows {
  opacity: 0.6;
}

.pdlt-sort-asc,
.pdlt-sort-desc {
  color: #666;
}

.pdlt-table th.pdlt-sorted-asc .pdlt-sort-arrows {
  opacity: 1;
}

.pdlt-table th.pdlt-sorted-asc .pdlt-sort-asc {
  color: #4a90e2;
  font-weight: bold;
}

.pdlt-table th.pdlt-sorted-desc .pdlt-sort-arrows {
  opacity: 1;
}

.pdlt-table th.pdlt-sorted-desc .pdlt-sort-desc {
  color: #4a90e2;
  font-weight: bold;
}

.pdlt-table td {
  padding: 12px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
  color: #444;
}

.pdlt-table tbody tr:hover {
  background: #f9f9f9;
}

.pdlt-table tbody tr:last-child td {
  border-bottom: none;
}

/* Mobile Card View */
.pdlt-card {
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
}

.pdlt-card-row {
  display: flex;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}

.pdlt-card-row:last-child {
  border-bottom: none;
}

.pdlt-card-label {
  font-weight: 600;
  color: #666;
  min-width: 120px;
  font-size: 13px;
  padding-right: 12px;
}

.pdlt-card-value {
  color: #333;
  font-size: 14px;
  flex: 1;
  padding-left: 12px;
  border-left: 2px solid #e0e0e0;
}

/* No Results */
.pdlt-no-results {
  text-align: center;
  padding: 40px 20px;
  color: #999;
  font-size: 16px;
}

/* Print-only container (hidden by default) */
.pdlt-print-only {
  display: none;
}

/* Responsive Design */
@media (max-width: 768px) {
  .pdlt-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .pdlt-search-wrapper {
    width: 100%;
  }

  .pdlt-export-buttons {
    width: 100%;
    justify-content: space-between;
  }

  .pdlt-btn {
    flex: 1;
    justify-content: center;
    min-width: 0;
  }

  .pdlt-btn-text {
    display: none;
  }

  .pdlt-btn-icon {
    font-size: 20px;
  }

  /* Switch to card view on mobile */
  .pdlt-desktop-view {
    display: none;
  }

  .pdlt-mobile-view {
    display: block;
  }

  .pdlt-info-wrapper {
    flex-direction: column;
    align-items: flex-start;
  }

  .pdlt-pagination {
    gap: 4px;
  }

  .pdlt-pagination-btn {
    padding: 6px 12px;
    font-size: 13px;
  }

  .pdlt-pagination-number {
    min-width: 36px;
    padding: 6px 10px;
    font-size: 13px;
  }
}

/* Print Styles */
@media print {

  /* Hide everything except print content */
  body * {
    visibility: hidden;
  }

  .pdlt-print-only,
  .pdlt-print-only * {
    visibility: visible;
  }

  .pdlt-print-only {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
  }

  .pdlt-print-only h2 {
    margin: 0 0 20px 0;
    font-size: 20px;
  }

  .pdlt-print-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10px;
  }

  .pdlt-print-table th,
  .pdlt-print-table td {
    border: 1px solid #000;
    padding: 6px;
    text-align: left;
  }

  .pdlt-print-table th {
    background: #f0f0f0;
    font-weight: 600;
  }

  /* Hide original lookup container during print */
  .pdlt-lookup-container {
    display: none !important;
  }

  /* Remove page headers and footers */
  @page {
    margin: 0.5cm;
  }
}