/* ==========================================================
   ALL COURSES — Complete Redesign
   ========================================================== */

:root {
  --ac-primary:   #2D5487;
  --ac-primary-d: #1E3A5F;
  --ac-primary-l: #EAF1F8;
  --ac-cyan:      #06B6D4;
  --ac-green:     #16A34A;
  --ac-orange:    #EA580C;
  --ac-blue:      #2563EB;
  --ac-yellow:    #F59E0B;
  --ac-red:       #EF4444;
  --ac-text:      #0F172A;
  --ac-muted:     #64748B;
  --ac-border:    rgba(15,23,42,.08);
  --ac-shadow:    0 12px 40px rgba(15,23,42,.09);
  --ac-radius:    20px;
  --ac-card-r:    18px;
}

/* ── Reset & base ──────────────────────────────────────── */
.ac-page * { box-sizing: border-box; }

/* ── HERO ──────────────────────────────────────────────── */
.ac-hero {
  background:
    radial-gradient(circle at 80% 20%, rgba(124,58,237,.13), transparent 38%),
    radial-gradient(circle at 10% 80%, rgba(6,182,212,.10), transparent 35%),
    linear-gradient(165deg, #0F172A 0%, #043174 60%, #0F172A 100%);
  padding: 110px 0 56px;
  direction: rtl;
  position: relative;
  overflow: hidden;
}
.ac-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%232D5487' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.ac-hero-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  flex-wrap: wrap;
}
.ac-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 84, 140, 0.646);
  border: 1px solid rgba(188, 240, 255, 0.4);
  color: #dbecf5;
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 16px;
}
.ac-hero-badge i { font-size: 11px; }
.ac-hero-title {
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 900;
  color: #fff;
  margin: 0 0 12px;
  line-height: 1.2;
  letter-spacing: -.02em;
}
.ac-hero-title span {
  background: linear-gradient(135deg, #06B6D4, #314be3);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.ac-hero-sub {
  color: #94A3B8;
  font-size: 16px;
  line-height: 1.75;
  margin: 0;
  max-width: 420px;
}
.ac-stats-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.ac-stat-box {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 16px;
  padding: 18px 24px;
  text-align: center;
  min-width: 110px;
  backdrop-filter: blur(6px);
}
.ac-stat-num {
  font-size: 28px;
  font-weight: 900;
  color: #fff;
  line-height: 1;
  margin-bottom: 4px;
}
.ac-stat-num span { color: #1888d2; }
.ac-stat-label {
  font-size: 12px;
  color: #94A3B8;
  font-weight: 600;
}

/* ── TOOLBAR ───────────────────────────────────────────── */
.ac-toolbar-wrap {
  background: #fff;
  border-bottom: 1px solid var(--ac-border);
  position: sticky;
  top: 72px;
  z-index: 40;
  box-shadow: 0 4px 24px rgba(15,23,42,.06);
}
.ac-toolbar {
  max-width: 1240px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  direction: rtl;
}

/* Search */
.ac-search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.ac-search-wrap i {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  color: var(--ac-muted);
  font-size: 14px;
  pointer-events: none;
}
#ac-search {
  width: 100%;
  padding: 11px 40px 11px 14px;
  border: 1.5px solid #E5E7EB;
  border-radius: 12px;
  font-family: 'Cairo', sans-serif;
  font-size: 14px;
  color: var(--ac-text);
  background: #FAFAFA;
  outline: none;
  direction: rtl;
  transition: border-color .2s, box-shadow .2s;
}
#ac-search:focus {
  border-color: var(--ac-primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,.1);
  background: #fff;
}
#ac-search::placeholder { color: #9CA3AF; }

/* Filter selects */
.ac-filters-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ac-select {
  appearance: none;
  -webkit-appearance: none;
  background: #F2F6FA url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%232D5487' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat left 10px center;
  padding: 10px 14px 10px 30px;
  border: 1.5px solid #DDD6FE;
  border-radius: 10px;
  font-family: 'Cairo', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--ac-primary);
  cursor: pointer;
  outline: none;
  direction: rtl;
  transition: border-color .2s, box-shadow .2s;
  white-space: nowrap;
}
.ac-select:focus {
  border-color: var(--ac-primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,.1);
}
.ac-select:hover { border-color: var(--ac-primary); }

