/* ============================================================
   MSAT Cart — cart.css  (msat-v2 edition)
   ============================================================ */

/* ── Variables missing from msat-v2 main.css ─────────────── */
:root {
    --orange-dark: #c43f10;
    --steel:       #4a6580;
    --gray:        #f4f6f9;
    --text:        #1a2e3a;
    --text-light:  #64748b;
    --font:        'Poppins', Arial, sans-serif;
    --radius-lg:   14px;
    --shadow-lg:   0 8px 40px rgba(26,58,78,0.22);
    --header-h:    96px; /* msat-v2 header height */
}

/* ── Container (not defined in v2 main.css) ─────────────── */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ── Course card grid ────────────────────────────────────── */
.course-card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

@media (min-width: 640px) {
    .course-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Inside enrollment layout left column: max 2 cols; 3 only on very wide screens */
.enroll-catalog .course-card-grid {
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    .enroll-catalog .course-card-grid { grid-template-columns: repeat(2, minmax(240px, 1fr)); }
}

/* 3 cards/row only above 1280px, where the catalog stays wide enough that
   each card holds ~235px+ (cards never overflow: see width math). */
@media (min-width: 1281px) {
    .enroll-catalog .course-card-grid { grid-template-columns: repeat(3, minmax(220px, 1fr)); }
}

.course-card {
    background: var(--white);
    border: 1px solid var(--gray-mid);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    min-width: 0; /* allow card to shrink inside grid track */
    transition: box-shadow 0.2s, transform 0.2s;
}

.course-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.course-card-top {
    padding: 1rem 1rem 0.75rem;
    flex: 1;
}

.course-code {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--orange);
    background: rgba(232,80,32,0.1);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    white-space: nowrap;
    margin-bottom: 0.4rem;
}

.course-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--navy);
    line-height: 1.4;
    margin: 0.25rem 0 0;
    overflow-wrap: anywhere; /* wrap long unbreakable course titles */
    word-break: break-word;
}

.course-sub-label {
    font-size: 0.75rem;
    color: var(--text-light);
    margin: 0.3rem 0 0;
}

.course-card-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--gray-mid);
}

.course-card-footer .msat-atc-btn { width: 100%; justify-content: center; }

@media (max-width: 639px) {
    .course-card-footer .msat-atc-btn { width: auto; }
}

/* ── Subcategory heading ─────────────────────────────────── */
.course-sub-heading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.25rem 0 0.75rem;
}

.course-sub-heading span {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-light);
    background: var(--gray);
    border: 1px solid var(--gray-mid);
    padding: 0.2rem 0.7rem;
    border-radius: 20px;
    white-space: nowrap;
}

.course-sub-heading::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--gray-mid);
}

/* ── Section eyebrow ─────────────────────────────────────── */
.section-eyebrow {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: block;
    margin-bottom: 0.2rem;
}

/* ── Add to Cart button ──────────────────────────────────── */
.msat-atc-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 1rem;
    background: var(--orange);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    white-space: nowrap;
    vertical-align: middle;
    margin: 0.25rem 0;
    text-decoration: none;
}

.msat-atc-btn:hover  { background: var(--orange-dark); transform: translateY(-1px); text-decoration: none; color: var(--white); }
.msat-atc-btn:active { transform: translateY(0); }

/* ── Shared btn style used by submit + mobile bar ────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background 0.2s, transform 0.1s;
}

.btn-orange { background: var(--orange); color: var(--white); }
.btn-orange:hover { background: var(--orange-dark); color: var(--white); text-decoration: none; }

/* ── Header cart icon ────────────────────────────────────── */
.cart-icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: var(--radius);
    color: var(--white);
    text-decoration: none;
    transition: background 0.2s;
    flex-shrink: 0;
}

.cart-icon-btn:hover { background: rgba(255,255,255,0.1); color: var(--white); text-decoration: none; }

.msat-cart-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    background: var(--orange);
    color: var(--white);
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    pointer-events: none;
}

/* ── Toast notification ──────────────────────────────────── */
.msat-toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--white);
    box-shadow: var(--shadow-lg);
    max-width: 320px;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
}

