/**
 * Drug Insight Tracker Frontend Styles
 * Traditional WordPress Plugin CSS
 */

/* Main Wrapper */
.dit-frontend-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Header */
.dit-header {
  margin-bottom: 30px;
}

.dit-header h2 {
  font-size: 28px;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
}

/* Stats Grid */
.dit-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.dit-stat-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dit-stat-label {
  font-size: 14px;
  color: #64748b;
  font-weight: 500;
  margin-bottom: 8px;
}

.dit-stat-value {
  font-size: 32px;
  font-weight: 700;
  color: #0f172a;
}

/* Filters Section */
.dit-filters-section {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.dit-search-box {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.dit-search-input {
  flex: 1;
  padding: 10px 15px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 14px;
}

.dit-search-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.dit-search-btn {
  padding: 10px 24px;
  background: #3b82f6;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.dit-search-btn:hover {
  background: #2563eb;
}

.dit-filter-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.dit-filter-select,
.dit-filter-date {
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 14px;
  background: #ffffff;
}

.dit-filter-select {
  min-width: 150px;
}

.dit-filter-date {
  min-width: 140px;
}

.dit-filter-reset {
  padding: 8px 16px;
  background: #64748b;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.dit-filter-reset:hover {
  background: #475569;
}

/* Table Wrapper */
.dit-table-wrapper {
  position: relative;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 20px;
  overflow-x: auto;
}

.dit-table-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 14px;
  color: #64748b;
  z-index: 10;
}

.dit-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid #e2e8f0;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: dit-spin 0.8s linear infinite;
}

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

/* Events Table */
.dit-events-table {
  width: 100%;
  border-collapse: collapse;
}

.dit-events-table thead {
  background: #f8fafc;
}

.dit-events-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}

.dit-events-table th[data-sort] {
  cursor: pointer;
  user-select: none;
}

.dit-events-table th[data-sort]:hover {
  background: #f1f5f9;
}

.dit-events-table tbody tr {
  border-bottom: 1px solid #e2e8f0;
  transition: background 0.15s;
}

.dit-events-table tbody tr:hover {
  background: #f8fafc;
}

.dit-events-table td {
  padding: 12px 16px;
  font-size: 14px;
  color: #334155;
}

.dit-events-table .dit-no-results,
.dit-events-table .dit-error {
  text-align: center;
  color: #64748b;
  font-style: italic;
}

.dit-events-table .dit-error {
  color: #dc2626;
}

.dit-view-details {
  padding: 6px 12px;
  background: #3b82f6;
  color: #ffffff;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}

.dit-view-details:hover {
  background: #2563eb;
}

/* Pagination */
.dit-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.dit-pagination-info {
  font-size: 14px;
  color: #64748b;
}

.dit-pagination-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

.dit-pagination-btn {
  padding: 8px 16px;
  background: #ffffff;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.dit-pagination-btn:hover:not(:disabled) {
  background: #f8fafc;
  border-color: #3b82f6;
  color: #3b82f6;
}

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

.dit-page-numbers {
  display: flex;
  gap: 4px;
}

.dit-page-number {
  padding: 6px 12px;
  background: #ffffff;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.dit-page-number:hover {
  background: #f8fafc;
  border-color: #3b82f6;
  color: #3b82f6;
}

.dit-page-number.active {
  background: #3b82f6;
  color: #ffffff;
  border-color: #3b82f6;
}

/* Modal */
.dit-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.dit-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1;
}

.dit-modal-content {
  position: relative;
  background: #ffffff;
  border-radius: 8px;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 30px;
  z-index: 2;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.dit-modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 32px;
  height: 32px;
  background: #f1f5f9;
  border: none;
  border-radius: 4px;
  font-size: 24px;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s;
}

.dit-modal-close:hover {
  background: #e2e8f0;
  color: #334155;
}

#dit-modal-body h3 {
  font-size: 24px;
  font-weight: 600;
  color: #0f172a;
  margin: 0 0 20px 0;
}

.dit-modal-section {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.dit-modal-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.dit-modal-field strong {
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dit-modal-field span,
.dit-modal-field p {
  font-size: 15px;
  color: #334155;
  margin: 0;
}

.dit-modal-field a {
  color: #3b82f6;
  text-decoration: none;
}

.dit-modal-field a:hover {
  text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
  .dit-frontend-wrapper {
    padding: 15px;
  }

  .dit-header h2 {
    font-size: 24px;
  }

  .dit-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }

  .dit-stat-value {
    font-size: 24px;
  }

  .dit-filter-row {
    flex-direction: column;
  }

  .dit-filter-select,
  .dit-filter-date {
    width: 100%;
  }

  .dit-pagination {
    flex-direction: column;
    gap: 15px;
  }

  .dit-page-numbers {
    flex-wrap: wrap;
    justify-content: center;
  }

  .dit-modal-content {
    padding: 20px;
    max-height: 90vh;
  }
}

@media (max-width: 480px) {
  .dit-stats-grid {
    grid-template-columns: 1fr;
  }

  .dit-search-box {
    flex-direction: column;
  }

  .dit-events-table {
    font-size: 12px;
  }

  .dit-events-table th,
  .dit-events-table td {
    padding: 8px 10px;
  }
}
