/* Reusable Component Styles */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-weight: 600;
  font-size: var(--text-sm);
  line-height: var(--leading-tight);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn:focus-visible {
  outline: 2px solid var(--newrons-accent);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--newrons-accent);
  color: white;
  border-color: var(--newrons-accent);
}

.btn-primary:hover {
  background: var(--newrons-accent-hover);
  border-color: var(--newrons-accent-hover);
  color: white;
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--border-primary);
}

.btn-secondary:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-success {
  background: var(--newrons-success);
  color: white;
  border-color: var(--newrons-success);
}

.btn-success:hover {
  background: #00b85c;
  border-color: #00b85c;
  color: white;
}

.btn-danger {
  background: var(--newrons-danger);
  color: white;
  border-color: var(--newrons-danger);
}

.btn-danger:hover {
  background: #e03b36;
  border-color: #e03b36;
  color: white;
}

.btn-ghost {
  background: transparent;
  color: var(--text-primary);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--bg-hover);
  box-shadow: none;
}

/* Button Sizes */
.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
}

.btn-lg {
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-base);
}

/* Button Groups */
.btn-group {
  display: inline-flex;
  gap: 1px;
  background: var(--border-primary);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.btn-group .btn {
  border-radius: 0;
  margin: 0;
}

.btn-group .btn:hover {
  z-index: 1;
}

/* Forms */
.form-label {
  display: block;
  margin-bottom: var(--space-2);
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.form-control,
.form-select {
  display: block;
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-card);
  background-clip: padding-box;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus,
.form-select:focus {
  color: var(--text-primary);
  background-color: var(--bg-card);
  border-color: var(--newrons-accent);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.1);
}

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

textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

/* Input Groups */
.input-group {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  width: 100%;
}

.input-group-text {
  display: flex;
  align-items: center;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: var(--leading-normal);
  color: var(--text-secondary);
  text-align: center;
  white-space: nowrap;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
}

.input-group > .form-control {
  position: relative;
  flex: 1 1 auto;
  width: 1%;
  min-width: 0;
}

.input-group > .form-control:not(:last-child),
.input-group > .input-group-text:not(:last-child) {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.input-group > .form-control:not(:first-child),
.input-group > .input-group-text:not(:first-child) {
  margin-left: -1px;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

/* Checkboxes and Radios */
.form-check {
  display: flex;
  align-items: center;
  padding-left: 0;
  margin-bottom: var(--space-2);
}

.form-check-input {
  width: 1.25rem;
  height: 1.25rem;
  margin-right: var(--space-2);
  background-color: var(--bg-card);
  border: 2px solid var(--border-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.form-check-input[type="radio"] {
  border-radius: var(--radius-full);
}

.form-check-input:checked {
  background-color: var(--newrons-accent);
  border-color: var(--newrons-accent);
}

.form-check-input:focus {
  box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.1);
}

.form-check-label {
  cursor: pointer;
  color: var(--text-primary);
}

/* Alerts */
.alert {
  position: relative;
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.alert-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.alert-content {
  flex: 1;
}

.alert-title {
  font-weight: 600;
  margin-bottom: var(--space-1);
}

.alert-message {
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

.alert-success {
  background-color: rgba(0, 210, 106, 0.1);
  border-color: rgba(0, 210, 106, 0.2);
  color: var(--newrons-success);
}

.alert-danger {
  background-color: rgba(248, 81, 73, 0.1);
  border-color: rgba(248, 81, 73, 0.2);
  color: var(--newrons-danger);
}

.alert-warning {
  background-color: rgba(255, 193, 7, 0.1);
  border-color: rgba(255, 193, 7, 0.2);
  color: var(--newrons-warning);
}

.alert-info {
  background-color: rgba(88, 166, 255, 0.1);
  border-color: rgba(88, 166, 255, 0.2);
  color: var(--newrons-info);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  z-index: var(--z-modal-backdrop);
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  z-index: var(--z-modal);
  width: 100%;
  height: 100%;
  overflow: hidden;
  outline: 0;
}

.modal-dialog {
  position: relative;
  width: auto;
  margin: var(--space-8) auto;
  max-width: 500px;
}

.modal-content {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  background-color: var(--bg-card);
  background-clip: padding-box;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2xl);
  outline: 0;
}

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

.modal-title {
  margin: 0;
  line-height: var(--leading-tight);
}

.modal-body {
  position: relative;
  flex: 1 1 auto;
  padding: var(--space-6);
}

.modal-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-primary);
}

/* Tooltips */
.tooltip {
  position: absolute;
  z-index: var(--z-tooltip);
  display: none;
  margin: 0;
  font-family: var(--font-sans);
  font-style: normal;
  font-weight: 400;
  line-height: var(--leading-normal);
  text-align: left;
  text-align: start;
  text-decoration: none;
  text-shadow: none;
  text-transform: none;
  letter-spacing: normal;
  word-break: normal;
  word-spacing: normal;
  white-space: normal;
  line-break: auto;
  font-size: var(--text-sm);
  word-wrap: break-word;
}

.tooltip-inner {
  max-width: 200px;
  padding: var(--space-1) var(--space-2);
  color: white;
  text-align: center;
  background-color: var(--gray-900);
  border-radius: var(--radius-md);
}

/* Progress Bars */
.progress {
  display: flex;
  height: 1rem;
  overflow: hidden;
  font-size: var(--text-xs);
  background-color: var(--bg-secondary);
  border-radius: var(--radius-full);
}

.progress-bar {
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  color: white;
  text-align: center;
  white-space: nowrap;
  background-color: var(--newrons-accent);
  transition: width 0.6s ease;
}

/* Pagination */
.pagination {
  display: flex;
  padding-left: 0;
  list-style: none;
  gap: var(--space-1);
}

.page-link {
  position: relative;
  display: block;
  padding: var(--space-2) var(--space-3);
  color: var(--text-primary);
  text-decoration: none;
  background-color: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.page-link:hover {
  z-index: 2;
  color: var(--text-primary);
  text-decoration: none;
  background-color: var(--bg-hover);
  border-color: var(--border-secondary);
}

.page-item.active .page-link {
  z-index: 3;
  color: white;
  background-color: var(--newrons-accent);
  border-color: var(--newrons-accent);
}

.page-item.disabled .page-link {
  color: var(--text-disabled);
  pointer-events: none;
  cursor: auto;
  background-color: var(--bg-secondary);
  border-color: var(--border-primary);
}