/* Admin Panel - Bootstrap Theme Overrides */
:root {
  --primary-custom: #6a4d8a;
  --primary-hover: #4a3570;
  --primary-light: #8b6cb8;
}

/* Custom accent colors */
.text-primary-custom {
  color: var(--primary-custom);
}

.bg-primary-custom {
  background-color: var(--primary-custom);
}

.bg-primary-custom {
  --bs-bg-opacity: 1;
  background-color: var(--primary-custom) !important;
}

/* Badge overrides */
.count-badge {
  --bs-badge-font-size: 1.5rem;
  --bs-badge-padding-x: 0.5rem;
  --bs-badge-padding-y: 0.25rem;
}

.courses-section-title {
  margin-bottom: 0.5rem;
}

/* Smooth transitions
 *
.stat-card a {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175);
}

/* Mobile optimization */
.stat-icon {
  margin-right: 1.5rem;
  flex-shrink: 0;
}

.stat-icon svg,
.stats-icon svg {
  color: inherit;
  height: 48px;
  width: 48px;
}

@media (max-width: 768px) {
  .stat-icon svg,
  .stats-icon svg {
    width: 36px;
    height: 36px;
  }

  .count-badge {
    --bs-badge-font-size: 1.25rem;
  }
}

/* Page header utilities */
.page-header-custom {
  background: linear-gradient(135deg, var(--primary-custom) 0%, var(--primary-hover) 100%);
  color: white;
  padding: 2rem 0;
  margin: -20px -20px 2rem -20px;
  border-radius: 0 0 1rem 1rem;
}

/* Admin layout fixes for fixed header */
.admin-layout {
  margin-top: 56px;
}

.admin-content-wrapper {
  margin-top: 20px;
}

/* Footer */
.footer {
  background: #0a0707;
  color: white;
  padding: 40px 0;
  margin-top: 2rem;
}

.footer p {
  margin: 0 0 8px 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
}

.footer a.text-white {
  color: white;
}

/* Content area scrolling fix */
.content {
  overflow-y: visible;
  height: auto;
  min-height: auto;
  padding: 1.5rem;
}

.content .container-fluid {
  width: 100%;
  max-width: 100%;
}

/* Ensure proper scrolling within content area */
.content > .container-fluid {
  min-height: calc(100% - 3rem);
}

/* Custom scrollbar for content area */
.content::-webkit-scrollbar {
  width: 8px;
}

.content::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

.content::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.content::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Smooth scrolling within content area */
.content * {
  scroll-behavior: smooth;
}

/* Ensure navbar stays fixed */
.navbar-fixed-top {
  fixed-position: top;
  left: 0;
  right: 0;
  z-index: 1050;
}

.page-header-custom h1 {
  font-weight: 700;
}

/* Table utilities */
.admin-table th {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}

/* Recent Logins Card */
.recent-users-card {
  transition: all 0.3s ease;
}

.recent-users-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175);
}

.card-header-icon {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--primary-custom);
}

.users-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.user-login-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 8px;
  transition: all 0.3s ease;
  border-left: 4px solid var(--primary-custom);
}

.user-login-item:hover {
  background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
  transform: translateX(4px);
}

