/* ============================================
   COMPONENTS.CSS - Reusable UI Components
   Buttons, Modals, Pagination
   ============================================ */

/* ===== BASE BUTTON ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.2;
}

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

/* ===== COLOR VARIANTS ===== */
.btn-primary {
  background-color: var(--alura-primary, #167BF7);
  color: white;
}
.btn-primary:hover:not(:disabled) {
  background-color: #0056b3;
}

.btn-secondary {
  background-color: #6c757d;
  color: white;
}
.btn-secondary:hover:not(:disabled) {
  background-color: #5a6268;
}

.btn-success {
  background-color: #28a745;
  color: white;
}
.btn-success:hover:not(:disabled) {
  background-color: #218838;
}

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

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

.btn-info {
  background-color: var(--alura-primary, #167BF7);
  color: white;
}
.btn-info:hover:not(:disabled) {
  background-color: #0056b3;
}

/* ===== SPECIFIC BUTTON TYPES ===== */
.btn-cancel {
  padding: 10px 20px;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  background-color: white;
  color: #555;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-cancel:hover {
  background-color: #f0f0f0;
}

.btn-detail {
  padding: 5px 10px;
  font-size: 1em;
  text-decoration: none;
  background-color: var(--alura-primary, #167BF7);
  color: white;
  border-radius: 4px;
  display: inline-block;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-detail:hover {
  background-color: #0056b3;
  color: white;
}

.btn-delete {
  background-color: #dc3545;
  color: white;
}
.btn-delete:hover:not(:disabled) {
  background-color: #c82333;
}

.btn-view-course {
  background-color: var(--alura-secondary, #051933);
  color: white;
}
.btn-view-course:hover:not(:disabled) {
  background-color: #0a2b5c;
  text-decoration: none;
  color: white;
}

.btn-block {
  background-color: var(--alura-primary, #167BF7);
  color: white;
}
.btn-block:hover:not(:disabled) {
  background-color: #0056b3;
}

.btn-user {
  background-color: #28a745;
  color: white;
}
.btn-user:hover:not(:disabled) {
  background-color: #218838;
}

.btn-admin {
  background-color: var(--alura-secondary, #051933);
  color: white;
}
.btn-admin:hover:not(:disabled) {
  background-color: #0a2b5c;
}

.btn-beta-user {
  background-color: #080808;
  color: white;
}
.btn-beta-user:hover:not(:disabled) {
  background-color: #363634;
}

.btn-confirm-delete {
  height: 100%;
  background-color: #dc3545;
  color: white;
}
.btn-confirm-delete:hover:not(:disabled) {
  background-color: #c82333;
}

.btn-danger-status {
  background-color: #dc3545;
  color: white;
}
.btn-danger-status:hover:not(:disabled) {
  background-color: #c82333;
}

/* Search box button (used in admin pages) */
.search-box .btn,
.search-box button.btn {
  padding: 10px 20px;
  background-color: var(--alura-primary, #167BF7);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.search-box .btn:hover:not(:disabled),
.search-box button.btn:hover:not(:disabled) {
  background-color: #0056b3;
  transform: translateY(-1px);
}

/* Form button for upload form pages */
.btn-form {
  background-color: #007bff;
  color: white;
  border: none;
  padding: 0.75rem 1.25rem;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1rem;
  width: 100%;
  box-sizing: border-box;
  margin-top: 1rem;
  font-family: inherit;
  transition: background-color 0.2s ease;
}
.btn-form:hover:not(:disabled) {
  background-color: #0056b3;
}

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  margin-top: 16px;
  border-top: 1px solid var(--alura-gray, #C8C8C8);
}

.pagination-info {
  color: var(--alura-text-secondary, #666);
  font-size: 14px;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pagination-pages {
  color: var(--alura-text, #051933);
  font-size: 14px;
  padding: 0 12px;
}

.btn-pagination {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--alura-gray, #C8C8C8);
  border-radius: 6px;
  background-color: var(--alura-bg, #f4f4f9);
  color: var(--alura-primary, #167BF7);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
  cursor: pointer;
}
.btn-pagination:hover {
  background-color: var(--alura-primary, #167BF7);
  color: white;
  border-color: var(--alura-primary, #167BF7);
}

.btn-pagination.disabled,
.btn-pagination:disabled {
  color: var(--alura-text-secondary, #666);
  cursor: not-allowed;
  opacity: 0.5;
}
.btn-pagination.disabled:hover,
.btn-pagination:disabled:hover {
  background-color: var(--alura-bg, #f4f4f9);
  color: var(--alura-text-secondary, #666);
  border-color: var(--alura-gray, #C8C8C8);
}

.btn-pagination-nav {
  padding: 8px 12px;
}

.pagination-numbers {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-pagination-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border: 1px solid var(--alura-gray, #C8C8C8);
  border-radius: 6px;
  background-color: var(--alura-bg, #f4f4f9);
  color: var(--alura-text, #051933);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
  cursor: pointer;
}
.btn-pagination-number:hover {
  background-color: var(--alura-primary, #167BF7);
  color: white;
  border-color: var(--alura-primary, #167BF7);
}

.btn-pagination-number.active {
  background-color: var(--alura-primary, #167BF7);
  color: white;
  border-color: var(--alura-primary, #167BF7);
  font-weight: 600;
}

.pagination-ellipsis {
  color: var(--alura-text-secondary, #666);
  padding: 0 4px;
}

/* ===== MODAL ===== */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  overflow-y: auto;
}

.modal-content {
  background-color: #fefefe;
  margin: 4% auto;
  padding: 0;
  border: none;
  border-radius: 8px;
  width: 90%;
  max-width: 720px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
}

.modal-small {
  max-width: 520px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #dee2e6;
  background-color: #f8f9fa;
  border-radius: 8px 8px 0 0;
}

.modal-header h2 {
  margin: 0;
  color: var(--alura-secondary, #051933);
  font-size: 1.3em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-header-danger {
  background-color: #fff5f5;
  border-bottom-color: #f5c6cb;
}

.modal-header-danger h2 {
  color: #dc3545;
}

.close-modal,
.close-info-modal,
.close-delete-modal,
.close {
  color: #aaa;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s ease;
}

.close-modal:hover,
.close-info-modal:hover,
.close-delete-modal:hover,
.close:hover {
  color: #333;
}

.modal-body {
  padding: 24px;
  flex: 1;
  overflow-y: auto;
}

.modal-body p {
  margin-top: 0;
  margin-bottom: 12px;
  color: #555;
  font-size: 15px;
}

.modal-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.modal-form-group {
  margin-bottom: 20px;
}

.modal-form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
}

.modal-form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.875rem;
  color: #111827;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.modal-form-control:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.modal-form-control::placeholder {
  color: #9ca3af;
}

.modal-info-text {
  margin: 0 0 20px 0;
  font-size: 0.875rem;
  color: #6b7280;
  line-height: 1.5;
}

.modal-checkbox-group {
  margin-bottom: 16px;
}

.modal-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.modal-checkbox-input {
  cursor: pointer;
  accent-color: #3b82f6;
}

.modal-checkbox-text {
  cursor: pointer;
  font-size: 0.875rem;
  color: #374151;
  user-select: none;
}

.modal-info-box {
  display: none;
  background-color: #f3f4f6;
  border-radius: 6px;
  padding: 12px 16px;
  margin-top: 12px;
  margin-bottom: 0;
  font-size: 0.8rem;
}

.modal-info-box p {
  margin: 0 0 8px 0;
  color: #4b5563;
  line-height: 1.5;
}

.modal-info-box ul {
  margin: 0;
  padding-left: 20px;
  color: #4b5563;
  line-height: 1.6;
}

.modal-info-box ul li {
  margin-bottom: 4px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid #dee2e6;
  background-color: #f8f9fa;
  border-radius: 0 0 8px 8px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid #dee2e6;
  background-color: #f8f9fa;
  border-radius: 0 0 8px 8px;
}

/* Warning text inside modal */
.warning-text {
  color: #856404 !important;
  background-color: #fff3cd;
  padding: 12px;
  border-radius: 6px;
  font-size: 13px !important;
  border-left: 4px solid #ffc107;
}

/* ===== STATES ===== */
.disabled,
:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    margin: 8% auto;
  }

  .pagination {
    flex-direction: column;
    gap: 12px;
  }

  .pagination-controls {
    width: 100%;
    justify-content: center;
  }

  .pagination-numbers {
    flex-wrap: wrap;
    justify-content: center;
  }

  .action-buttons {
    flex-direction: column;
  }
}
