/*
 * 챌린지 상세 페이지 신버전 — Frontend\Castudy\Screens\CastudyDetailScreen (.cas-cst-*, 토큰 --cst-*)
 * 배치·크기·색은 구버전(csbasic/Views/view-castudy-default.php 의 인라인 CSS)과 같게 맞췄다.
 * 글꼴은 정하지 않는다 — 사이트 테마의 글꼴을 그대로 쓴다.
 */
.cas-cst {
    --cst-accent: #e76060;
    --cst-closed: #808080;
    --cst-applied-bg: #fee500;
    --cst-applied-text: #191919;
    --cst-line: #ededed;
    --cst-soft: #f9f9f9;
    --cst-muted: #808080;
    --cst-bubble-bg: #fff1f1;
    --cst-bubble-text: #ed6262;
    --cst-notice-bg: #fff8e1;
    --cst-notice-text: #7a5b00;

    max-width: 1024px;
    margin: 12px auto 0;
}
.cas-cst p {
    margin: 0;
}

/* 미리보기 안내 (출시하면 없어진다) */
.cas-cst-notice {
    margin: 0 0 16px;
    padding: 10px 14px;
    border-radius: 6px;
    background: var(--cst-notice-bg);
    color: var(--cst-notice-text);
    font-size: 14px;
    font-weight: 600;
}
.cas-cst .cas-cst-notice {
    margin-bottom: 16px;
}
.cas-cst-empty {
    padding: 60px 20px;
    color: var(--cst-muted);
    font-size: 15px;
    text-align: center;
}

/* 위쪽: 썸네일 + 정보 */
.cas-cst-top {
    display: grid;
    grid-template-columns: 482px auto;
}
.cas-cst-top--no-image {
    grid-template-columns: 1fr;
}
.cas-cst-top-left {
    width: 100%;
    max-width: 950px;
}
.cas-cst-thumb {
    display: block;
    width: 100%;
}
.cas-cst-top-right {
    position: relative;
    padding: 0 0 0 30px;
}
.cas-cst-top--no-image .cas-cst-top-right {
    padding-left: 0;
}
.cas-cst-title {
    margin: 0 0 14px;
    font-size: 28px;
    font-weight: 650;
    line-height: 1.35;
}
.cas-cst .cas-cst-subtitle {
    margin-bottom: 14px;
    color: var(--cst-muted);
    font-size: 15px;
}
.cas-cst-dates {
    margin: 10px 0 24px;
    padding: 20px;
    border-radius: 5px;
    background-color: var(--cst-soft);
}
.cas-cst-date span {
    font-size: 15px;
}
.cas-cst-date-label {
    margin-right: 5px;
    font-weight: 800;
}
.cas-cst-date-text {
    font-weight: 500;
}
.cas-cst-hr {
    height: 2px;
    margin: 0;
    border: 0;
    background: #efefef;
}
.cas-cst-price-row {
    padding: 5px 0;
}
.cas-cst-price-label {
    display: inline-block;
    padding: 25px 30px;
    font-size: 16px;
    font-weight: 800;
}
.cas-cst-price {
    font-size: 27px;
    font-weight: 700;
}

/* 신청 버튼과 그 위 말풍선 */
.cas-cst-apply-wrap {
    position: relative;
}
.cas-cst-apply {
    display: block;
    width: 100%;
    padding: 18px 0;
    border: 0;
    border-radius: 6px;
    background-color: var(--cst-accent);
    color: #fff;
    font-family: inherit;
    font-size: 17px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
}
.cas-cst-apply[data-cst-closed] {
    background-color: var(--cst-closed);
}
/* 신청을 마친 상태("오픈채팅방 입장하기") — 신청 전 버튼과 구분되게 카카오톡 노란색 */
.cas-cst-apply[data-cst-applied] {
    background-color: var(--cst-applied-bg);
    color: var(--cst-applied-text);
    font-weight: 700;
}
.cas-cst .cas-cst-bubble {
    position: absolute;
    right: 20px;
    bottom: 45px; /* 구버전과 같이 버튼 위쪽에 살짝 걸친다 */
    display: inline-block;
    padding: 5px 12px;
    border-radius: 14px;
    background-color: var(--cst-bubble-bg);
    color: var(--cst-bubble-text);
    font-size: 14px;
    font-weight: 600;
}
.cas-cst-bubble::after {
    content: '';
    position: absolute;
    right: 18px;
    bottom: -17px;
    width: 0;
    height: 0;
    border-width: 10px;
    border-style: solid;
    border-color: var(--cst-bubble-bg) transparent transparent transparent;
}
.cas-cst .cas-cst-status {
    margin-top: 10px;
    color: var(--cst-muted);
    font-size: 14px;
    text-align: center;
}

