/**
 * Component Styles
 */

/* Buttons */
.btn {
  border: 0;
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.875rem;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-md);
  text-decoration: none;
}

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

.btn-primary {
  background-color: var(--blue);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--navy);
  box-shadow: 0 4px 12px rgba(29, 78, 216, 0.3);
}

.btn-secondary {
  background-color: white;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--bg);
}

.btn-danger {
  background-color: #fff1f0;
  color: var(--red);
  border: 1px solid #fecdca;
}

.btn-danger:hover:not(:disabled) {
  background-color: #fce4e2;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.75rem;
}

.btn-icon {
  padding: var(--sp-md);
  border-radius: var(--radius-md);
  background-color: transparent;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.btn-icon:hover {
  background-color: var(--bg);
}

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--sp-2xl);
  transition: var(--transition);
}

.card:hover {
  border-color: #d0d5dd;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.card-header {
  margin-bottom: var(--sp-lg);
  padding-bottom: var(--sp-lg);
  border-bottom: 1px solid var(--line);
}

.card-header h3 {
  margin: 0;
}

.card-body {
  margin: 0;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  background-color: #f3f4f6;
  color: #374151;
}

.badge-hot {
  background-color: #fee2e2;
  color: var(--red);
}

.badge-warm {
  background-color: #fef3c7;
  color: var(--orange);
}

.badge-cool {
  background-color: #e0f2fe;
  color: #0369a1;
}

.badge-cold {
  background-color: #f3f4f6;
  color: #6b7280;
}

.badge-blue {
  background-color: #dbeafe;
  color: var(--blue);
}

.badge-purple {
  background-color: #ede9fe;
  color: var(--purple);
}

.badge-green {
  background-color: #dcfce7;
  color: var(--green);
}

/* Forms */
.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  margin-bottom: var(--sp-lg);
}

.form-field label {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--ink);
}

.form-field input,
.form-field select,
.form-field textarea {
  padding: var(--sp-md) var(--sp-lg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.875rem;
  transition: var(--transition);
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.1);
}

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

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-lg);
  margin-bottom: var(--sp-lg);
}

.form-grid .form-field.full {
  grid-column: 1 / -1;
}

.form-control {
  padding: var(--sp-md) var(--sp-lg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.875rem;
}

/* Tables */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table thead {
  background-color: var(--bg);
}

.table th {
  padding: var(--sp-lg);
  text-align: left;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}

.table td {
  padding: var(--sp-lg);
  border-bottom: 1px solid var(--line);
}

.table tbody tr:hover {
  background-color: var(--bg);
}

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

/* Table actions */
.table-actions,
.draft-actions,
.watch-actions,
.mission-actions {
  display: flex;
  gap: var(--sp-sm);
  flex-wrap: wrap;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
}

.btn-success {
  background-color: #f0fdf4;
  color: #166534;
  border: 1px solid #dcfce7;
}

.btn-success:hover:not(:disabled) {
  background-color: #dcfce7;
}

.btn-warning {
  background-color: #fffbeb;
  color: #b45309;
  border: 1px solid #fef3c7;
}

.btn-warning:hover:not(:disabled) {
  background-color: #fef3c7;
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Modal Content */
.modal-content {
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease-in-out;
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

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

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--ink);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.modal-close:hover {
  background-color: var(--bg);
  color: var(--ink);
}

.modal-body {
  padding: var(--sp-xl);
}

.modal-body .form-field {
  margin-bottom: var(--sp-lg);
}

.modal-body .form-field:last-child {
  margin-bottom: 0;
}

.modal-footer {
  padding: var(--sp-xl);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-md);
}

.modal-footer .btn {
  min-width: 100px;
}

/* Modal Confirm (narrower) */
.modal-confirm .modal-content {
  max-width: 400px;
}

/* Form inputs in modal */
.modal-body input,
.modal-body textarea,
.modal-body select {
  width: 100%;
  padding: var(--sp-md);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.875rem;
  background-color: white;
}

.modal-body input:focus,
.modal-body textarea:focus,
.modal-body select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.1);
}

.modal-body input.error,
.modal-body textarea.error,
.modal-body select.error {
  border-color: var(--red);
  background-color: #fff1f0;
}

/* Toast notifications */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: var(--sp-lg) var(--sp-xl);
  border-radius: var(--radius-lg);
  font-weight: 600;
  z-index: 1001;
  max-width: 400px;
  animation: slideInRight 0.3s ease-in-out;
  opacity: 0;
}

@keyframes slideInRight {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast.show {
  opacity: 1;
}

.toast-success {
  background-color: #f0fdf4;
  color: #166534;
  border: 1px solid #dcfce7;
}

.toast-error {
  background-color: #fff1f0;
  color: #b91c1c;
  border: 1px solid #fecdca;
}

.toast-warning {
  background-color: #fffbeb;
  color: #b45309;
  border: 1px solid #fef3c7;
}

.toast-info {
  background-color: #f0f9ff;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

/* Lists styling */
.watches-list,
.drafts-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: var(--sp-lg);
}
}

.table td {
  padding: var(--sp-lg);
  border-bottom: 1px solid var(--line);
}

.table tbody tr:hover {
  background-color: var(--bg);
}

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

/* Spinner */
.spinner {
  display: flex;
  gap: var(--sp-sm);
  justify-content: center;
  align-items: center;
}

.spinner-item {
  width: 8px;
  height: 8px;
  background-color: var(--blue);
  border-radius: 50%;
  animation: spin 1.4s infinite ease-in-out both;
}

.spinner-item:nth-child(1) {
  animation-delay: -0.32s;
}

.spinner-item:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes spin {
  0%, 80%, 100% {
    opacity: 0.4;
    transform: scale(0.8);
  }
  40% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Toast */
.toast {
  position: fixed;
  bottom: -100px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--ink);
  color: white;
  padding: var(--sp-lg) var(--sp-2xl);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  transition: bottom 0.3s ease-in-out;
  z-index: 1000;
}

.toast.show {
  bottom: var(--sp-3xl);
}

.toast-success {
  background-color: var(--green);
}

.toast-error {
  background-color: var(--red);
}

.toast-warning {
  background-color: var(--orange);
}

.toast-info {
  background-color: var(--blue);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: var(--sp-3xl);
  color: var(--muted);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: var(--sp-lg);
}

.empty-state h3 {
  color: var(--ink);
  margin-bottom: var(--sp-md);
}

.empty-state p {
  margin: 0;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 100;
}

.modal.active {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal-dialog {
  position: relative;
  background: var(--card);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 500px;
  margin: auto;
  z-index: 101;
  animation: slideUp 0.3s ease-in-out;
}

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

.modal-header h2 {
  margin: 0;
}

.modal-close {
  background: transparent;
  border: 0;
  font-size: 24px;
  cursor: pointer;
  color: var(--muted);
  transition: var(--transition);
}

.modal-close:hover {
  color: var(--ink);
}

.modal-body {
  padding: var(--sp-2xl);
}

.modal-footer {
  padding: var(--sp-2xl);
  border-top: 1px solid var(--line);
  display: flex;
  gap: var(--sp-md);
  justify-content: flex-end;
}
