/**
 * Animated Advanced Course Card styles.
 *
 * @package CourseWooCards
 */

/* Brand tokens are shared by the card, the gate, and the modal — the gate and
   modal render outside .aac-wrapper (e.g. the modal prints in wp_footer), so
   the variables must be defined on all three roots. */
.aac-wrapper,
.aac-gate,
.aac-modal {
    --cwc-bg: #f7f5f2;
    --cwc-surface: #ffffff;
    --cwc-text: #2f241e;
    --cwc-muted: #7d6f65;
    --cwc-primary: #a86443;
    --cwc-primary-dark: #8e5235;
    --cwc-border: rgba(90, 60, 40, 0.12);
    /* Production / "coming soon" accent (used by the badge, the notify button,
       and the joined/success states). */
    --cwc-soon: #576b50;
    --cwc-soon-dark: #2F423E;
    /* Featured ("کارت ویژه") accent — a warm tint of the primary brand color
       used to lift a highlighted card above the rest of the grid. */
    --cwc-featured-bg: #fdf4ec;
    --cwc-featured-border: rgba(168, 100, 67, 0.45);
}

.aac-wrapper {
    direction: rtl;
    font-family: 'iransans', sans-serif;
    padding: 5px;
    padding-bottom: 16px;
    box-sizing: border-box;
    width: 100%;
}

.aac-card {
    background-color: var(--cwc-surface);
    border-radius: 20px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    border: 1px solid var(--cwc-border);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    z-index: 1;
    height: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.aac-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.4) 50%, rgba(255, 255, 255, 0) 100%);
    transform: skewX(-25deg);
    transition: all 0.7s ease;
    z-index: 2;
    pointer-events: none;
}

.aac-card:hover {
    transform: translateY(-8px) scale(1.01);
    box-shadow: 0 20px 40px rgba(168, 100, 67, 0.15);
    border-color: rgba(168, 100, 67, 0.3);
}

.aac-card:hover::after {
    left: 200%;
    transition: 0.7s ease-in-out;
}

/* Featured card ("کارت ویژه") — same layout, lifted with a warm tinted
   background, a stronger primary border, and a softly glowing shadow so it
   stands out in the grid without changing the card's design. */
.aac-featured {
    background-color: var(--cwc-featured-bg);
    background-image: linear-gradient(160deg, #fffaf6 0%, var(--cwc-featured-bg) 100%);
    border-color: var(--cwc-featured-border);
    box-shadow: 0 14px 34px rgba(168, 100, 67, 0.16);
}

.aac-featured:hover {
    box-shadow: 0 22px 44px rgba(168, 100, 67, 0.22);
    border-color: var(--cwc-primary);
}

.aac-image-box {
    width: 100%;
    height: 180px;
    border-radius: 14px;
    overflow: hidden;
    background-color: var(--cwc-bg);
    position: relative;
    z-index: 1;
}

.aac-discount-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #ff4d4f;
    color: #fff;
    font-family: 'iransans', sans-serif;
    font-size: 11px;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 8px;
    z-index: 5;
    box-shadow: 0 4px 10px rgba(255, 77, 79, 0.3);
}

.aac-image-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s ease, filter 0.4s ease;
}

.aac-card:hover .aac-image-box img {
    transform: scale(1.08) rotate(1deg);
    filter: brightness(1.05);
}

.aac-title {
    font-family: 'iransans', sans-serif;
    font-size: 15px;
    font-weight: 800;
    color: var(--cwc-text);
    margin: 0;
    text-align: right;
    line-height: 2;
    transition: color 0.3s ease;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.aac-title a {
    color: inherit;
    text-decoration: none;
}

.aac-card:hover .aac-title {
    color: var(--cwc-primary);
}

.aac-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 5px;
}

.aac-price-box {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex: 1;
    min-width: 0;
}

.aac-price-box .price-amount {
    font-family: 'iransans', sans-serif;
    font-size: 16px;
    font-weight: 800;
    color: var(--cwc-text);
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 3px;
}

.aac-price-box .price-del {
    font-size: 12px;
    color: var(--cwc-muted);
    text-decoration: line-through;
    opacity: 0.6;
    margin-bottom: 2px;
    font-weight: 600;
}

/* Currency label — single inline word, never split or stacked. */
.aac-toman {
    font-family: 'iransans', sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: var(--cwc-muted);
    margin-right: 2px;
    white-space: nowrap;
}

.aac-divider {
    width: 1px;
    height: 35px;
    background: linear-gradient(to bottom, transparent, var(--cwc-border), transparent);
    margin: 0 2px;
    flex-shrink: 0;
}