.msat-toast.is-visible { opacity: 1; transform: translateY(0); }
.msat-toast--success { background: #1a7f4b; }
.msat-toast--info    { background: var(--steel); }
.msat-toast--error   { background: #c0392b; }

/* ============================================================
   Enrollment page layout
   ============================================================ */

.enroll-page { margin-top: 0; }

/* Hero bar — no extra margin-top needed (v2 header is sticky, not fixed) */
.enroll-hero {
    background: var(--navy);
    padding: 2.5rem 0 2rem;
}

.enroll-title {
    font-size: clamp(1.6rem, 3vw, 2.25rem);
    color: var(--white);
    margin-bottom: 0.4rem;
}

.enroll-sub {
    color: rgba(255,255,255,0.7);
    font-size: 0.95rem;
    margin: 0;
}

.enroll-sub strong { color: var(--white); }

/* ── Contact info band (under hero) ──────────────────────── */
.enroll-contact-band {
    background: var(--navy2, #16243c);
    border-top: 1px solid rgba(255,255,255,.08);
    padding: 1.1rem 0;
}
.enroll-contact-band .container {
    max-width: 1280px;
    padding-left: 24px;
    padding-right: 24px;
}
.enroll-contact-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.25rem 2rem;
}
.ec-item {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    min-width: 0;
}
.ec-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: rgba(255,255,255,.08);
}
.ec-icon svg { width: 17px; height: 17px; fill: var(--orange); }
.ec-text {
    display: flex;
    flex-direction: column;
    font-size: .82rem;
    line-height: 1.35;
    color: rgba(255,255,255,.82);
}
.ec-text strong {
    color: var(--white);
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 2px;
}
.ec-text a { color: rgba(255,255,255,.82); text-decoration: none; }
.ec-text a:hover { color: var(--orange); }

.ec-social {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-left: auto;
}
.ec-social > strong {
    color: var(--white);
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .06em;
}
.ec-social-icons { display: flex; gap: 8px; }
.ec-social-icons a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    background: rgba(255,255,255,.08);
    color: rgba(255,255,255,.8);
    transition: background .18s, color .18s;
}
.ec-social-icons a:hover { background: var(--orange); color: #fff; }
.ec-social-icons svg { width: 15px; height: 15px; fill: currentColor; }
.ec-social-icons a[aria-label="Instagram"] svg { fill: none; stroke: currentColor; }

@media (max-width: 600px) {
    .ec-social { margin-left: 0; }
    .enroll-contact-row { gap: 1rem 1.25rem; }
}

/* ── Category jump bar ───────────────────────────────────── */
.enroll-jumpbar {
    background: var(--white);
    border-bottom: 1px solid var(--gray-mid);
    position: sticky;
    top: var(--header-h);
    z-index: 90;
}

/* Admin bar shifts everything down 32px */
.admin-bar .enroll-jumpbar {
    top: calc(var(--header-h) + 32px);
}

.enroll-jumpbar .container { position: relative; }

.enroll-jumpbar .container::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 3rem;
    background: linear-gradient(to left, var(--white), transparent);
    pointer-events: none;
}

.enroll-jumpbar-inner {
    display: flex;
    gap: 0.35rem;
    padding: 0.65rem 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.enroll-jumpbar-inner::-webkit-scrollbar { display: none; }

@media (max-width: 1023px) {
    .enroll-jumpbar {
        position: static;
        border-bottom: none;
        padding-bottom: 0.25rem;
    }
}

.enroll-jump-btn {
    display: inline-block;
    padding: 0.3rem 0.85rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--cat-color, var(--navy));
    background: transparent;
    border: 1.5px solid var(--cat-color, var(--navy));
    border-radius: 20px;
    text-decoration: none;
    transition: background 0.18s, color 0.18s;
    white-space: nowrap;
}

.enroll-jump-btn:hover {
    background: var(--cat-color, var(--navy));
    color: var(--white);
    text-decoration: none;
}

/* ── Two-column layout ───────────────────────────────────── */
/* Higher specificity (.enroll-page .enroll-layout) so it beats pages.css
   `.container { padding: 0 5% }`, whose percentage padding starves the
   catalog column on wide screens. Fixed 24px padding keeps card widths
   predictable. */
.enroll-page .enroll-layout {
    display: grid;
    grid-template-columns: 1fr;          /* mobile: stacked */
    gap: 2rem;
    align-items: start;
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    padding: 2.5rem 24px 4rem;
}

/* Tablet/desktop: catalog + a FLUID sidebar that shrinks with the viewport
   (clamp) rather than a fixed width that would squeeze the cards. 2 cards/row. */
@media (min-width: 1024px) {
    .enroll-page .enroll-layout {
        grid-template-columns: minmax(0, 1fr) clamp(340px, 32vw, 420px);
        gap: 24px;
    }
}

/* Wide desktop: roomier inquiry sidebar (up to 460px) + 3 cards/row. */
@media (min-width: 1281px) {
    .enroll-page .enroll-layout {
        grid-template-columns: minmax(0, 1fr) clamp(360px, 30vw, 460px);
        gap: 32px;
    }
}

/* Keep hero + jump bar aligned with the layout container (overrides
   pages.css `.container` 1200/5% so left edges line up with the catalog). */
.enroll-hero .container,
.enroll-jumpbar .container {
    max-width: 1280px;
    padding-left: 24px;
    padding-right: 24px;
}

/* ── Catalog column ──────────────────────────────────────── */
.enroll-catalog { min-width: 0; }

.enroll-cat-section .section-eyebrow { color: inherit; }

.enroll-cat-section .section-heading {
    font-size: clamp(1.1rem, 2vw, 1.4rem);
    margin-top: 0;
}

/* ── Inquiry sidebar ─────────────────────────────────────── */
/* Mobile/tablet (<1024px): stacked, in normal flow, full width. */
.enroll-sidebar {
    position: static;
}

