/**
 * Prawal Custom Widgets - Unified Stylesheet
 *
 * Common styling for all widgets in the Prawal Custom Widgets plugin.
 * Author: Prawal Khare
 *
 * @package Prawal_Custom_Widgets
 */

/* ==========================================================================
   GLOBAL VARIABLES & SHARED FOUNDATIONS
   ========================================================================== */
:root {
  --pcw-font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --pcw-ink: #111735;
  --pcw-muted: #40527d;
}

/* ==========================================================================
   WIDGET: DYNAMIC CATEGORY CARD & GRID
   ========================================================================== */

/* SECTION CONTAINER */
.dccc-section {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
  font-family: var(--pcw-font-family);
  background: radial-gradient(ellipse at 0 0, #e9f7ff 0, transparent 29%),
              radial-gradient(ellipse at 100% 0, #f3eaff 0, transparent 22%),
              linear-gradient(180deg, #fbfeff 0%, #ffffff 75%, #f9fbff 100%);
}

.dccc-section--has-circles::before,
.dccc-section--has-circles::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: 210px;
  height: 210px;
  border: 26px solid #e5f4ff;
  border-radius: 50%;
  top: -125px;
  left: -115px;
  opacity: 0.8;
  pointer-events: none;
}

.dccc-section--has-circles::after {
  left: auto;
  right: -125px;
  top: -135px;
  width: 270px;
  height: 270px;
  border-color: #f0e4ff;
}

.dccc-container {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  box-sizing: border-box;
}

/* SECTION HEADING */
.dccc-heading {
  position: relative;
  text-align: center;
  margin: 0 auto 22px;
  min-height: 150px;
  box-sizing: border-box;
}

.dccc-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  border-radius: 40px;
  background: #f0eaff;
  color: #682fe6;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.dccc-kicker svg,
.dccc-kicker i {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  fill: currentColor;
}

.dccc-heading__title {
  margin: 10px 0 4px;
  font-size: clamp(34px, 4vw, 58px);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: -2px;
  color: #0b122b;
}

.dccc-heading__title span {
  background: linear-gradient(100deg, #1678ff 5%, #7d40f5 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.dccc-heading__description {
  margin: 6px auto 0;
  max-width: 600px;
  color: #40527d;
  font-size: clamp(13px, 1.12vw, 17px);
  line-height: 1.55;
}

.dccc-swoosh {
  width: 135px;
  height: 12px;
  margin: 10px auto 0;
  border-top: 3px solid #3185ff;
  border-radius: 50%;
  transform: rotate(-2deg);
  position: relative;
}

.dccc-swoosh::after {
  content: "";
  position: absolute;
  right: 0;
  top: -3px;
  width: 58px;
  border-top: 3px solid #9753f8;
  border-radius: 50%;
  transform: rotate(5deg);
}

.dccc-doodle {
  position: absolute;
  color: #7043f8;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.15;
  text-align: left;
  letter-spacing: -0.3px;
  pointer-events: none;
}

.dccc-doodle-left {
  left: 6%;
  top: 34px;
  transform: rotate(-9deg);
}

.dccc-doodle-right {
  right: 6%;
  top: 22px;
  transform: rotate(8deg);
}

.dccc-doodle .marks {
  display: block;
  color: #ffb21a;
  font-size: 28px;
  letter-spacing: 5px;
  margin-top: 3px;
}

/* CATEGORY GRID */
.dccc-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 19px 22px;
  width: 100%;
  box-sizing: border-box;
}

/* SINGLE WRAPPER */
.dccc-single-card-wrapper {
  box-sizing: border-box;
  width: 100%;
}

/* CATEGORY CARD */
.dccc-card {
  --dccc-accent: #167aff;
  --dccc-tint: #dceeff;
  --dccc-icon-bg: var(--dccc-accent);
  --dccc-card-start: #ffffff;
  --dccc-card-end: var(--dccc-tint);
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
  position: relative !important;
  overflow: visible !important;
  border-radius: 18px;
  border: 1px solid var(--dccc-tint);
  background: #ffffff;
  color: #111735;
  text-decoration: none !important;
  box-shadow: 0 7px 17px rgba(34, 56, 102, 0.07);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  box-sizing: border-box;
  font-family: var(--pcw-font-family);
}

.dccc-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 15px 27px rgba(34, 56, 102, 0.13);
}

.dccc-card:focus-visible {
  outline: 3px solid var(--dccc-accent);
  outline-offset: 4px;
}

/* PRESETS FALLBACK CLASSES */
.dccc-card.blue   { --dccc-accent: #147bff; --dccc-tint: #d8efff; --dccc-icon-bg: #287cff; }
.dccc-card.orange { --dccc-accent: #f07813; --dccc-tint: #ffebd0; --dccc-icon-bg: #ff9918; }
.dccc-card.sky    { --dccc-accent: #167ff0; --dccc-tint: #d8efff; --dccc-icon-bg: #3489ff; }
.dccc-card.pink   { --dccc-accent: #e91e63; --dccc-tint: #ffe1e9; --dccc-icon-bg: #ff4f70; }
.dccc-card.violet { --dccc-accent: #713df4; --dccc-tint: #e8ddff; --dccc-icon-bg: #7548f5; }
.dccc-card.green  { --dccc-accent: #08aa4a; --dccc-tint: #d9f9e7; --dccc-icon-bg: #37d65b; }
.dccc-card.lilac  { --dccc-accent: #853ee8; --dccc-tint: #eedcff; --dccc-icon-bg: #9b4af4; }
.dccc-card.rose   { --dccc-accent: #f02d5d; --dccc-tint: #ffe0e8; --dccc-icon-bg: #ff4f70; }
.dccc-card.cyan   { --dccc-accent: #009fbe; --dccc-tint: #d6f7fc; --dccc-icon-bg: #08bfc7; }
.dccc-card.yellow { --dccc-accent: #f18a00; --dccc-tint: #ffedcb; --dccc-icon-bg: #ffad19; }

/* CATEGORY IMAGE CONTAINER & OVERLAP FIX */
.dccc-card__image {
  position: relative !important;
  overflow: visible !important;
  height: clamp(112px, 8.7vw, 126px);
  background: var(--dccc-tint);
  border-radius: 18px 18px 0 0;
  z-index: 2;
  box-sizing: border-box;
}

.dccc-card__image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 17px 17px 0 0;
  transition: transform 0.4s ease;
}

.dccc-card:hover .dccc-card__image img {
  transform: scale(1.035);
}

/* OVERLAPPING CIRCULAR ICON BADGE */
.dccc-card__icon {
  position: absolute !important;
  z-index: 5 !important;
  left: 14px !important;
  bottom: -25px !important;
  display: grid !important;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 4px solid #ffffff;
  border-radius: 50%;
  color: #ffffff;
  background-color: var(--dccc-icon-bg) !important;
  box-shadow: 0 5px 14px rgba(25, 43, 82, 0.22);
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: none;
  box-sizing: border-box;
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.28s ease, background-color 0.25s ease;
}

.dccc-card__icon svg,
.dccc-card__icon i {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: #ffffff;
  display: block;
}

.dccc-card:hover .dccc-card__icon {
  transform: translateY(-3px) rotate(-7deg) scale(1.06);
  box-shadow: 0 8px 19px rgba(25, 43, 82, 0.27);
}

/* CATEGORY CARD INFO AREA */
.dccc-card__info {
  position: relative;
  z-index: 1;
  min-height: 72px;
  padding: 32px 12px 10px !important;
  background: linear-gradient(120deg, var(--dccc-card-start, #ffffff), var(--dccc-tint) 155%);
  border-radius: 0 0 17px 17px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-grow: 1;
  box-sizing: border-box;
}

.dccc-card__title {
  font-size: clamp(12px, 1.02vw, 16px);
  line-height: 1.35;
  letter-spacing: -0.4px;
  font-weight: 800;
  margin: 0 0 7px;
  color: #111735;
  overflow-wrap: anywhere;
  word-break: break-word;
  transition: color 0.2s ease;
}

.dccc-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  color: #344873;
  font-size: clamp(11px, 0.92vw, 14px);
  line-height: 1.2;
  margin-top: auto;
}

.dccc-card__count {
  font-weight: 600;
  white-space: nowrap;
}

/* ARROW BADGE WITH DIAGONAL HOVER TILT */
.dccc-card__arrow {
  --dccc-arrow-tilt: -45deg;
  --dccc-arrow-x: 2px;
  --dccc-arrow-y: -2px;
  --dccc-arrow-scale: 1.05;
  display: grid;
  place-items: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  margin-top: -13px;
  margin-bottom: -1px;
  border-radius: 50%;
  background: var(--dccc-tint);
  color: var(--dccc-accent);
  font-size: 20px;
  font-weight: bold;
  line-height: 1;
  box-sizing: border-box;
  transform-origin: center center;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), background-color 0.2s ease, color 0.2s ease;
}

.dccc-card__arrow svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}

.dccc-card:hover .dccc-card__arrow {
  background-color: var(--dccc-accent);
  color: #ffffff;
  transform: translate(var(--dccc-arrow-x, 2px), var(--dccc-arrow-y, -2px)) rotate(var(--dccc-arrow-tilt, -45deg)) scale(var(--dccc-arrow-scale, 1.05));
}

/* RESPONSIVE BREAKPOINTS */
@media (max-width: 1050px) {
  .dccc-section {
    padding: 38px 24px 30px;
  }
  .dccc-heading {
    min-height: 140px;
    margin-bottom: 25px;
  }
  .dccc-doodle {
    display: none;
  }
  .dccc-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
  }
  .dccc-card__image {
    height: 150px;
  }
  .dccc-card__title {
    font-size: 15px;
  }
  .dccc-card__icon {
    width: 48px;
    height: 48px;
    bottom: -23px !important;
  }
  .dccc-card__info {
    padding-top: 29px !important;
  }
}

@media (max-width: 640px) {
  .dccc-section {
    padding: 30px 14px 25px;
  }
  .dccc-heading {
    min-height: auto;
    margin-bottom: 24px;
  }
  .dccc-kicker {
    font-size: 9px;
    letter-spacing: 2px;
    padding: 8px 14px;
  }
  .dccc-heading__title {
    font-size: clamp(30px, 8.5vw, 42px);
    letter-spacing: -1.5px;
    margin-top: 10px;
  }
  .dccc-heading__description {
    max-width: 360px;
    font-size: 13px;
  }
  .dccc-swoosh {
    margin-top: 10px;
  }
  .dccc-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .dccc-card {
    border-radius: 14px;
  }
  .dccc-card__image {
    height: clamp(105px, 28vw, 135px);
    border-radius: 14px 14px 0 0;
  }
  .dccc-card__image img {
    border-radius: 13px 13px 0 0;
  }
  .dccc-card__icon {
    left: 10px !important;
    bottom: -20px !important;
    width: 42px;
    height: 42px;
    border-width: 3px;
  }
  .dccc-card__icon svg,
  .dccc-card__icon i {
    width: 20px;
    height: 20px;
  }
  .dccc-card__info {
    min-height: 70px;
    padding: 26px 10px 10px !important;
  }
  .dccc-card__title {
    font-size: 13px;
    margin-bottom: 6px;
  }
  .dccc-card__meta {
    font-size: 11px;
    gap: 4px;
  }
  .dccc-card__arrow {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
    font-size: 17px;
    margin-top: -8px;
  }
}

@media (max-width: 360px) {
  .dccc-grid {
    gap: 10px;
  }
  .dccc-card__title {
    font-size: 12px;
  }
  .dccc-card__meta {
    font-size: 10px;
  }
  .dccc-card__arrow {
    width: 25px;
    height: 25px;
    flex-basis: 25px;
  }
}

/* ACCESSIBILITY: REDUCED MOTION */
@media (prefers-reduced-motion: reduce) {
  .dccc-card,
  .dccc-card__image img,
  .dccc-card__icon,
  .dccc-card__arrow {
    transition: none !important;
    transform: none !important;
  }
}

/* ==========================================================================
   WIDGET: COURSE CARD REPEATER (.ccrw-*)
   ========================================================================== */

.ccrw-wrapper {
  position: relative;
  width: 100%;
  box-sizing: border-box;
  font-family: var(--pcw-font-family);
}

.ccrw-container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  box-sizing: border-box;
}

/* SECTION HEADER */
.ccrw-section-header {
  margin-bottom: 30px;
  text-align: center;
  box-sizing: border-box;
}

.ccrw-section-header__title {
  margin: 0 0 8px;
  font-size: clamp(26px, 3.2vw, 36px);
  font-weight: 800;
  color: #0b122b;
  line-height: 1.2;
  letter-spacing: -0.5px;
}

.ccrw-section-header__subtitle {
  margin: 0;
  font-size: clamp(14px, 1.2vw, 16px);
  color: #40527d;
  line-height: 1.5;
}

/* GRID LAYOUT */
.ccrw-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  column-gap: 20px;
  row-gap: 24px;
  width: 100%;
  box-sizing: border-box;
}

/* CARD CONTAINER */
.ccrw-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
  overflow: hidden;
  background-color: #ffffff;
  border: 1px solid #eef2f6;
  border-radius: 14px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  box-sizing: border-box;
  height: 100%;
}

.ccrw-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.10);
  border-color: #e2e8f0;
}

/* OVERLAY LINK (FOR FULL CARD CLICKABLE) */
.ccrw-card__overlay-link {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  text-indent: -9999px;
  overflow: hidden;
}

.ccrw-card__btn,
.ccrw-card__title a {
  position: relative;
  z-index: 3;
}

/* THUMBNAIL WRAPPER */
.ccrw-card__thumb-wrap {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 175px;
  background-color: #f1f5f9;
  border-radius: 14px 14px 0 0;
  flex-shrink: 0;
  box-sizing: border-box;
}

.ccrw-card__thumb-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 14px 14px 0 0;
  transition: transform 0.4s ease;
}

.ccrw-card:hover .ccrw-card__thumb-wrap img {
  transform: scale(1.04);
}

/* PROMOTIONAL BADGE */
.ccrw-card__badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  line-height: 1.2;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  pointer-events: none;
  box-sizing: border-box;
}

.ccrw-card__badge--orange {
  background-color: #ff7a00;
  color: #ffffff;
}

.ccrw-card__badge--red {
  background-color: #ef233c;
  color: #ffffff;
}

.ccrw-card__badge--blue {
  background-color: #0866e8;
  color: #ffffff;
}

.ccrw-card__badge--green {
  background-color: #10b981;
  color: #ffffff;
}

/* CARD BODY */
.ccrw-card__body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  box-sizing: border-box;
  min-width: 0;
}