.aac-stats-box {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    justify-content: flex-end;
}

.aac-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    padding: 5px 3px;
    border-radius: 12px;
    background: var(--cwc-bg);
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.aac-stat-item:hover {
    transform: translateY(-2px);
    background: rgba(168, 100, 67, 0.08);
    border-color: rgba(168, 100, 67, 0.15);
}

.aac-stat-val {
    font-family: 'iransans', sans-serif;
    font-size: 14px;
    font-weight: 800;
    color: var(--cwc-text);
    margin-bottom: 2px;
    transition: color 0.3s ease;
}

.aac-stat-label {
    font-size: 9px;
    color: var(--cwc-muted);
    transition: color 0.3s ease;
}

.aac-stat-item.highlight {
    background-color: rgba(168, 100, 67, 0.05);
}

.aac-stat-item.highlight .aac-stat-val {
    color: var(--cwc-primary-dark);
}

.aac-card:hover .aac-stat-item.highlight .aac-stat-val,
.aac-card:hover .aac-stat-item.highlight .aac-stat-label {
    color: var(--cwc-primary);
}

.aac-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
    position: relative;
    z-index: 3;
}

.aac-cart-btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background-color: rgba(168, 100, 67, 0.1);
    color: var(--cwc-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    flex-shrink: 0;
    border: none;
    cursor: pointer;
    padding: 0;
}

.aac-cart-btn img,
.aac-cart-btn svg {
    width: 24px !important;
    height: 24px !important;
}

.aac-cart-btn:hover {
    transform: translateY(-1px);
}

.aac-view-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--cwc-primary), var(--cwc-primary-dark));
    color: #ffffff;
    font-family: 'iransans', sans-serif;
    font-size: 14px;
    font-weight: bold;
    text-decoration: none;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
    position: relative;
}

.aac-view-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.25) 50%, rgba(255, 255, 255, 0) 100%);
    transform: skewX(-25deg);
    transition: all 0.5s ease;
}

.aac-view-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(168, 100, 67, 0.3);
}

.aac-view-btn:hover::before {
    left: 200%;
    transition: 0.5s ease-in-out;
}

/* ------------------------------------------------------------------ */
/* "Coming soon" state — same shape/height as a normal card.           */
/* The production cues are overlays + in-row swaps, so no extra rows    */
/* are added and both card types stay exactly the same height.         */
/* ------------------------------------------------------------------ */

/* Production badge with a blinking dot (top-left corner of the cover).
   Glassmorphism: a frosted, semi-transparent dark-green tint that lets the
   cover image show through, with a hairline highlight and soft shadow. */
