/* UI Components Custom Styles - Tailwind CSS to Bootstrap/Template CSS Conversion */

/* Button Styles - Matching Tailwind design */
.ui-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.375rem; /* rounded-md */
  font-weight: 500; /* font-medium */
  transition: all 0.2s ease-in-out; /* transition-colors */
  outline: none;
  border: none;
  cursor: pointer;
}

.ui-button:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5); /* focus:ring-2 focus:ring-blue-500 */
}

.ui-button:disabled {
  pointer-events: none;
  opacity: 0.5;
}

/* Button Variants */
.ui-button-primary {
  background-color: #2563eb; /* bg-blue-600 */
  color: white;
}

.ui-button-primary:hover {
  background-color: #1d4ed8; /* hover:bg-blue-700 */
}

.ui-button-secondary {
  background-color: #4b5563; /* bg-gray-600 */
  color: white;
}

.ui-button-secondary:hover {
  background-color: #374151; /* hover:bg-gray-700 */
}

.ui-button-outline {
  border: 1px solid #d1d5db; /* border border-gray-300 */
  background-color: transparent;
  color: #374151; /* text-gray-700 */
}

.ui-button-outline:hover {
  background-color: #f9fafb; /* hover:bg-gray-50 */
}

.ui-button-ghost {
  background-color: transparent;
  color: #374151; /* text-gray-700 */
}

.ui-button-ghost:hover {
  background-color: #f3f4f6; /* hover:bg-gray-100 */
}

.ui-button-destructive {
  background-color: #dc2626; /* bg-red-600 */
  color: white;
}

.ui-button-destructive:hover {
  background-color: #b91c1c; /* hover:bg-red-700 */
}

/* Button Sizes */
.ui-button-sm {
  height: 2rem; /* h-8 */
  padding: 0 0.75rem; /* px-3 */
  font-size: 0.875rem; /* text-sm */
}

.ui-button-md {
  height: 2.5rem; /* h-10 */
  padding: 0 1rem; /* px-4 */
}

.ui-button-lg {
  height: 3rem; /* h-12 */
  padding: 0 1.5rem; /* px-6 */
  font-size: 1.125rem; /* text-lg */
}

/* Input Styles - Matching Tailwind design */
.ui-input {
  width: 100%;
  padding: 0.5rem 0.75rem; /* px-3 py-2 */
  font-size: 0.75rem; /* text-xs */
  font-weight: 700; /* font-bold */
  border: 1px solid #d1d5db; /* border border-gray-300 */
  border-radius: 0.375rem; /* rounded-md */
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); /* shadow-sm */
  transition: all 0.2s ease-in-out;
}

.ui-input:focus {
  outline: none;
  border-color: #3b82f6; /* focus:border-blue-500 */
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); /* focus:ring-blue-500 */
}

.ui-input.error {
  border-color: #ef4444; /* border-red-500 */
}

.ui-input.error:focus {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1); /* focus:ring-red-500 */
}

/* Badge Styles - Matching Tailwind design */
.ui-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 9999px; /* rounded-full */
  border: 1px solid transparent;
  padding: 0.125rem 0.625rem; /* px-2.5 py-0.5 */
  font-size: 0.75rem; /* text-xs */
  font-weight: 600; /* font-semibold */
  transition: all 0.2s ease-in-out;
}

.ui-badge:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

.ui-badge-default {
  background-color: #3b82f6; /* bg-primary */
  color: white; /* text-primary-foreground */
  border-color: transparent;
}

.ui-badge-default:hover {
  background-color: rgba(59, 130, 246, 0.8); /* hover:bg-primary/80 */
}

.ui-badge-secondary {
  background-color: #6b7280; /* bg-secondary */
  color: white; /* text-secondary-foreground */
  border-color: transparent;
}

.ui-badge-secondary:hover {
  background-color: rgba(107, 114, 128, 0.8); /* hover:bg-secondary/80 */
}

.ui-badge-destructive {
  background-color: #ef4444; /* bg-destructive */
  color: white; /* text-destructive-foreground */
  border-color: transparent;
}

.ui-badge-destructive:hover {
  background-color: rgba(239, 68, 68, 0.8); /* hover:bg-destructive/80 */
}

