/* =============================================================================
   custom.css — 대한검진의학회 회원 전용 무료 혜택 지원
   Tailwind(CDN) 위에 얹는 커스텀 스타일 / 타일형 라디오 버튼 활성 상태
   ============================================================================= */

:root {
    --brand-600: #1d4ed8;
    --brand-700: #1e40af;
    --brand-50: #eff6ff;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    word-break: keep-all;          /* 한글 어절 단위 줄바꿈 */
    overflow-wrap: break-word;
}

/* -----------------------------------------------------------------------------
   1. 타일형 라디오 버튼 (지원 항목 선택)
   -------------------------------------------------------------------------- */
.tile-radio {
    position: relative;
    display: block;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.tile-radio input[type="radio"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.tile-radio__body {
    display: flex;
    height: 100%;
    align-items: flex-start;
    gap: .75rem;
    border: 1.5px solid #e2e8f0;
    border-radius: .875rem;
    background: #fff;
    padding: 1rem 1.1rem;
    transition: border-color .18s ease, box-shadow .18s ease,
                background-color .18s ease, transform .18s ease;
}

.tile-radio:hover .tile-radio__body {
    border-color: #93c5fd;
    background: #f8fbff;
}

/* 활성(선택) 상태 */
.tile-radio input[type="radio"]:checked ~ .tile-radio__body {
    border-color: var(--brand-600);
    background: var(--brand-50);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, .14);
    transform: translateY(-1px);
}

/* 키보드 포커스 접근성 */
.tile-radio input[type="radio"]:focus-visible ~ .tile-radio__body {
    outline: 2px solid var(--brand-600);
    outline-offset: 2px;
}

/* 체크 인디케이터 */
.tile-radio__check {
    display: grid;
    place-items: center;
    flex: none;
    width: 1.35rem;
    height: 1.35rem;
    margin-top: .1rem;
    border: 1.5px solid #cbd5e1;
    border-radius: 9999px;
    background: #fff;
    transition: border-color .18s ease, background-color .18s ease;
}

.tile-radio__check::after {
    content: "";
    width: .55rem;
    height: .55rem;
    border-radius: 9999px;
    background: transparent;
    transform: scale(.4);
    transition: background-color .18s ease, transform .18s ease;
}

.tile-radio input[type="radio"]:checked ~ .tile-radio__body .tile-radio__check {
    border-color: var(--brand-600);
}

.tile-radio input[type="radio"]:checked ~ .tile-radio__body .tile-radio__check::after {
    background: var(--brand-600);
    transform: scale(1);
}

.tile-radio__label {
    font-weight: 600;
    color: #0f172a;
    line-height: 1.45;
}

.tile-radio__desc {
    margin-top: .2rem;
    font-size: .8125rem;
    line-height: 1.5;
    color: #64748b;
}

.tile-radio input[type="radio"]:checked ~ .tile-radio__body .tile-radio__label {
    color: var(--brand-700);
}

/* -----------------------------------------------------------------------------
   2. 폼 요소 공통
   -------------------------------------------------------------------------- */
.form-field {
    width: 100%;
    border: 1.5px solid #e2e8f0;
    border-radius: .75rem;
    background: #fff;
    padding: .8rem .95rem;
    font-size: .9375rem;
    color: #0f172a;
    transition: border-color .16s ease, box-shadow .16s ease;
}

.form-field::placeholder {
    color: #94a3b8;
}

.form-field:focus {
    outline: none;
    border-color: var(--brand-600);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, .12);
}

.form-field:disabled {
    background: #f1f5f9;
    color: #94a3b8;
}

select.form-field {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2364748b'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 0 1 1.06.02L10 11.17l3.71-3.94a.75.75 0 1 1 1.08 1.04l-4.25 4.5a.75.75 0 0 1-1.08 0l-4.25-4.5a.75.75 0 0 1 .02-1.06Z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .75rem center;
    background-size: 1.15rem;
    padding-right: 2.4rem;
}

/* 유효성 오류 */
.form-field.is-invalid {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, .1);
}

.field-error {
    display: none;
    margin-top: .375rem;
    font-size: .8125rem;
    color: #dc2626;
}

.field-error.is-visible {
    display: block;
}

.tile-group.is-invalid .tile-radio__body {
    border-color: #fca5a5;
}

/* -----------------------------------------------------------------------------
   3. 제출 버튼 / 로딩 스피너
   -------------------------------------------------------------------------- */
.btn-submit {
    position: relative;
    transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}

.btn-submit:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px -12px rgba(29, 78, 216, .65);
}

.btn-submit:disabled {
    cursor: not-allowed;
    opacity: .7;
}

.spinner {
    display: inline-block;
    width: 1.05rem;
    height: 1.05rem;
    border: 2px solid rgba(255, 255, 255, .45);
    border-top-color: #fff;
    border-radius: 9999px;
    animation: spin .6s linear infinite;
}

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

/* -----------------------------------------------------------------------------
   4. 모달 (AJAX 결과 알림)
   -------------------------------------------------------------------------- */
#appModal[hidden] {
    display: none !important;
}

.modal-backdrop {
    animation: modal-fade .18s ease-out both;
}

.modal-panel {
    animation: modal-rise .24s cubic-bezier(.16, 1, .3, 1) both;
}

@keyframes modal-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes modal-rise {
    from { opacity: 0; transform: translateY(14px) scale(.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

body.modal-open {
    overflow: hidden;
}

/* -----------------------------------------------------------------------------
   5. 스크롤 인 애니메이션
   -------------------------------------------------------------------------- */
.reveal {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity .7s cubic-bezier(.16, 1, .3, 1),
                transform .7s cubic-bezier(.16, 1, .3, 1);
}

.reveal.is-visible {
    opacity: 1;
    transform: none;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

    .reveal,
    .modal-backdrop,
    .modal-panel,
    .tile-radio__body {
        animation: none !important;
        transition: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

/* -----------------------------------------------------------------------------
   6. 관리자 대시보드
   -------------------------------------------------------------------------- */
.admin-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f8fafc;
}

.admin-table tbody tr:hover {
    background: #f8fbff;
}

.status-select {
    appearance: none;
    border-radius: 9999px;
    border: 1px solid transparent;
    padding: .3rem 1.9rem .3rem .8rem;
    font-size: .8125rem;
    font-weight: 600;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23475569'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 0 1 1.06.02L10 11.17l3.71-3.94a.75.75 0 1 1 1.08 1.04l-4.25 4.5a.75.75 0 0 1-1.08 0l-4.25-4.5a.75.75 0 0 1 .02-1.06Z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .5rem center;
    background-size: 1rem;
    transition: box-shadow .15s ease, opacity .15s ease;
}

.status-select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(29, 78, 216, .18);
}

.status-select.is-saving {
    opacity: .55;
    pointer-events: none;
}

.row-flash {
    animation: row-flash 1.1s ease-out;
}

@keyframes row-flash {
    0%   { background-color: #dcfce7; }
    100% { background-color: transparent; }
}

/* 인쇄 */
@media print {
    .no-print { display: none !important; }
}