.user-info-mini {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.user-avatar-mini {
  width: 40px;
  height: 40px;
  background: var(--primary-custom);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

.user-details-mini {
  flex: 1;
  min-width: 0;
}

.user-details-mini strong {
  display: block;
  color: #333;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-details-mini .user-email-mini {
  margin: 0;
  color: #666;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.login-date {
  color: var(--primary-custom);
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: 12px;
}

.no-users {
  padding: 40px 20px;
  text-align: center;
  color: #666;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 8px;
  border: 2px dashed #dee2e6;
}

/* Card utilities */
.course-listing-card {
  transition: all 0.3s ease;
}

.course-listing-card:hover {
  transform: translateY(-3px);
}

/* Mobile view adjustments */
@media (max-width: 767px) {
  .btn-group-toggle {
    width: 100%;
  }

  /* Mobile: make all grid columns stretch the full width of the screen */
  .content .row > *,
  .content .row > [class*="col-"] {
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  /* Neutralize bootstrap gutter negative margins so cards reach the screen edges */
  .content .row {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  /* Stat cards fill their column completely */
  .content .stat-card {
    width: 100%;
    max-width: 100%;
  }
}

/* Override Bootstrap's table responsive shadow */
.table-responsive {
  border-radius: 0.5rem;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.075);
}

/**
 * Content Block Drag and Drop Styles
 */

/* Block Item Container */
.block-item {
  position: relative;
  transition: all 0.3s ease;
  border-radius: 8px;
  background: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  cursor: move;
  margin-bottom: 1rem;
}

/* Verified indicator: small green checkmark pinned to the block's
   upper-right corner (ContentBlock editor block cards). */
.block-verified-check {
  position: absolute;
  top: -8px;
  right: -8px;
  z-index: 1;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #198754;
  color: #fff;
  font-size: 13px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
}

.block-verified-check .bi {
  display: block;
}

.block-item:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.block-item.dragging {
  opacity: 0.5;
  transform: scale(0.98);
  border: 2px dashed var(--primary-custom);
}

/* Drag Handle */
.block-drag-handle {
  position: absolute;
  top: 10px;
  left: -15px;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  border-radius: 6px;
  background: transparent;
  transition: all 0.3s ease;
  color: #64748b;

  /* Hide drag handle by default, only show when block-item is hovered */
  opacity: 0;
}

.block-item:hover .block-drag-handle {
  opacity: 1;
}

.block-drag-handle:hover {
  background: rgba(106, 77, 138, 0.1);
  color: var(--primary-custom);
}

.block-drag-handle:active {
  cursor: grabbing;
}

/* Block Content */
.block-content {
  flex-grow: 1;
}

/* Block Type Header */
.block-type {
  text-align: right;
}

.block-type h5 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.4;

  display: flex;
  justify-content: flex-end;
  align-items: center;
}

/* Block Type Indicator */
.content-type-indicator {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  font-size: 0.75rem;
  color: #94a3b8;
  opacity: 0.8;
  border-radius: 4px;
  margin-bottom: 8px;
}

/* Content field visibility toggles */
[content-type-hidden="true"] {
  display: none !important;
}
/* ===================== Content Block Editor ===================== */

.content-block-editor h3 {
  font-weight: 700;
  color: var(--primary-custom, #6a4d8a);
  letter-spacing: -0.02em;
}

.content-block-card .block-drag-handle {
  position: absolute !important;
  top: 50%;
  left: 0;
  transform: translate(-55%, -50%);
  width: 36px !important;
  height: 36px !important;
  background: #fff !important;
  border: 1px solid #e2e8f0;
  border-radius: 50% !important;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
  opacity: 0 !important;
  transition: opacity 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  z-index: 5;
}

.content-block-card:hover .block-drag-handle,
.content-block-card:focus-within .block-drag-handle {
  opacity: 1 !important;
}

.content-block-card .block-drag-handle:hover {
  transform: translate(-55%, -50%) scale(1.1);
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.18);
  color: var(--primary-custom, #6a4d8a);
}

.content-block-card .block-drag-handle:active {
  cursor: grabbing;
}

.block-item.content-block-card {
  display: flex;
  align-items: center;
  padding: 14px 16px !important;
  margin-bottom: 12px !important;
  border: 1px solid #e8ecf3;
  border-left: 4px solid #cbd5e1;
  border-radius: 10px !important;
  background: #fff !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05) !important;
  cursor: move;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.block-item.content-block-card:hover {
  border-color: #d6dce6;
  border-left-color: var(--primary-custom, #6a4d8a);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.09) !important;
  transform: translateY(-1px);
}

.block-item.content-block-card.dragging {
  opacity: 0.5;
  border-left-color: var(--primary-custom, #6a4d8a);
  transform: scale(1.01);
}

/* Icon badge */
.content-block-icon {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  margin-right: 14px;
}

.content-block-icon--paragraph { background: #eef2ff; color: #4f46e5; }
.content-block-icon--video     { background: #fdf2f8; color: #db2777; }
.content-block-icon--pdf       { background: #fef2f2; color: #dc2626; }
.content-block-icon--header    { background: #ecfdf5; color: #059669; }

/* Text info */
.content-block-info {
  flex-grow: 1;
  min-width: 0;
}

.content-block-type {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 3px;
}

.content-block-type--paragraph { background: #eef2ff; color: #4338ca; }
.content-block-type--video     { background: #fdf2f8; color: #be185d; }
.content-block-type--pdf       { background: #fef2f2; color: #b91c1c; }
.content-block-type--header    { background: #ecfdf5; color: #047857; }

.content-block-preview {
  font-size: 0.875rem;
  color: #475569;
  white-space: pre-wrap;
  overflow: visible;
  text-overflow: unset;
  word-break: break-word;
  margin: 0;
  margin-top: 0.25rem;
}

.content-block-preview--editing {
  outline: 2px solid #4f46e5;
  outline-offset: 2px;
  border-radius: 4px;
  cursor: text;
  padding: 0.25rem 0.5rem;
  background-color: #fefce8;
  min-width: 2ch;
}

.content-block-info .content-block-preview {
  cursor: pointer;
}

.inline-edit-status {
  display: inline-block;
  margin-left: 0.5rem;
  font-size: 0.75rem;
  color: #16a34a;
  font-weight: 600;
}

h1.content-block-preview { font-size: 1.6rem; font-weight: 700; }
h2.content-block-preview { font-size: 1.4rem; font-weight: 600; }
h3.content-block-preview { font-size: 1.2rem; font-weight: 600; }
h4.content-block-preview { font-size: 1.1rem; font-weight: 600; }
h5.content-block-preview { font-size: 1rem; font-weight: 600; }
h6.content-block-preview { font-size: 0.9rem; font-weight: 600; }
h1.content-block-preview,
h2.content-block-preview,
h3.content-block-preview,
h4.content-block-preview,
h5.content-block-preview,
h6.content-block-preview { color: #1e293b; margin: 0; }

/* Inline link popover */
.inline-block-link-popover {
  position: absolute;
  z-index: 2000;
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 6px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.inline-block-link-popover .inline-block-link-url {
  width: 220px;
  padding: 4px 8px;
  font-size: 0.85rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
}

.inline-block-link-popover .inline-block-link-blog {
  max-width: 160px;
  padding: 4px 4px;
  font-size: 0.85rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
  cursor: pointer;
}

.inline-block-link-popover button {
  padding: 4px 10px;
  font-size: 0.85rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
  cursor: pointer;
}

.inline-block-link-popover button:hover {
  background: #eef2ff;
  border-color: #4f46e5;
}

.inline-block-link-popover .inline-block-popover-separator {
  width: 1px;
  height: 18px;
  background: #cbd5e1;
}

/* Links inside editable previews and block previews */
.content-block-preview a {
  color: #4f46e5;
  text-decoration: underline;
  cursor: text;
}

.content-block-preview--empty {  color: #94a3b8 !important;
  font-style: italic;
}

/* Actions */
.content-block-actions {
  flex-shrink: 0;
  margin-left: 12px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.content-block-card:hover .content-block-actions,
.content-block-card:focus-within .content-block-actions {
  opacity: 1;
}

.block-delete-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: #ef4444;
  background: #fef2f2;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.block-delete-btn:hover {
  background: #dc2626;
  color: #fff;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.35);
}

/* Empty state */
.content-blocks-empty {
  text-align: center;
  padding: 40px 20px;
  border: 2px dashed #d6dce6;
  border-radius: 12px;
  color: #64748b;
  margin-bottom: 12px;
}

.content-blocks-empty .bi {
  font-size: 2rem;
  color: #94a3b8;
  display: block;
  margin-bottom: 8px;
}

/* Add-block card */
.content-block-editor-card {
  border: none !important;
  border-radius: 12px !important;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08) !important;
}

.content-block-editor-card .card-header {
  background: linear-gradient(135deg, var(--primary-custom, #6a4d8a), #8a6aa8) !important;
  padding: 0.9rem 1.25rem;
}

.content-block-editor-card .card-header h5 {
  font-weight: 600;
  letter-spacing: 0.01em;
}

.content-block-editor-card .nav-tabs {
  background: linear-gradient(135deg, var(--primary-custom, #6a4d8a), #8a6aa8);
  border-bottom: none;
}

.content-block-editor-card .nav-tabs .nav-link {
  color: rgba(255, 255, 255, 0.75);
  font-weight: 600;
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  padding: 0.75rem 1rem;
  margin-bottom: 0;
}

.content-block-editor-card .nav-tabs .nav-link:hover {
  color: #fff;
  border-color: transparent;
}

.content-block-editor-card .nav-tabs .nav-link.active {
  color: #fff;
  background: transparent;
  border-bottom: 3px solid #fff;
}

.content-block-editor-card .form-select.border-accent {
  border-color: var(--primary-custom, #6a4d8a);
  box-shadow: 0 0 0 3px rgba(106, 77, 138, 0.12);
}

/* Admin lessons index: full-width on mobile */
@media (max-width: 640px) {
  .admin-lessons-index {
    padding-left: 0;
    padding-right: 0;
  }

  .admin-lessons-index > .container {
    padding-left: 0;
    padding-right: 0;
    max-width: 100%;
  }
}

/* Dropdown menu styles
 * Override Bootstrap's z-index to ensure dropdowns appear above all content including cookie banner */
.dropdown-menu {
  z-index: 10001 !important;
}

/* Ensure dropdown toggle button is clickable */
[data-bs-toggle="dropdown"] {
  pointer-events: auto;
  user-select: auto;
}

/* Ensure dropdown items are readable and clickable */
.dropdown-item {
  pointer-events: auto;
  user-select: auto;
}
