/* Interactive Components - Manzoor Diagnostics */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, #0088cc 0%, #00e5ff 100%);
  color: #070c14;
  box-shadow: 0 4px 12px rgba(0, 229, 255, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0099e6 0%, #33ebff 100%);
  box-shadow: 0 6px 16px rgba(0, 229, 255, 0.35);
  transform: translateY(-1px);
}

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

.btn-secondary {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--surface-3);
  border-color: var(--primary);
  color: #fff;
}

.btn-danger {
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(244, 63, 94, 0.2);
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 4px 12px rgba(244, 63, 94, 0.3);
}

.btn-text {
  background: transparent;
  border: none;
  color: var(--primary);
  padding: 6px 12px;
}

.btn-text:hover {
  color: var(--primary-hover);
  background: var(--primary-soft);
}

/* Loading button state */
.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

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

.btn-primary.btn-loading::after {
  border-top-color: #070c14;
}

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

/* Form Inputs */
.form-group {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.3px;
}

.form-label span.required {
  color: var(--danger);
  margin-left: 2px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.form-control {
  width: 100%;
  background-color: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 16px;
  font-size: 14px;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: var(--shadow-glow);
  background-color: var(--surface-2);
}

.form-control::placeholder {
  color: var(--muted);
}

.input-icon-wrapper .form-control {
  padding-left: 44px;
}

.input-icon-wrapper .input-icon {
  position: absolute;
  left: 14px;
  color: var(--muted);
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.input-icon-wrapper .form-control:focus + .input-icon {
  color: var(--primary);
}

.password-toggle {
  position: absolute;
  right: 14px;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.password-toggle:hover {
  color: var(--primary);
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 24px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}

/* Summary Cards (Operational stats) */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.summary-card {
  background: linear-gradient(145deg, var(--surface) 0%, rgba(20, 34, 57, 0.4) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.summary-card:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 229, 255, 0.25);
  box-shadow: var(--shadow-glow), var(--shadow);
}

.summary-icon-container {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.summary-card.primary .summary-icon-container {
  background: rgba(0, 229, 255, 0.1);
  color: var(--primary);
}
.summary-card.warning .summary-icon-container {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}
.summary-card.success .summary-icon-container {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.summary-details {
  display: flex;
  flex-direction: column;
}

.summary-count {
  font-family: var(--font-title);
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.summary-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid transparent;
}

.badge-pending {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.2);
  color: var(--warning);
}

.badge-ready {
  background: rgba(0, 229, 255, 0.08);
  border-color: rgba(0, 229, 255, 0.25);
  color: var(--primary);
}

.badge-completed {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.2);
  color: var(--success);
}

.badge-draft {
  background: rgba(156, 163, 175, 0.08);
  border-color: rgba(156, 163, 175, 0.2);
  color: var(--muted);
}

/* Table Styling */
.table-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 100%;
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.table th {
  background: var(--surface-2);
  padding: 14px 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 16px 20px;
  font-size: 13.5px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.table tbody tr {
  transition: background-color 0.15s ease;
}

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

.table tbody tr:hover {
  background-color: rgba(25, 42, 70, 0.2);
}

/* Modal and Drawers */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(3, 7, 12, 0.85);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow), 0 0 30px rgba(0, 0, 0, 0.6);
  transform: translateY(20px);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-overlay.active .modal-container {
  transform: translateY(0);
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 600;
  color: #fff;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--surface-2);
  color: #fff;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(80vh - 120px);
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Dynamic Drawers (Slide from Right) */
.drawer-container {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1001;
  display: flex;
  flex-direction: column;
}

.modal-overlay.active .drawer-container {
  transform: translateX(0);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 2000;
}

.toast {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  min-width: 280px;
  max-width: 400px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transform: translateY(20px);
  opacity: 0;
  animation: toastIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.toast-content {
  font-size: 13.5px;
  color: var(--text);
  font-weight: 500;
}

.toast-close {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
}

.toast-close:hover {
  color: #fff;
}

.toast-success {
  border-left-color: var(--success);
}

.toast-error {
  border-left-color: var(--danger);
}

@keyframes toastIn {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.toast-out {
  animation: toastOut 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes toastOut {
  to {
    transform: translateY(-20px);
    opacity: 0;
  }
}

/* Selection Chips */
.chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 500;
  color: #fff;
  transition: all 0.2s ease;
}

.chip:hover {
  border-color: var(--primary);
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.1);
}

.chip-remove {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  transition: all 0.15s ease;
}

.chip-remove:hover {
  background: rgba(244, 63, 94, 0.2);
  color: var(--danger);
}

/* Keyboard/Aesthetic Grid for Result Entry */
.result-entry-grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.test-group-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.test-group-header {
  background: var(--surface-2);
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.test-group-title {
  font-family: var(--font-title);
  font-size: 15px;
  font-weight: 600;
  color: var(--primary);
  letter-spacing: 0.5px;
}

.result-input-field {
  background: var(--surface-2) !important;
  font-weight: 600;
  font-size: 15px;
  text-align: center;
}

.result-input-field:focus {
  border-color: var(--primary) !important;
  box-shadow: var(--shadow-glow) !important;
}

/* Abnormal indicators */
.abnormal-indicator {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}
.abnormal-indicator.high {
  background: rgba(244, 63, 94, 0.15);
  color: var(--danger);
  border: 1px solid rgba(244, 63, 94, 0.25);
}
.abnormal-indicator.low {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

/* Sticky footer */
.sticky-footer {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(12, 21, 36, 0.9);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 80;
  margin-top: 24px;
  border-radius: var(--radius-lg);
  box-shadow: 0 -10px 25px -5px rgba(0, 0, 0, 0.5);
}

/* Search and Filters Layout on Tables */
.table-filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-box {
  flex-grow: 1;
  max-width: 400px;
}

.filter-pills {
  display: flex;
  gap: 8px;
  list-style: none;
}

.filter-pill-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-pill-btn:hover {
  color: #fff;
  border-color: var(--muted);
}

.filter-pill-btn.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.1);
}