/* View toggle */
.ac-view-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #F3F4F6;
  border-radius: 10px;
  padding: 4px;
}
.ac-view-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: #9CA3AF;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
  font-size: 14px;
}
.ac-view-btn.active {
  background: #fff;
  color: var(--ac-primary);
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
}

/* Mobile filter btn */
.ac-mobile-filter-btn {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--ac-primary-l);
  color: var(--ac-primary);
  border: 1.5px solid #DDD6FE;
  border-radius: 10px;
  font-family: 'Cairo', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

/* ── RESULTS BAR ───────────────────────────────────────── */
.ac-results-bar {
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px 24px 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  direction: rtl;
}
.ac-count-text {
  font-size: 14px;
  color: var(--ac-muted);
  font-weight: 600;
}
.ac-count-text strong { color: var(--ac-primary); font-weight: 900; }
.ac-active-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}
.ac-tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--ac-primary-l);
  color: var(--ac-primary);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.ac-tag-pill button {
  background: none;
  border: none;
  color: var(--ac-primary);
  cursor: pointer;
  padding: 0;
  font-size: 11px;
  line-height: 1;
  display: flex;
  align-items: center;
}
.ac-clear-all {
  margin-right: auto;
  background: none;
  border: none;
  color: var(--ac-red);
  font-family: 'Cairo', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background .15s;
}
.ac-clear-all:hover { background: #FEF2F2; }

/* ── MAIN CONTENT ──────────────────────────────────────── */
.ac-content {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 24px 72px;
  direction: rtl;
}

/* ── GRID VIEW ─────────────────────────────────────────── */
#ac-grid.grid-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 22px;
}
#ac-grid.list-view {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── CARD — grid ───────────────────────────────────────── */
.ac-card {
  background: #fff;
  border-radius: var(--ac-card-r);
  border: 1px solid var(--ac-border);
  box-shadow: var(--ac-shadow);
  overflow: hidden;
  transition: transform .32s ease, box-shadow .32s ease, border-color .32s ease;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  position: relative;
  height: 100%;
}
.ac-card:hover {
  transform: translateY(-7px);
  box-shadow: 0 24px 56px rgba(124,58,237,.17);
  border-color: rgba(124,58,237,.25);
}

/* Card image */
.ac-card-img {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 */
  overflow: hidden;
  flex-shrink: 0;
}
.ac-card-img img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s ease;
}
.ac-card:hover .ac-card-img img { transform: scale(1.06); }
.ac-card-img-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(3,7,18,.65) 0%, transparent 55%);
}