@media (max-width: 1024px) {
  .ccrw-card__body {
    padding: 14px;
  }
}

/* TITLE */
.ccrw-card__title {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  color: #0f172a;
  overflow-wrap: anywhere;
  word-break: break-word;
  transition: color 0.2s ease;
}

.ccrw-card__title a {
  color: inherit;
  text-decoration: none !important;
  transition: color 0.2s ease;
}

.ccrw-card__title a:hover {
  color: #0866e8;
}

.ccrw-card:hover .ccrw-card__title {
  color: #0866e8;
}

/* DESCRIPTION */
.ccrw-card__desc {
  margin: 0 0 14px;
  font-size: 13.5px;
  line-height: 1.45;
  color: #64748b;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* METADATA GROUP */
.ccrw-card__meta-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
  box-sizing: border-box;
}

.ccrw-card__meta-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 500;
  color: #64748b;
  line-height: 1.3;
}

.ccrw-card__meta-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  color: #94a3b8;
  flex-shrink: 0;
}

.ccrw-card__meta-icon i {
  font-size: 13px;
  line-height: 1;
}

.ccrw-card__meta-icon svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
  stroke: currentColor;
}

.ccrw-card__meta-item--1 .ccrw-card__meta-icon {
  color: #94a3b8;
}

.ccrw-card__meta-item--2 .ccrw-card__meta-icon {
  color: #94a3b8;
}