.ui-badge-outline {
  background-color: transparent;
  color: #1f2937; /* text-foreground */
  border-color: #d1d5db;
}

/* Alert Styles - Matching Tailwind design */
.ui-alert {
  position: relative;
  width: 100%;
  border-radius: 0.5rem; /* rounded-lg */
  padding: 1rem;
}

.ui-alert-default {
  background-color: #ffffff; /* bg-background */
  color: #1f2937; /* text-foreground */
}

.ui-alert-destructive {
  border: 1px solid rgba(239, 68, 68, 0.5); /* border-destructive/50 */
  color: #dc2626; /* text-destructive */
}

.ui-alert-title {
  margin-bottom: 0.25rem; /* mb-1 */
  font-weight: 500; /* font-medium */
  line-height: 1; /* leading-none */
  letter-spacing: -0.025em; /* tracking-tight */
}

.ui-alert-description {
  font-size: 0.875rem; /* text-sm */
  color: #991b1b; /* text-red-900 */
  font-weight: 700; /* font-bold */
  background-color: #f3f4f6; /* bg-gray-100 */
  padding: 0.5rem; /* p-2 */
}

/* Table Styles - Matching Tailwind design */
.ui-table-wrapper {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #e5e7eb; /* border */
  border-radius: 8px;
  margin-bottom: 0;
}

.ui-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-bottom: 0;
}

.ui-table thead {
  background-color: #f9fafb; /* bg-gray-50 */
}

.ui-table thead th {
  padding: 0.5rem 1rem; /* px-4 py-2 */
  text-align: left;
  font-size: 0.75rem; /* text-xs */
  font-weight: 500; /* font-medium */
  color: #6b7280; /* text-gray-500 */
  text-transform: uppercase;
  letter-spacing: 0.05em; /* tracking-wider */
  border-bottom: 1px solid #e5e7eb; /* divide-y divide-gray-200 */
}

.ui-table thead th.sortable {
  cursor: pointer;
  user-select: none;
}

.ui-table thead th.sortable:hover {
  background-color: #f3f4f6; /* hover:bg-gray-100 */
}

.ui-table thead th > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ui-table tbody {
  background-color: white; /* bg-white */
}

.ui-table tbody tr {
  border-bottom: 1px solid #e5e7eb; /* divide-y divide-gray-200 */
}

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

.ui-table tbody tr:hover {
  background-color: #f9fafb; /* hover:bg-gray-50 */
}

.ui-table tbody td {
  padding: 0.5rem 1rem; /* px-4 py-2 */
  white-space: nowrap; /* whitespace-nowrap */
  border-left: none;
  border-right: none;
}

/* Search Input in Table */
.ui-table-search {
  margin-bottom: 1rem; /* mb-4 */
  display: flex;
  align-items: center;
}

.ui-table-search input {
  margin-left: 0.5rem; /* ml-2 */
  padding: 0.5rem; /* p-2 */
  border: 1px solid #d1d5db; /* border */
  border-radius: 0.375rem; /* rounded */
  width: 100%;
}

/* Pagination Styles - Matching Tailwind design */
.ui-pagination {
  margin-top: 1rem; /* mt-4 */
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ui-pagination-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem; /* space-x-2 */
}

