/* ============================================================
   대만 용산사 100수 관음영첨 점괘 풀이 전용 스타일시트
   assets/css/fortune.css
   ============================================================ */

/* 컬러 팔레트 & 템플릿 테마 */
:root {
    --fortune-red: #B91C1C;
    --fortune-red-dark: #991B1B;
    --fortune-red-light: #FEF2F2;
    --fortune-gold: #D97706;
    --fortune-gold-light: #FFFBEB;
    --fortune-gold-border: #FDE68A;
    --fortune-card-bg: #FFFFFF;
    --fortune-border: #E2E8F0;
    --fortune-text: #1E293B;
    --fortune-muted: #64748B;
    --fortune-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}

/* 메인 컨테이너 */
.fortune-container {
    background: #FFFFFF;
    border-radius: 16px;
    padding: 2.25rem 2rem;
    border: 1px solid var(--fortune-border);
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
    box-shadow: var(--fortune-shadow);
}

/* 상단 헤더 배너 */
.fortune-hero {
    text-align: center;
    padding: 2rem 1.5rem;
    margin-bottom: 2rem;
    border-radius: 16px;
    background: linear-gradient(135deg, #FFF1F2 0%, #FFFBEB 100%);
    border: 1px solid #FFE4E6;
    position: relative;
    overflow: hidden;
}

.fortune-hero::before {
    content: "籤";
    position: absolute;
    right: -15px;
    bottom: -25px;
    font-size: 140px;
    font-family: "Noto Serif KR", serif, "Songti TC", STSong;
    color: rgba(185, 28, 28, 0.05);
    line-height: 1;
    pointer-events: none;
    user-select: none;
}

.fortune-badge-top {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--fortune-red);
    color: #FFFFFF;
    font-size: 13px;
    font-weight: 700;
    padding: 5px 14px;
    border-radius: 50px;
    margin-bottom: 0.85rem;
    letter-spacing: 0.5px;
}

.fortune-hero h1 {
    font-size: 28px;
    font-weight: 900;
    color: #0F172A;
    margin: 0 0 0.6rem 0;
    line-height: 1.3;
}

.fortune-hero p {
    color: #475569;
    font-size: 15px;
    max-width: 620px;
    margin: 0 auto 1.25rem auto;
    line-height: 1.6;
}

/* 참배법 안내 버튼 */
.btn-guide-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #FFFFFF;
    color: var(--fortune-red);
    border: 1.5px solid #FECDD3;
    padding: 7px 18px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(185, 28, 28, 0.08);
}

.btn-guide-toggle:hover {
    background: #FFF1F2;
    border-color: var(--fortune-red);
    transform: translateY(-1px);
}

/* 참배법 안내 박스 (토글) */
.guide-accordion {
    display: none;
    margin-top: 1.5rem;
    text-align: left;
    background: #FFFFFF;
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #FFE4E6;
    animation: fadeInDown 0.3s ease;
}

.guide-accordion.open {
    display: block;
}

.guide-accordion h4 {
    font-size: 16px;
    font-weight: 800;
    color: #991B1B;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.guide-steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}

.guide-step-item {
    background: #FFF8F8;
    border-radius: 8px;
    padding: 12px 14px;
    border-left: 3px solid var(--fortune-red);
}

.guide-step-item strong {
    display: block;
    color: #0F172A;
    font-size: 14px;
    margin-bottom: 4px;
}

.guide-step-item p {
    font-size: 13px;
    color: #64748B;
    margin: 0;
    line-height: 1.45;
}

/* 검색 및 인터랙티브 컨트롤 바 */
.fortune-controls {
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 14px;
    padding: 1.25rem;
    margin-bottom: 1.75rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.search-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 260px;
}

.search-input-wrap {
    position: relative;
    flex: 1;
}

.search-input-wrap i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94A3B8;
    font-size: 15px;
}