/* 아래: 상세정보 탭 + 본문 */
.cas-cst-bottom {
    margin-top: 30px;
}
.cas-cst-tabs {
    display: flex;
    justify-content: space-between;
}
.cas-cst-tab {
    width: 100%;
    padding: 15px 20px;
    border-bottom: 2px solid var(--cst-line);
    font-size: 16px;
    font-weight: 600;
    text-align: center;
}
.cas-cst-tab--selected {
    border-bottom: 3px solid #000;
    color: #000;
}
.cas-cst-frame {
    display: block;
    width: 100%;
    height: 600px;
    border: 0;
}

/* 신청 창 */
.cas-cst-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.5);
}
.cas-cst-modal[hidden] {
    display: none;
}
.cas-cst-modal-box {
    position: relative;
    width: 100%;
    max-width: 380px;
    max-height: calc(100vh - 32px);
    padding: 28px 24px 24px;
    overflow-y: auto;
    border-radius: 16px;
    background: #fff;
    box-sizing: border-box;
}
.cas-cst-modal--busy .cas-cst-modal-box {
    opacity: 0.6;
    pointer-events: none;
}
.cas-cst-modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    padding: 4px 8px;
    border: 0;
    background: transparent;
    color: #555;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}
.cas-cst-modal-title {
    margin: 0 0 14px;
    font-size: 20px;
    font-weight: 600;
}
.cas-cst .cas-cst-step-text {
    margin-bottom: 14px;
    font-size: 15px;
    line-height: 1.6;
}
.cas-cst .cas-cst-step-note {
    margin: 10px 0 0;
    color: var(--cst-muted);
    font-size: 13px;
    line-height: 1.5;
}
.cas-cst-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
    margin-bottom: 8px;
}
.cas-cst-input {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1px solid #828282;
    border-radius: 6px;
    background: #fff;
    color: #000;
    font-family: inherit;
    font-size: 15px;
    box-sizing: border-box;
}
.cas-cst-sub-button {
    height: 42px;
    padding: 0 14px;
    border: 1px solid #828282;
    border-radius: 6px;
    background: #fff;
    color: #000;
    font-family: inherit;
    font-size: 14px;
    white-space: nowrap;
    cursor: pointer;
}
.cas-cst-main-button {
    display: block;
    width: 100%;
    margin-top: 16px;
    padding: 14px 0;
    border: 0;
    border-radius: 6px;
    background-color: var(--cst-accent);
    color: #fff;
    font-family: inherit;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    box-sizing: border-box;
    cursor: pointer;
}
.cas-cst-main-button[hidden] {
    display: none;
}
.cas-cst-link-button {
    display: block;
    margin: 12px 0 0 auto;
    padding: 0;
    border: 0;
    background: transparent;
    color: #555;
    font-family: inherit;
    font-size: 13px;
    text-decoration: underline;
    cursor: pointer;
}
.cas-cst-entry {
    margin: 0;
    padding: 14px 16px;
    border-radius: 6px;
    background: var(--cst-soft);
}
.cas-cst-entry div {
    display: flex;
    gap: 12px;
    padding: 4px 0;
    font-size: 15px;
}
.cas-cst-entry dt {
    flex: 0 0 72px;
    font-weight: 800;
}
.cas-cst-entry dd {
    margin: 0;
    font-weight: 500;
    word-break: break-all;
}
.cas-cst .cas-cst-modal-message {
    margin-top: 14px;
    color: #c0392b;
    font-size: 14px;
    line-height: 1.5;
}

@media screen and (max-width: 826px) {
    .cas-cst-top {
        grid-template-columns: minmax(0, 1fr); /* 한 줄로 쌓는다. minmax(0, …) 는 큰 썸네일이 화면 밖으로 밀어내지 않게 */
        grid-template-rows: auto 1fr;
    }
    .cas-cst-top--no-image {
        grid-template-rows: auto;
    }
    .cas-cst-top-left {
        text-align: center;
    }
    .cas-cst-top-right,
    .cas-cst-top--no-image .cas-cst-top-right {
        padding: 22px;
    }
    .cas-cst-title {
        font-size: 26px;
    }
    .cas-cst-dates {
        padding: 15px;
    }
    .cas-cst-price-label {
        padding: 25px 30px 25px 15px;
    }
    .cas-cst-tab {
        padding: 15px 5px;
        font-size: 14px;
    }
    .cas-cst-notice {
        margin-left: 12px;
        margin-right: 12px;
    }
}