/* Badges on image */
.ac-badge-type {
  position: absolute;
  top: 12px;
  right: 12px;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  z-index: 2;
  letter-spacing: .3px;
}
.type-online   { background: linear-gradient(135deg,#2563EB,#06B6D4); }
.type-offline  { background: linear-gradient(135deg,#16A34A,#059669); }
.type-recorded { background: linear-gradient(135deg,#2D5487,#4F7FB5); }
.type-both     { background: linear-gradient(135deg,#EA580C,#F59E0B); }

.ac-badge-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  z-index: 2;
}

.ac-badge-cert {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  backdrop-filter: blur(4px);
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Card body */
.ac-card-body {
  padding: 18px 18px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.ac-card-category {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .6px;
  color: var(--ac-primary);
  margin-bottom: 7px;
  text-transform: uppercase;
}
.ac-card-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--ac-text);
  line-height: 1.45;
  margin: 0 0 10px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ac-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 12px;
  color: var(--ac-muted);
  margin-bottom: 12px;
}
.ac-card-meta i { color: var(--ac-primary); margin-left: 3px; font-size: 11px; }
.ac-students {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-right: auto;
}
/* Instructor row */
.ac-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid var(--ac-border);
  padding-top: 12px;
  margin-top: 2px;
}
.ac-instructor {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.ac-instructor-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg,#DDD6FE,#DBEAFE);
  border: 2px solid rgba(124,58,237,.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--ac-primary);
  font-weight: 800;
  flex-shrink: 0;
}
.ac-instructor-name {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 110px;
}
.ac-price-wrap { text-align: left; flex-shrink: 0; }
.ac-price-free {
  font-size: 16px;
  font-weight: 900;
  color: var(--ac-green);
}
.ac-price-paid {
  font-size: 17px;
  font-weight: 900;
  color: var(--ac-text);
  white-space: nowrap;
}
.ac-price-paid .ac-currency {
  font-size: 11px;
  color: var(--ac-muted);
  font-weight: 700;
  margin-right: 2px;
}
/* Enroll btn */
.ac-card-btn {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 11px;
  background: linear-gradient(135deg, var(--ac-primary), var(--ac-primary-d));
  border: none;
  border-radius: 12px;
  font-family: 'Cairo', sans-serif;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform .22s, box-shadow .22s;
  box-shadow: 0 6px 18px rgba(124,58,237,.3);
}
.ac-card-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(124,58,237,.42);
}

/* ── LIST VIEW CARD ────────────────────────────────────── */
#ac-grid.list-view .ac-card {
  flex-direction: row;
  min-height: 160px;
}
#ac-grid.list-view .ac-card-img {
  width: 260px;
  padding-top: 0;
  flex-shrink: 0;
  min-height: 160px;
}
#ac-grid.list-view .ac-card-img img {
  position: absolute;
  inset: 0;
  height: 100%;
}
#ac-grid.list-view .ac-card-body {
  padding: 16px 20px;
}
#ac-grid.list-view .ac-card-title {
  font-size: 17px;
  -webkit-line-clamp: 2;
}
#ac-grid.list-view .ac-card-btn {
  display: none;
}

/* ── EMPTY STATE ───────────────────────────────────────── */
.ac-empty {
  text-align: center;
  padding: 80px 20px;
  display: none;
}
.ac-empty-icon {
  width: 80px;
  height: 80px;
  background: var(--ac-primary-l);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: var(--ac-primary);
  margin-bottom: 20px;
}
.ac-empty h3 {
  font-size: 22px;
  font-weight: 900;
  color: var(--ac-text);
  margin: 0 0 8px;
}
.ac-empty p {
  font-size: 15px;
  color: var(--ac-muted);
  margin: 0 0 24px;
}
.ac-empty-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: linear-gradient(135deg, var(--ac-primary), var(--ac-primary-d));
  color: #fff;
  border: none;
  border-radius: 12px;
  font-family: 'Cairo', sans-serif;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(124,58,237,.3);
  transition: transform .22s, box-shadow .22s;
}
.ac-empty-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(124,58,237,.4); }