.fortune-number-input {
    width: 100%;
    padding: 11px 14px 11px 40px;
    border: 1.5px solid #CBD5E1;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    color: #0F172A;
    background: #FFFFFF;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.fortune-number-input:focus {
    outline: none;
    border-color: var(--fortune-red);
    box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.12);
}

.btn-fortune-submit {
    background: var(--fortune-red);
    color: #FFFFFF;
    border: none;
    padding: 11px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.btn-fortune-submit:hover {
    background: var(--fortune-red-dark);
}

.control-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-fortune-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid #CBD5E1;
    background: #FFFFFF;
    color: #334155;
}

.btn-fortune-action:hover {
    background: #F1F5F9;
    color: #0F172A;
}

.btn-fortune-random {
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    color: #FFFFFF;
    border: none;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.25);
}

.btn-fortune-random:hover {
    background: linear-gradient(135deg, #D97706 0%, #B45309 100%);
    transform: translateY(-1px);
}

.btn-fortune-grid-toggle.active {
    background: #0F172A;
    color: #FFFFFF;
    border-color: #0F172A;
}

/* 1~100 빠른 번호 선택 패널 */
.fortune-grid-panel {
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 14px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.grid-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.grid-panel-header h3 {
    font-size: 16px;
    font-weight: 800;
    color: #0F172A;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 범위 탭 버튼 (1-20, 21-40 등) */
.range-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.range-tab-btn {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    background: #F1F5F9;
    color: #475569;
    border: 1px solid #E2E8F0;
    cursor: pointer;
    transition: all 0.15s;
}

.range-tab-btn.active,
.range-tab-btn:hover {
    background: var(--fortune-red);
    color: #FFFFFF;
    border-color: var(--fortune-red);
}

/* 100개 숫자 칩 그리드 */
.numbers-chips-container {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 8px;
    max-height: 380px;
    overflow-y: auto;
    padding: 4px;
    scrollbar-width: thin;
}

.number-chip {
    aspect-ratio: 1 / 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    color: #334155;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 2px;
    position: relative;
}

.number-chip:hover {
    background: #EFF6FF;
    border-color: #3B82F6;
    color: #1D4ED8;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.number-chip.selected {
    background: var(--fortune-red);
    border-color: var(--fortune-red);
    color: #FFFFFF !important;
    box-shadow: 0 4px 10px rgba(185, 28, 28, 0.3);
}

.chip-grade-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-top: 3px;
}

.chip-grade-dot.dot-sangsang { background: #DC2626; }
.chip-grade-dot.dot-sanggil { background: #059669; }
.chip-grade-dot.dot-junggil { background: #2563EB; }
.chip-grade-dot.dot-jungpyeong { background: #D97706; }
.chip-grade-dot.dot-haha { background: #64748B; }

.number-chip.selected .chip-grade-dot {
    background: #FFFFFF !important;
}

/* ============================================================
   점괘 결과 카드 (뷰어)
   ============================================================ */
.fortune-result-card {
    background: #FFFFFF;
    border-radius: 18px;
    border: 1px solid #E2E8F0;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    margin-bottom: 2rem;
    position: relative;
    transition: all 0.3s ease;
}

/* 카드 상단 배너 */
.card-header-banner {
    padding: 1.75rem 2rem;
    background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
    color: #FFFFFF;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    border-bottom: 4px solid var(--fortune-gold);
}

.card-title-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.card-num-ganzhi {
    font-size: 15px;
    font-weight: 700;
    color: #FCD34D;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-story-title {
    font-size: 26px;
    font-weight: 900;
    color: #FFFFFF;
    margin: 0;
    letter-spacing: -0.5px;
}

/* 길흉 등급 배지 (크고 선명하게) */
.fortune-grade-badge {
    padding: 8px 22px;
    border-radius: 50px;
    font-size: 18px;
    font-weight: 900;
    letter-spacing: 1px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.grade-sangsang {
    background: linear-gradient(135deg, #EF4444 0%, #B91C1C 100%);
    color: #FFFFFF;
    border: 2px solid #FCA5A5;
}

.grade-sanggil {
    background: linear-gradient(135deg, #10B981 0%, #047857 100%);
    color: #FFFFFF;
    border: 2px solid #6EE7B7;
}

.grade-junggil {
    background: linear-gradient(135deg, #3B82F6 0%, #1D4ED8 100%);
    color: #FFFFFF;
    border: 2px solid #93C5FD;
}

.grade-jungpyeong {
    background: linear-gradient(135deg, #F59E0B 0%, #B45309 100%);
    color: #FFFFFF;
    border: 2px solid #FDE68A;
}

.grade-haha {
    background: linear-gradient(135deg, #64748B 0%, #334155 100%);
    color: #FFFFFF;
    border: 2px solid #CBD5E1;
}

/* 카드 본문 */
.card-content-body {
    padding: 2rem;
}

/* 고사 스토리 인트로 */
.card-story-box {
    background: #F8FAFC;
    border-left: 4px solid #3B82F6;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.75rem;
    font-size: 14px;
    color: #334155;
    line-height: 1.6;
}

.card-story-box strong {
    color: #0F172A;
    margin-right: 6px;
}

/* 칠언절구 시(詩) 족자 섹션 */
.card-poem-section {
    background: #FFFDF9;
    border: 1px solid #FDE68A;
    border-radius: 14px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    position: relative;
    box-shadow: inset 0 0 15px rgba(245, 158, 11, 0.05);
}

.poem-section-title {
    font-size: 14px;
    font-weight: 800;
    color: #B45309;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.poem-columns-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.poem-hanzi-box {
    background: rgba(254, 243, 199, 0.4);
    border-radius: 10px;
    padding: 1.25rem;
    border: 1px dashed #FCD34D;
    text-align: center;
}

.poem-hanzi-line {
    font-size: 18px;
    font-weight: 700;
    color: #78350F;
    letter-spacing: 4px;
    margin-bottom: 0.6rem;
    font-family: "Noto Serif KR", "Songti SC", "SimSun", serif;
}

.poem-hanzi-line:last-child {
    margin-bottom: 0;
}

.poem-korean-box {
    background: #FFFFFF;
    border-radius: 10px;
    padding: 1.25rem;
    border: 1px solid #F1F5F9;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.poem-korean-line {
    font-size: 15px;
    font-weight: 600;
    color: #1E293B;
    margin-bottom: 0.6rem;
    line-height: 1.5;
    display: flex;
    align-items: center;
    gap: 8px;
}

.poem-korean-line:last-child {
    margin-bottom: 0;
}

.poem-korean-line i {
    color: #D97706;
    font-size: 11px;
}

/* 현대적 3줄 핵심 요약 하이라이트 */
.card-summary-box {
    background: linear-gradient(135deg, #FEF2F2 0%, #FFF7ED 100%);
    border: 1.5px solid #FECDD3;
    border-radius: 14px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.card-summary-box h4 {
    font-size: 16px;
    font-weight: 800;
    color: #991B1B;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.summary-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.summary-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 15px;
    font-weight: 600;
    color: #1E293B;
    line-height: 1.5;
}

.summary-list li i {
    color: #E11D48;
    margin-top: 4px;
    font-size: 14px;
}

/* 세부 영역별 운세 그리드 */
.card-details-section {
    margin-bottom: 2rem;
}

.details-section-title {
    font-size: 17px;
    font-weight: 800;
    color: #0F172A;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.detail-item-card {
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
    transition: transform 0.2s, box-shadow 0.2s;
}

.detail-item-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.06);
}

.detail-item-top {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.detail-icon-wrap {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}

.icon-wish { background: #EFF6FF; color: #2563EB; }
.icon-wealth { background: #ECFDF5; color: #059669; }
.icon-love { background: #FDF2F8; color: #DB2777; }
.icon-health { background: #F0FDF4; color: #16A34A; }
.icon-travel { background: #FFFBEB; color: #D97706; }
.icon-advice { background: #F3E8FF; color: #9333EA; }

.detail-item-top strong {
    font-size: 15px;
    color: #0F172A;
}

.detail-item-card p {
    font-size: 14px;
    color: #475569;
    margin: 0;
    line-height: 1.55;
}

/* 관음보살 행동 지침 (전폭 강조) */
.detail-item-card.full-width-advice {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, #FAF5FF 0%, #F5F3FF 100%);
    border-color: #E9D5FF;
}

/* 카드 하단 네비게이션 & 공유 바 */
.card-bottom-actions {
    background: #F8FAFC;
    border-top: 1px solid #E2E8F0;
    padding: 1.25rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.prev-next-buttons {
    display: flex;
    gap: 8px;
}

.btn-nav-step {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    background: #FFFFFF;
    border: 1px solid #CBD5E1;
    color: #334155;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-nav-step:hover {
    background: #F1F5F9;
    color: #0F172A;
}

.share-buttons-group {
    display: flex;
    gap: 8px;
}

.btn-share-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 15px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid #CBD5E1;
    background: #FFFFFF;
    color: #334155;
}

.btn-share-action:hover {
    background: #F1F5F9;
    color: #0F172A;
}

.btn-share-primary {
    background: #0284C7;
    color: #FFFFFF;
    border: none;
}

.btn-share-primary:hover {
    background: #0369A1;
}

/* 복사 완료 토스트 알림 */
.fortune-toast {
    position: fixed;
    bottom: 85px;
    left: 50%;
    transform: translateX(-50%) translateY(30px);
    background: rgba(15, 23, 42, 0.95);
    color: #FFFFFF;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 99999;
}

.fortune-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* 로딩 애니메이션 */
.fortune-loading {
    text-align: center;
    padding: 4rem 1rem;
    color: #64748B;
}

.fortune-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid #F1F5F9;
    border-top-color: var(--fortune-red);
    border-radius: 50%;
    animation: fortuneSpin 0.8s linear infinite;
    margin: 0 auto 1rem auto;
}

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

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   반응형 미디어쿼리 (모바일 퍼스트 최적화)
   ============================================================ */
@media (max-width: 992px) {
    .fortune-container {
        padding: 1.5rem 1rem;
        border-radius: 12px;
    }

    .fortune-hero {
        padding: 1.5rem 1rem;
        margin-bottom: 1.25rem;
    }

    .fortune-hero h1 {
        font-size: 22px;
    }

    .card-header-banner {
        padding: 1.25rem;
    }

    .card-story-title {
        font-size: 20px;
    }

    .fortune-grade-badge {
        padding: 6px 16px;
        font-size: 15px;
    }

    .card-content-body {
        padding: 1.25rem;
    }

    .poem-columns-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .poem-hanzi-line {
        font-size: 16px;
        letter-spacing: 2px;
    }

    .details-grid {
        grid-template-columns: 1fr;
    }

    .numbers-chips-container {
        grid-template-columns: repeat(5, 1fr);
    }

    .card-bottom-actions {
        padding: 1rem 1.25rem;
        flex-direction: column;
        align-items: stretch;
    }

    .prev-next-buttons,
    .share-buttons-group {
        width: 100%;
        display: flex;
    }

    .btn-nav-step,
    .btn-share-action {
        flex: 1;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .numbers-chips-container {
        grid-template-columns: repeat(5, 1fr);
        gap: 6px;
    }

    .number-chip {
        font-size: 13px;
    }

    .search-input-group {
        flex-direction: column;
        width: 100%;
    }

    .btn-fortune-submit {
        width: 100%;
    }

    .control-buttons {
        width: 100%;
        display: flex;
    }

    .btn-fortune-action {
        flex: 1;
        justify-content: center;
    }
}