.aac-prod-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(47, 66, 62, 0.38);
    backdrop-filter: blur(9px) saturate(160%);
    -webkit-backdrop-filter: blur(9px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: #fff;
    font-family: 'iransans', sans-serif;
    font-size: 11.5px;
    font-weight: 700;
    padding: 5px 11px;
    border-radius: 20px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

/* Graceful fallback where backdrop-filter isn't supported. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .aac-prod-badge {
        background: var(--cwc-soon-dark);
    }
}

.aac-prod-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff4d4f;
    flex-shrink: 0;
    animation: aacProdPulse 1.3s ease-in-out infinite;
}

@keyframes aacProdPulse {
    0%   { opacity: 1;    box-shadow: 0 0 0 0 rgba(255, 77, 79, 0.6); }
    70%  { opacity: 0.35; box-shadow: 0 0 0 6px rgba(255, 77, 79, 0); }
    100% { opacity: 1;    box-shadow: 0 0 0 0 rgba(255, 77, 79, 0); }
}

/* Recording progress — a slim track + small label chip overlaid on the cover,
   so it stays elegant and adds no card height. */
.aac-prod-progress {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.aac-prod-progress__label {
    font-family: 'iransans', sans-serif;
    font-size: 10.5px;
    font-weight: 700;
    line-height: 1.7;
    color: #fff;
    background: rgba(20, 14, 10, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    padding: 2px 9px;
    border-radius: 10px;
}

.aac-prod-progress__track {
    position: relative;
    width: 100%;
    height: 5px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.5);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
    overflow: hidden;
}

.aac-prod-progress__bar {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    border-radius: 5px;
    background: linear-gradient(to left, var(--cwc-primary), #c9824f);
    transition: width 0.6s ease;
}

/* Price slot replacement. */
.aac-soon-price {
    font-family: 'iransans', sans-serif;
    font-size: 16px;
    font-weight: 800;
    color: var(--cwc-primary);
}

.aac-soon-sub {
    font-family: 'iransans', sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: var(--cwc-muted);
    margin-top: 2px;
}

/* Notify button — same size/height as .aac-view-btn, but an outline (ghost)
   button rather than a filled one. It fills with green once joined. */
.aac-notify-btn {
    gap: 7px;
    cursor: pointer;
    background: transparent;
    border: 1.5px solid var(--cwc-soon);
    color: var(--cwc-soon-dark);
}

/* The ghost button has no solid fill, so the shine sweep would look odd. */
.aac-notify-btn::before {
    display: none;
}

/* Hover fills the ghost button with the green gradient. */
.aac-notify-btn:hover {
    background: linear-gradient(135deg, var(--cwc-soon), var(--cwc-soon-dark));
    border-color: transparent;
    color: #fff;
    box-shadow: 0 8px 15px rgba(87, 107, 80, 0.3);
}

.aac-notify-btn .aac-notify-label {
    position: relative;
    z-index: 1;
}

.aac-notify-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.aac-notify-btn.is-loading {
    color: transparent;
    pointer-events: none;
}

.aac-notify-btn.is-loading::before {
    display: block;
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border-radius: 50%;
    border: 2px solid rgba(87, 107, 80, 0.3);
    border-top-color: var(--cwc-soon-dark);
    background: none;
    transform: none;
    animation: aacSpin 0.7s linear infinite;
}

.aac-notify-btn.is-done {
    background: linear-gradient(135deg, var(--cwc-soon), var(--cwc-soon-dark));
    border-color: transparent;
    color: #fff;
    cursor: default;
}

.aac-notify-btn.is-done:hover {
    background: linear-gradient(135deg, var(--cwc-soon), var(--cwc-soon-dark));
    transform: none;
    box-shadow: none;
}

.aac-notify-btn.is-error {
    background: linear-gradient(135deg, #c0392b, #962d22);
    border-color: transparent;
    color: #fff;
}

.aac-notify-btn:disabled {
    cursor: default;
}

@keyframes aacSpin {
    to { transform: rotate(360deg); }
}

/* ------------------------------------------------------------------ */
/* Contact modal (logged-out "notify me").                             */
/* ------------------------------------------------------------------ */
.aac-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    direction: rtl;
    font-family: 'iransans', sans-serif;
    padding: 16px;
    box-sizing: border-box;
}

.aac-modal[hidden] {
    display: none;
}

.aac-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(30, 20, 14, 0.55);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.aac-modal__dialog {
    position: relative;
    width: min(92vw, 380px);
    background: var(--cwc-surface);
    border-radius: 18px;
    padding: 24px 22px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
    animation: aacModalIn 0.25s ease;
}

@keyframes aacModalIn {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to   { opacity: 1; transform: none; }
}

.aac-modal__close {
    position: absolute;
    top: 12px;
    left: 14px;
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: var(--cwc-muted);
    cursor: pointer;
    padding: 0;
}

.aac-modal__dialog h3 {
    margin: 0 0 8px;
    font-size: 17px;
    font-weight: 800;
    color: var(--cwc-text);
}

.aac-modal__dialog p {
    margin: 0 0 16px;
    font-size: 13px;
    line-height: 1.9;
    color: var(--cwc-muted);
}

.aac-modal__input {
    width: 100%;
    height: 46px;
    border-radius: 12px;
    border: 1px solid var(--cwc-border);
    background: var(--cwc-bg);
    padding: 0 14px;
    font-family: 'iransans', sans-serif;
    font-size: 14px;
    color: var(--cwc-text);
    box-sizing: border-box;
    text-align: right;
    direction: rtl;
}

.aac-modal__input::placeholder {
    font-size: 16px;
}

.aac-modal__input:focus {
    outline: none;
    border-color: var(--cwc-primary);
    box-shadow: 0 0 0 3px rgba(168, 100, 67, 0.12);
}

.aac-hp {
    position: absolute !important;
    left: -9999px !important;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.aac-modal__msg,
.aac-gate__msg {
    min-height: 18px;
    margin: 10px 2px 0;
    font-size: 12px;
    font-weight: 700;
}

.aac-modal__msg.is-error,
.aac-gate__msg.is-error {
    color: #c0392b;
}

.aac-modal__msg.is-success,
.aac-gate__msg.is-success {
    color: var(--cwc-soon-dark);
}

.aac-modal__submit {
    width: 100%;
    height: 46px;
    margin-top: 14px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--cwc-primary), var(--cwc-primary-dark));
    color: #fff;
    font-family: 'iransans', sans-serif;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    position: relative;
    transition: transform 0.2s ease;
}

.aac-modal__submit:hover {
    transform: translateY(-2px);
}

.aac-modal__submit.is-loading {
    color: transparent;
    pointer-events: none;
}

.aac-modal__submit.is-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #fff;
    animation: aacSpin 0.7s linear infinite;
}

/* Make `hidden` reliably hide the toggled modal views regardless of theme CSS. */
.aac-modal [hidden] {
    display: none !important;
}

/* Confirm view — the remembered-contact chip and "change" affordance. */
.aac-modal__remembered {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    background: var(--cwc-bg);
    border: 1px solid var(--cwc-border);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 13px;
    color: var(--cwc-text);
}

.aac-modal__remembered-label {
    color: var(--cwc-muted);
}

.aac-modal__contact {
    font-weight: 800;
    direction: ltr;
    unicode-bidi: embed;
}

.aac-modal__change {
    margin-inline-start: auto;
    background: none;
    border: none;
    padding: 0;
    color: var(--cwc-primary);
    font-family: 'iransans', sans-serif;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.aac-modal__change:hover {
    color: var(--cwc-primary-dark);
    text-decoration: underline;
}

/* ------------------------------------------------------------------ */
/* Single-product waitlist gate.                                       */
/* ------------------------------------------------------------------ */

/* The gate replaces the normal product layout but still renders the theme's
   header. Some themes draw a border (or shadow) under the site header on
   single-product pages; neutralize it ONLY on the gate page — scoped by the
   `aac-waitlist-gate` body class the plugin adds, so every other page is
   untouched. If your theme uses a different header selector, add it here. */
body.aac-waitlist-gate .site-header,
body.aac-waitlist-gate header.site-header,
body.aac-waitlist-gate #masthead,
body.aac-waitlist-gate .site-header__inner,
body.aac-waitlist-gate .elementor-location-header {
    border-bottom: 0 !important;
    box-shadow: none !important;
}

.aac-gate {
    direction: rtl;
    font-family: 'iransans', sans-serif;
    max-width: 520px;
    margin: 48px auto;
    padding: 0 16px;
    text-align: center;
    color: var(--cwc-text);
}

.aac-gate__card {
    background: var(--cwc-surface);
    border: 1px solid var(--cwc-border);
    border-radius: 22px;
    padding: 28px 24px 30px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.06);
}

.aac-gate__cover {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 16px;
    margin-bottom: 18px;
}

.aac-gate__badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(87, 107, 80, 0.12);
    color: var(--cwc-soon-dark);
    font-size: 12px;
    font-weight: 800;
    padding: 6px 14px;
    border-radius: 20px;
    margin-bottom: 12px;
}

