/* ===== SHARED COMPONENTS ===== */

/* --- Form Inputs --- */
.input-group {
  margin-bottom: 1rem;
  text-align: left;
}

.input-group label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 0.4rem;
  font-weight: 600;
}

.input-group input,
.input-group select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.input-group input:focus {
  border-color: var(--accent);
}

.input-group input::placeholder {
  color: #3a3a4a;
}

.input-group .hint {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 0.3rem;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.5rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--border-hover);
  color: var(--text);
}

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

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
  border-radius: 6px;
}

.btn-danger {
  background: transparent;
  color: var(--red);
  border: 1px solid var(--red);
  padding: 0.25rem 0.5rem;
  font-size: 0.7rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.btn-danger:hover {
  background: var(--red);
  color: #fff;
}

/* --- Badges --- */
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
}

.badge-green {
  background: rgba(67, 181, 129, 0.15);
  color: var(--green);
}

.badge-yellow {
  background: rgba(250, 166, 26, 0.15);
  color: var(--yellow);
}

.badge-red {
  background: rgba(240, 71, 71, 0.15);
  color: var(--red);
}

/* --- Toggle Switch --- */
.toggle {
  position: relative;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle .slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle .slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle input:checked+.slider {
  background: var(--accent);
}

.toggle input:checked+.slider::before {
  transform: translateX(16px);
}

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--green);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s;
  pointer-events: none;
  z-index: 100;
}

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

/* --- Error Message --- */
.error-msg {
  color: var(--red);
  font-size: 0.85rem;
  margin-top: 0.75rem;
  min-height: 1.2em;
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  color: var(--text-dim);
  padding: 2rem;
  font-size: 0.85rem;
}

/* --- Data Tables --- */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.table-card .table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem 0.5rem;
}

.table-card .table-header h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  font-weight: 600;
}

.table-card .table-header .sub-info {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table th {
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  font-weight: 600;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

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

.data-table tr:hover td {
  background: rgba(88, 101, 242, 0.04);
}

.data-table .mono {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.8rem;
}

.data-table .dim {
  color: var(--text-dim);
}

/* --- Pagination --- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-dim);
}

.pagination .page-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pagination select {
  padding: 0.25rem 0.4rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 0.75rem;
  font-family: inherit;
}

.pagination .page-btns {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.pagination .page-btn {
  padding: 0.25rem 0.6rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  font-size: 0.75rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}

.pagination .page-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--text);
}

.pagination .page-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.pagination .page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* --- Utility Classes --- */
.w-full {
  width: 100%;
}

.desc-text {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
}

.desc-text strong {
  color: var(--text);
}

.mt-sm {
  margin-top: 0.5rem;
}

.inline-action {
  flex: 0;
  align-self: flex-end;
}

.refresh-note {
  text-align: center;
  color: #2a2a3a;
  font-size: 0.7rem;
  margin-top: 1rem;
}