/* Desktop: sticky right column. */
@media (min-width: 1024px) {
    .enroll-sidebar {
        position: sticky;
        top: calc(var(--header-h) + 44px + 1.5rem);
    }
    .admin-bar .enroll-sidebar {
        top: calc(var(--header-h) + 44px + 32px + 1.5rem);
    }
}

.inquiry-panel {
    width: 100%;
    min-width: 0;
    background: var(--white);
    border: 1.5px solid var(--gray-mid);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

/* Constrain panel height only when sticky (desktop) so the page can scroll
   past it; when stacked it should size to its content. */
@media (min-width: 1024px) {
    .inquiry-panel {
        max-width: 460px;
        /* Prevent the panel from being taller than the viewport */
        max-height: calc(100vh - var(--header-h) - 44px - 3rem);
    }
}

@media (min-width: 1024px) {
    .admin-bar .inquiry-panel {
        max-height: calc(100vh - var(--header-h) - 44px - 32px - 3rem);
    }
}

/* Items list scrolls, form section scrolls too when panel is constrained */
#msat-cart-items-section {
    overflow-y: auto;
    flex-shrink: 0;
}

#msat-cart-form-wrap {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.inquiry-panel-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--white);
    background: var(--navy);
    padding: 0.9rem 1.25rem;
    flex-shrink: 0; /* always visible — never scrolled away */
}

.cart-panel-count,
#inquiry-count {
    margin-left: auto;
    font-size: 0.75rem;
    font-weight: 500;
    opacity: 0.75;
}

/* Empty state */
.inquiry-empty {
    text-align: center;
    padding: 2rem 1.25rem;
    color: var(--text-light);
}

.inquiry-empty svg { margin: 0 auto 0.75rem; opacity: 0.25; display: block; }
.inquiry-empty p { font-size: 0.85rem; line-height: 1.5; margin: 0; }

/* Items list */
.inquiry-items { max-height: 280px; overflow-y: auto; }

/* Cart rows */
.cart-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--gray-mid);
    transition: background 0.15s;
}

.cart-row:last-child { border-bottom: none; }
.cart-row:hover { background: #fafbfc; }
.cart-row-body { flex: 1; min-width: 0; }

.cart-row-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.45rem;
}

.cart-row-name { font-size: 0.9rem; font-weight: 600; color: var(--navy); line-height: 1.3; }

.course-meta { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.3rem; }

.course-meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--steel);
    background: var(--gray);
    padding: 0.2rem 0.55rem;
    border-radius: 20px;
    white-space: nowrap;
}

.course-meta-pill svg { opacity: 0.6; flex-shrink: 0; }

/* Category tag — no icon, clean label */
.course-category-tag {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--navy);
    background: var(--gray);
    border: 1px solid var(--gray-mid);
    padding: 0.15rem 0.55rem;
    border-radius: 4px;
    white-space: nowrap;
    margin-top: 0.3rem;
}

.cart-row-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: none;
    border: 1.5px solid var(--gray-mid);
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-light);
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.cart-row-remove:hover { background: #fde8e8; border-color: #e57373; color: #c0392b; }

/* Success state */
.inquiry-success { text-align: center; padding: 2rem 1.25rem; }

.inquiry-success-icon {
    width: 52px;
    height: 52px;
    background: #e8f9ee;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.75rem;
    color: #1a7f4b;
}

.inquiry-success h3 { font-size: 1rem; color: var(--navy); margin-bottom: 0.3rem; }
.inquiry-success p { font-size: 0.85rem; color: var(--text-light); margin: 0; }

/* Form inside panel */
.inquiry-form-divider {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-light);
    padding: 0.75rem 1.25rem 0;
    border-top: 1px solid var(--gray-mid);
}

.inquiry-form {
    padding: 0.75rem 1.25rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.iform-group { display: flex; flex-direction: column; gap: 0.25rem; }

.iform-group label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--steel);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.iform-group label .req { color: var(--orange); margin-left: 2px; }

.iform-group input,
.iform-group textarea {
    padding: 0.55rem 0.75rem;
    border: 1.5px solid var(--gray-mid);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.85rem;
    color: var(--text);
    background: var(--white);
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
}

.iform-group input:focus,
.iform-group textarea:focus {
    outline: none;
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(232,80,32,0.12);
}

.iform-group textarea { resize: vertical; min-height: 70px; }

.inquiry-submit { width: 100%; justify-content: center; margin-top: 0.25rem; }

/* ── Mobile floating inquiry bar ─────────────────────────── */
.enroll-mobile-bar {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 200;
    background: var(--navy);
    color: var(--white);
    padding: 0.75rem 1rem;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.2);
}

.enroll-mobile-bar-label { font-size: 0.875rem; font-weight: 600; }

.enroll-mobile-bar-btn {
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 0.85rem;
    padding: 0.45rem 1rem;
}

@media (max-width: 1023px) {
    .enroll-mobile-bar { display: flex; }
}