.aac-gate__title {
    font-size: 20px;
    font-weight: 800;
    line-height: 1.8;
    margin: 0 0 8px;
}

.aac-gate__eta {
    color: var(--cwc-muted);
    font-size: 13px;
    margin: 0 0 18px;
}

.aac-gate__progress {
    height: 8px;
    border-radius: 8px;
    background: var(--cwc-bg);
    overflow: hidden;
    margin: 0 0 20px;
}

.aac-gate__progress > span {
    display: block;
    height: 100%;
    border-radius: 8px;
    background: linear-gradient(to left, var(--cwc-primary), #c9824f);
}

.aac-gate__status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(87, 107, 80, 0.12);
    color: var(--cwc-soon-dark);
    border-radius: 14px;
    padding: 14px;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.7;
    margin-bottom: 18px;
}

.aac-gate-form {
    display: flex;
    flex-direction: column;
    margin-bottom: 18px;
}

.aac-gate .aac-view-btn {
    width: 100%;
    margin-bottom: 18px;
}

.aac-gate__back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--cwc-primary);
    font-family: 'iransans', sans-serif;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.aac-gate__back:hover {
    color: var(--cwc-primary-dark);
}

@media (prefers-reduced-motion: reduce) {
    .aac-card,
    .aac-card::after,
    .aac-image-box img,
    .aac-cart-btn,
    .aac-view-btn,
    .aac-view-btn::before,
    .aac-prod-dot,
    .aac-prod-progress__bar,
    .aac-notify-btn.is-loading::before,
    .aac-modal__submit.is-loading::before,
    .aac-modal__dialog {
        transition: none !important;
        animation: none !important;
    }
}