/* CARD FOOTER: PRICING & BUTTON (ALWAYS ALIGNED & NON-CROPPING) */
.ccrw-card__footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap; /* Prevents button cropping when space is constrained */
  gap: 10px;
  box-sizing: border-box;
  min-width: 0;
}

/* PLACEMENT: INLINE (BESIDE PRICE) */
.ccrw-card__footer--inline {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

/* PLACEMENT: BLOCK (NEXT LINE / BELOW PRICE) */
.ccrw-card__footer--block {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 12px;
}

.ccrw-card__footer--block .ccrw-card__pricing {
  width: 100%;
  justify-content: flex-start;
}

.ccrw-card__footer--block .ccrw-card__btn,
.ccrw-card__footer--full-btn .ccrw-card__btn {
  width: 100%;
  text-align: center;
  justify-content: center;
}

/* PRICING */
.ccrw-card__pricing {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  flex-shrink: 1;
  flex-wrap: wrap;
}

.ccrw-card__price-current {
  font-size: clamp(16px, 1.35vw, 19px);
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.3px;
  line-height: 1.1;
  white-space: nowrap;
}

.ccrw-card__price-original {
  font-size: clamp(12px, 1vw, 13.5px);
  font-weight: 500;
  color: #94a3b8;
  text-decoration: line-through;
  line-height: 1.1;
  white-space: nowrap;
}

/* ACTION BUTTON */
.ccrw-card__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 6px;
  background-color: #0866E8;
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none !important;
  line-height: 1;
  transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
  box-sizing: border-box;
  max-width: 100%;
  flex-shrink: 0;
  position: relative;
  z-index: 3;
}

.ccrw-card__btn:hover {
  background-color: #0654be;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(8, 102, 232, 0.25);
}

.ccrw-card__btn svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.ccrw-card__btn:hover svg {
  transform: translateX(3px);
}

/* RESPONSIVE BREAKPOINTS FOR CCRW */
@media (max-width: 1024px) {
  .ccrw-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }
}

@media (max-width: 640px) {
  .ccrw-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .ccrw-card__thumb-wrap {
    height: 190px;
  }
  .ccrw-card__footer {
    flex-wrap: wrap;
    gap: 12px;
  }
}

/* ACCESSIBILITY: REDUCED MOTION */
@media (prefers-reduced-motion: reduce) {
  .ccrw-card,
  .ccrw-card__thumb-wrap img,
  .ccrw-card__btn,
  .ccrw-card__btn svg {
    transition: none !important;
    transform: none !important;
  }
}