/* ── PAGINATION ────────────────────────────────────────── */
.ac-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 48px;
  flex-wrap: wrap;
  direction: ltr;
}
.ac-page-btn {
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  border: 1.5px solid #E5E7EB;
  border-radius: 10px;
  background: #fff;
  color: var(--ac-muted);
  font-family: 'Cairo', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ac-page-btn:hover { border-color: var(--ac-primary); color: var(--ac-primary); }
.ac-page-btn.active {
  background: linear-gradient(135deg, var(--ac-primary), var(--ac-primary-d));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 14px rgba(124,58,237,.35);
}
.ac-page-btn:disabled { opacity: .4; cursor: not-allowed; }
.ac-page-dots {
  color: var(--ac-muted);
  font-weight: 700;
  padding: 0 4px;
}

/* ── SKELETON (loading) ────────────────────────────────── */
.ac-skeleton { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.ac-skel-card {
  border-radius: var(--ac-card-r);
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--ac-border);
}
.ac-skel-img {
  width: 100%;
  padding-top: 56.25%;
  background: linear-gradient(90deg, #F3F4F6 0%, #E5E7EB 50%, #F3F4F6 100%);
  background-size: 200% 100%;
  animation: ac-shimmer 1.4s infinite;
}
.ac-skel-body { padding: 18px; }
.ac-skel-line {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, #F3F4F6 0%, #E5E7EB 50%, #F3F4F6 100%);
  background-size: 200% 100%;
  animation: ac-shimmer 1.4s infinite;
  margin-bottom: 10px;
}
.ac-skel-line.w60 { width: 60%; }
.ac-skel-line.w80 { width: 80%; }
.ac-skel-line.w40 { width: 40%; }
@keyframes ac-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── MOBILE DRAWER ─────────────────────────────────────── */
.ac-drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
}
.ac-drawer-overlay.open { display: block; }
.ac-drawer {
  position: fixed;
  bottom: 0;
  right: 0;
  left: 0;
  background: #fff;
  border-radius: 24px 24px 0 0;
  padding: 24px;
  z-index: 201;
  transform: translateY(100%);
  transition: transform .32s cubic-bezier(0.4,0,0.2,1);
  direction: rtl;
  max-height: 80vh;
  overflow-y: auto;
}
.ac-drawer.open { transform: translateY(0); }
.ac-drawer-handle {
  width: 40px;
  height: 4px;
  background: #E5E7EB;
  border-radius: 2px;
  margin: 0 auto 20px;
}
.ac-drawer-title {
  font-size: 18px;
  font-weight: 900;
  color: var(--ac-text);
  margin: 0 0 20px;
}
.ac-drawer-group { margin-bottom: 20px; }
.ac-drawer-label {
  font-size: 13px;
  font-weight: 800;
  color: #374151;
  margin-bottom: 10px;
  display: block;
}
.ac-chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.ac-chip {
  padding: 8px 16px;
  border: 1.5px solid #E5E7EB;
  border-radius: 999px;
  font-family: 'Cairo', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #374151;
  background: #fff;
  cursor: pointer;
  transition: all .18s;
}
.ac-chip.selected {
  background: var(--ac-primary-l);
  border-color: var(--ac-primary);
  color: var(--ac-primary);
}
.ac-drawer-apply {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--ac-primary), var(--ac-primary-d));
  color: #fff;
  border: none;
  border-radius: 14px;
  font-family: 'Cairo', sans-serif;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  margin-top: 8px;
  box-shadow: 0 6px 18px rgba(124,58,237,.3);
}

/* ── CARD HOVER OVERLAY ────────────────────────────────── */
.ac-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(130deg, rgba(124,58,237,.06), transparent 55%);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
  border-radius: inherit;
}
.ac-card:hover::after { opacity: 1; }

/* ── REVEAL ────────────────────────────────────────────── */
.ac-reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .5s ease, transform .5s ease;
}
.ac-reveal.visible { opacity: 1; transform: none; }

/* ── RESPONSIVE ────────────────────────────────────────── */
@media (max-width: 900px) {
  #ac-grid.grid-view {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
  }
}

@media (max-width: 768px) {
  .ac-hero { padding: 90px 0 40px; }
  .ac-hero-inner { flex-direction: column; gap: 28px; }
  .ac-hero-sub { display: none; }
  .ac-stats-row { gap: 12px; }
  .ac-stat-box { padding: 14px 18px; min-width: 90px; }
  .ac-stat-num { font-size: 22px; }

  .ac-toolbar { gap: 8px; }
  .ac-filters-group { display: none; }
  .ac-mobile-filter-btn { display: flex; }

  #ac-grid.grid-view { grid-template-columns: 1fr; gap: 14px; }
  #ac-grid.list-view .ac-card { flex-direction: column; }
  #ac-grid.list-view .ac-card-img {
    width: 100%;
    padding-top: 56.25%;
    min-height: unset;
  }
  #ac-grid.list-view .ac-card-btn { display: block; }

  .ac-content { padding: 16px 16px 56px; }
  .ac-results-bar { padding: 12px 16px 0; }
  .ac-toolbar { padding: 12px 16px; }
  .ac-hero-inner { padding: 0 16px; }
}

@media (max-width: 480px) {
  .ac-search-wrap { min-width: 100%; }
  .ac-toolbar { flex-wrap: wrap; }
  .ac-skeleton { grid-template-columns: 1fr; }
}

/* ===== ENROLL BUTTONS — FORCE WHITE TEXT ===== */
.ac-card-btn,
.ac-card-btn:link,
.ac-card-btn:visited,
.ac-card-btn:hover,
.ac-card-btn:focus,
.ac-card-btn:active {
    color: #ffffff !important;
}
.ac-card-btn i,
.ac-card-btn svg {
    color: #ffffff !important;
    fill: #ffffff !important;
}