.ui-pagination-button {
  padding: 0.5rem; /* p-2 */
  border: 1px solid #d1d5db; /* border */
  border-radius: 0.375rem; /* rounded */
  background-color: white;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.ui-pagination-button:hover:not(:disabled) {
  background-color: #f3f4f6; /* hover:bg-gray-100 */
}

.ui-pagination-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ui-pagination-button.active {
  background-color: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

/* Card Styles */
.ui-card {
  width: 100%;
  margin: 0 auto;
}

.ui-card-header {
  display: flex;
  flex-direction: column;
  gap: 0.375rem; /* space-y-1.5 */
  padding: 1rem; /* p-4 */
}

.ui-card-title {
  font-size: 1.5rem; /* text-2xl */
  font-weight: 600; /* font-semibold */
  line-height: 1; /* leading-none */
  letter-spacing: -0.025em; /* tracking-tight */
}

.ui-card-description {
  font-size: 0.875rem; /* text-sm */
  color: #6b7280; /* text-muted-foreground */
}

.ui-card-content {
  padding: 1rem; /* p-4 */
  padding-top: 0; /* pt-0 */
}

.ui-card-footer {
  display: flex;
  align-items: center;
  padding: 1.5rem; /* p-6 */
  padding-top: 0; /* pt-0 */
}

/* Loading Spinner */
.ui-spinner {
  display: inline-block;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

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

.ui-spinner-sm {
  width: 1rem;
  height: 1rem;
  border-width: 2px;
}

.ui-spinner-md {
  width: 2rem;
  height: 2rem;
  border-width: 3px;
}

.ui-spinner-lg {
  width: 3rem;
  height: 3rem;
  border-width: 4px;
}

/* Switch Styles */
.ui-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 1.5rem; /* h-6 */
  width: 2.75rem; /* w-11 */
  flex-shrink: 0;
  cursor: pointer;
  border-radius: 9999px; /* rounded-full */
  transition: background-color 0.2s ease-in-out;
  border: none;
  background-color: #e5e7eb; /* bg-gray-200 */
  padding: 0.125rem; /* For thumb spacing */
}

.ui-switch[aria-checked="true"] {
  background-color: #2563eb; /* bg-blue-600 */
}

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

.ui-switch:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}

.ui-switch-thumb {
  pointer-events: none;
  display: inline-block;
  height: 1.25rem; /* h-5 */
  width: 1.25rem; /* w-5 */
  border-radius: 9999px; /* rounded-full */
  background-color: white;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease-in-out;
  transform: translateX(0);
}

.ui-switch[aria-checked="true"] .ui-switch-thumb {
  transform: translateX(1.25rem); /* translate-x-5 */
}

/* Progress Bar */
.ui-progress {
  width: 100%;
  height: 0.5rem; /* h-2 */
  background-color: #e5e7eb; /* bg-gray-200 */
  border-radius: 9999px; /* rounded-full */
  overflow: hidden;
}

.ui-progress-bar {
  height: 100%;
  background-color: #3b82f6; /* bg-blue-500 */
  transition: width 0.3s ease-in-out;
}

/* Textarea Styles */
.ui-textarea {
  display: flex;
  min-height: 5rem; /* min-h-[80px] */
  width: 100%;
  border-radius: 0.375rem; /* rounded-md */
  border: 1px solid #d1d5db; /* border border-gray-300 */
  background-color: transparent;
  padding: 0.5rem 0.75rem; /* px-3 py-2 */
  font-size: 0.875rem; /* text-sm */
  transition: all 0.2s ease-in-out;
}

.ui-textarea::placeholder {
  color: #9ca3af; /* placeholder:text-gray-400 */
}

.ui-textarea:focus {
  outline: none;
  border-color: #3b82f6; /* focus:border-blue-500 */
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1); /* focus:ring-2 focus:ring-blue-500 */
}

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

.ui-textarea.error {
  border-color: #ef4444; /* border-red-500 */
}

/* Label Styles */
.ui-label {
  display: block;
  font-size: 0.75rem; /* text-xs */
  font-weight: 700; /* font-bold */
  color: #374151; /* text-gray-700 */
  margin-bottom: 0.25rem; /* mb-1 */
}

.ui-label.error {
  color: #ef4444; /* text-red-500 */
}

/* Checkbox Styles */
.ui-checkbox {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: 2px solid #d1d5db;
  border-radius: 0.25rem;
  background-color: white;
  transition: all 0.2s ease-in-out;
  cursor: pointer;
}

.ui-checkbox:checked {
  background-color: #2563eb;
  border-color: #2563eb;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='white' d='M10 3L4.5 8.5L2 6l1.5-1.5L4.5 6L8.5 2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 75%;
}

.ui-checkbox:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

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

.ui-checkbox:indeterminate {
  background-color: #2563eb;
  border-color: #2563eb;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='2' viewBox='0 0 12 2'%3E%3Crect fill='white' width='8' height='2' x='2' y='0'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 60%;
}
