/* ===== 직업별 생성 순위 페이지 ===== */
.jobrank-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px 80px;
}

.page-nav-link-wrap {
    text-align: left;
    margin-bottom: 10px;
}
.page-nav-link {
    font-size: 13px;
    font-weight: 600;
    color: #7a829a;
    text-decoration: none;
    padding: 5px 12px;
    border: 1px solid #e6e8ef;
    border-radius: 20px;
    background: #f4f5f9;
    transition: background 0.15s, color 0.15s;
    display: inline-block;
}
.page-nav-link:hover {
    background: #3C3744;
    color: #fff;
    border-color: #3C3744;
}

.jobrank-header {
    text-align: center;
    margin-bottom: 26px;
}
.jobrank-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: #3C3744;
    margin: 0 0 8px;
}
.jobrank-sub {
    color: #555;
    font-size: 14px;
    margin: 0 0 6px;
}
.jobrank-meta {
    color: #777;
    font-size: 13px;
    margin: 0;
}

.jobrank-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin: 18px 0 26px;
}
.jobrank-filter label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #444;
}
.jobrank-filter select {
    padding: 6px 10px;
    border: 1px solid #ccd3e0;
    border-radius: 8px;
    background: #fff;
    font-size: 13px;
    color: #3C3744;
}

.jobrank-empty {
    text-align: center;
    padding: 60px 20px;
    background: #f7f8fb;
    border-radius: 12px;
    color: #555;
}
.jobrank-empty .hint {
    margin-top: 8px;
    font-size: 12px;
    color: #888;
}

/* ===== 모드 탭 (카드 내부, 내 직업군 / 내 작은 직업군) ===== */
.jobrank-mode-tabs {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 6px;
    flex-wrap: wrap;
}
.jobrank-mode-tab {
    background: #f4f5f9;
    color: #555;
    border: 1px solid #e1e4ee;
    border-radius: 12px;
    padding: 3px 8px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.jobrank-mode-tab:hover { background: #e9ecf3; }
.jobrank-mode-tab.active { background: #3C3744; color: #fff; border-color: #3C3744; }

/* ===== 뷰 토글 (3개씩 / 1개씩) ===== */
.jobrank-view-controls {
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    margin-bottom: 12px;
}
.view-toggle-btn {
    background: #f4f5f9;
    color: #555;
    border: 1px solid #e1e4ee;
    border-radius: 10px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.view-toggle-btn:hover { background: #e9ecf3; }
.view-toggle-btn.active {
    background: #3C3744;
    color: #fff;
    border-color: #3C3744;
}

/* ===== 캐러셀 컨테이너 + 화살표 ===== */
.jobrank-carousel-container {
    position: relative;
}
.carousel-arrow {
    display: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(60,55,68,0.88);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0,0,0,0.18);
    transition: background 0.15s, transform 0.15s;
}
.carousel-arrow:hover {
    background: #3C3744;
    transform: translateY(-50%) scale(1.06);
}
.carousel-arrow-prev { left: 12px; }
.carousel-arrow-next { right: 12px; }

.jobrank-page-indicator {
    display: none;
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    font-weight: 700;
    color: #555;
    letter-spacing: 0.5px;
}
.page-ind-current.editable {
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 8px;
    background: #f0f2f7;
    color: #3C3744;
    transition: background 0.15s;
}
.page-ind-current.editable:hover,
.page-ind-current.editable:active {
    background: #e1e5ee;
}
.page-ind-input {
    width: 3em;
    padding: 2px 8px;
    font: inherit;
    font-weight: 700;
    color: #3C3744;
    text-align: center;
    border: 1px solid #3C3744;
    border-radius: 8px;
    background: #fff;
    outline: none;
}
.page-ind-input::-webkit-outer-spin-button,
.page-ind-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}
.page-ind-input {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* ===== 그리드 (기본: 3컬럼) ===== */
.jobrank-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

/* 클론 카드는 캐러셀 모드에서만 표시 */
.jobrank-card.carousel-clone { display: none; }

/* ===== 캐러셀 모드 ===== */
.jobrank-view-wrap.is-carousel .jobrank-carousel-container {
    overflow: hidden;
}
.jobrank-view-wrap.is-carousel .carousel-clone { display: flex; }
.jobrank-view-wrap.is-carousel .jobrank-grid {
    display: flex;
    gap: 28px;
    grid-template-columns: none;
    transition: transform 0.4s ease;
    will-change: transform;
}
.jobrank-view-wrap.is-carousel .jobrank-card {
    flex-shrink: 0;
    width: 750px;
    max-width: calc(100% - 100px);
    opacity: 0.35;
    transform: scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease, box-shadow 0.2s, border-color 0.2s;
    cursor: pointer;
}
.jobrank-view-wrap.is-carousel .jobrank-card.is-current {
    opacity: 1;
    transform: scale(1);
    cursor: default;
}
/* 캐러셀 모드 hover — peek 카드는 살짝 진해짐, 현재 카드는 그대로 */
.jobrank-view-wrap.is-carousel .jobrank-card:hover {
    transform: scale(0.95);
    opacity: 0.65;
}
.jobrank-view-wrap.is-carousel .jobrank-card.is-current,
.jobrank-view-wrap.is-carousel .jobrank-card.is-current:hover {
    transform: scale(1);
    opacity: 1;
}
.jobrank-view-wrap.is-carousel .carousel-arrow { display: flex; align-items: center; justify-content: center; }
.jobrank-view-wrap.is-carousel .jobrank-page-indicator { display: block; }

/* ===== 카드 ===== */
.jobrank-card {
    position: relative;
    background: #fff;
    border: 2px solid #e6e8ef;
    border-radius: 14px;
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}
.jobrank-card:hover {
    transform: translateY(-4px);
    border-color: #3C3744;
    box-shadow: 0 10px 24px rgba(60,55,68,0.14);
}

/* 메달 강조 - 1/2/3위 */
.jobrank-card.rank-gold   { border-color: #f1b500; box-shadow: 0 4px 14px rgba(241,181,0,0.18); }
.jobrank-card.rank-silver { border-color: #a8b1c2; box-shadow: 0 4px 14px rgba(168,177,194,0.18); }
.jobrank-card.rank-bronze { border-color: #c98a52; box-shadow: 0 4px 14px rgba(201,138,82,0.18); }
.jobrank-card.rank-gold:hover   { box-shadow: 0 12px 28px rgba(241,181,0,0.28); }
.jobrank-card.rank-silver:hover { box-shadow: 0 12px 28px rgba(168,177,194,0.30); }
.jobrank-card.rank-bronze:hover { box-shadow: 0 12px 28px rgba(201,138,82,0.28); }

/* 랭크 뱃지 */
.jobrank-rank {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    background: rgba(60,55,68,0.85);
    color: #fff;
    font-weight: 800;
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 14px;
    letter-spacing: 0.3px;
}
.jobrank-card.rank-gold   .jobrank-rank { background: linear-gradient(135deg, #ffd95a, #f1b500); color: #5a3d00; }
.jobrank-card.rank-silver .jobrank-rank { background: linear-gradient(135deg, #dbe1ec, #a8b1c2); color: #2d3340; }
.jobrank-card.rank-bronze .jobrank-rank { background: linear-gradient(135deg, #e6b387, #c98a52); color: #4d2c10; }

/* 비주얼(차트 + 일러스트) 영역 */
.jobrank-visual {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 10px;
}

/* 차트 사이드 */
.jobrank-chart-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    background: #fff;
    border-radius: 12px;
    padding: 6px;
    gap: 6px;
}
.jobrank-donut-wrap {
    position: relative;
    width: 70%;
    aspect-ratio: 1 / 1;
    flex-shrink: 0;
}
.jobrank-donut {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(#eee 0% 100%);
    transition: background 0.3s ease;
    position: relative;
}
.jobrank-donut::after {
    content: '';
    position: absolute;
    inset: 26%;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(60,55,68,0.05) inset;
}
.jobrank-donut-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2;
    pointer-events: none;
}
.jobrank-donut-center-label {
    font-size: 9px;
    color: #999;
    font-weight: 600;
}
.jobrank-donut-center-pct {
    font-size: 12px;
    font-weight: 800;
    color: #3C3744;
    margin-top: 1px;
}

/* 도넛 호버 툴팁 */
.jobrank-donut-tooltip {
    position: absolute;
    background: rgba(60,55,68,0.92);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 5px 9px;
    border-radius: 6px;
    pointer-events: none;
    white-space: nowrap;
    z-index: 20;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* 일러스트 영역 */
.jobrank-illust-wrap {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #ffffff;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}
.jobrank-illust {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center center;
    transition: opacity 0.25s ease, filter 0.25s ease, transform 0.4s ease;
    opacity: 0.55;
    filter: grayscale(40%) saturate(70%);
    display: block;
}
.jobrank-card:hover .jobrank-illust {
    opacity: 1;
    filter: grayscale(0%) saturate(110%);
    transform: scale(1.04);
}
.jobrank-view-wrap.is-carousel .jobrank-card.is-current .jobrank-illust {
    opacity: 1;
    filter: grayscale(0%) saturate(110%);
}
.jobrank-illust-fallback {
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
    color: #b4bccc;
    background: linear-gradient(135deg, #B4C5E4 0%, #3C3744 100%);
    color: rgba(255,255,255,0.5);
}

/* 카드 본문 */
.jobrank-body {
    padding: 2px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.jobrank-name {
    font-size: 15px;
    font-weight: 700;
    color: #2C2C2C;
    line-height: 1.3;
}
.jobrank-archetype {
    font-size: 10px;
    font-weight: 600;
    color: #8a93a8;
    margin-bottom: 3px;
}
.jobrank-count {
    font-size: 16px;
    font-weight: 800;
    color: #3C3744;
    margin-top: 2px;
}
.jobrank-bar {
    height: 5px;
    background: #eef0f5;
    border-radius: 99px;
    overflow: hidden;
    margin-top: 6px;
}
.jobrank-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #B4C5E4, #3C3744);
    border-radius: 99px;
    transition: width 0.4s ease;
}
.jobrank-card.rank-gold   .jobrank-bar-fill { background: linear-gradient(90deg, #ffd95a, #f1b500); }
.jobrank-card.rank-silver .jobrank-bar-fill { background: linear-gradient(90deg, #dbe1ec, #a8b1c2); }
.jobrank-card.rank-bronze .jobrank-bar-fill { background: linear-gradient(90deg, #e6b387, #c98a52); }
.jobrank-pct {
    font-size: 10px;
    color: #888;
    text-align: right;
}

/* ===== name-row: 이름/아키타입(좌) + 통계(우) ===== */
.jobrank-name-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 4px;
}
.jobrank-name-col {
    flex: 1;
    min-width: 0;
}

/* ===== 통계 섹션 (name-row 우측, 캐러셀 모드에서만 표시) ===== */
.jobrank-stats {
    display: none;
}
.jobrank-view-wrap.is-carousel .jobrank-stats {
    display: flex;
    flex-direction: column;
    gap: 3px;
    align-items: flex-end;
    flex-shrink: 0;
}
.jobrank-stats-row {
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: center;
}
.jobrank-stat {
    display: flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}
.jobrank-stat-label {
    font-size: 11px;
    font-weight: 600;
    color: #bbbfc9;
}
.jobrank-stat-value {
    font-size: 12px;
    font-weight: 800;
    color: #3C3744;
}
.stat-sub {
    font-size: 11px;
    font-weight: 600;
}
.stat-up   { color: #e53935; }
.stat-down { color: #1e88e5; }
.stat-same { color: #c0c4ce; }

/* ===== 반응형 ===== */
@media (max-width: 1024px) {
    .jobrank-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
    .jobrank-view-wrap.is-carousel .jobrank-card { width: 600px; }
}

/* ===== 모바일 (≤720px) — 1개씩 전체폭 ===== */
@media (max-width: 720px) {
    /* 안전망: 페이지 가로 스크롤 차단 */
    html, body { overflow-x: hidden; }
    .jobrank-container {
        padding: 22px 12px 60px;
        max-width: 100vw;
        overflow-x: hidden;
    }
    .jobrank-carousel-container { overflow: hidden; }

    .jobrank-header h1 { font-size: 22px; }
    .jobrank-sub { font-size: 13px; }
    .jobrank-meta { font-size: 12px; line-height: 1.6; }

    /* 그리드 모드 (참고용 — 모바일은 JS로 캐러셀 강제) */
    .jobrank-grid { grid-template-columns: 1fr; gap: 12px; }

    /* 뷰 토글 버튼 숨김 */
    .jobrank-view-controls { display: none; }

    /* 모바일 캐러셀 — 브라우저 네이티브 scroll-snap (transform 사용 안함, 드리프트 0) */
    .jobrank-view-wrap.is-carousel .jobrank-carousel-container {
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        scrollbar-width: none;
        -ms-overflow-style: none;
        -webkit-overflow-scrolling: touch;
    }
    .jobrank-view-wrap.is-carousel .jobrank-carousel-container::-webkit-scrollbar {
        display: none;
    }
    .jobrank-view-wrap.is-carousel .jobrank-grid {
        transform: none !important;
        transition: none !important;
        gap: 0 !important;
        will-change: auto !important;
    }
    .jobrank-view-wrap.is-carousel .jobrank-card {
        box-sizing: border-box !important;
        flex: 0 0 100% !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        opacity: 1 !important;
        transform: none !important;
        scroll-snap-align: center;
        scroll-snap-stop: always;
    }

    /* 화살표 — 모바일에서는 페이지 인디케이터 옆으로 이동 (JS가 .jobrank-nav-bar 생성) */
    .jobrank-nav-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        margin-top: 18px;
        padding: 0 12px;
    }
    .jobrank-nav-bar .jobrank-page-indicator {
        margin: 0;
        flex: 1;
        text-align: center;
    }
    .jobrank-nav-bar .carousel-arrow {
        position: static !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        transform: none !important;
        width: 38px;
        height: 38px;
        font-size: 20px;
        flex-shrink: 0;
    }
    .jobrank-nav-bar .carousel-arrow:hover {
        transform: scale(1.08) !important;
    }
    /* 카드 영역의 화살표는 모바일에서 숨김 (nav-bar로 옮긴 후 안전망) */
    .jobrank-carousel-container > .carousel-arrow { display: none; }

    /* 카드 내부 — 비주얼 1열 (차트만, 일러스트는 숨김) */
    .jobrank-rank { font-size: 11px; padding: 3px 8px; }
    .jobrank-visual {
        padding: 10px;
        gap: 8px;
        grid-template-columns: 1fr 1fr;
    }
    .jobrank-chart-side {
        aspect-ratio: unset !important;
        height: 140px;
    }
    .jobrank-illust-wrap {
        aspect-ratio: unset !important;
        height: 140px;
    }
    .jobrank-donut-wrap { width: 85%; max-width: 120px; }

    .jobrank-body { padding: 4px 14px 14px; }
    .jobrank-name { font-size: 15px; }
    .jobrank-count { font-size: 17px; }
    .jobrank-archetype { font-size: 11px; }
    .jobrank-pct { font-size: 10px; }
    .jobrank-donut-center-label { font-size: 9px; }
    .jobrank-donut-center-pct { font-size: 13px; }

    /* 통계 — 한 줄로 나란히 */
    .jobrank-stats-row { gap: 8px; }
    .jobrank-stat-label { font-size: 10px; }
    .jobrank-stat-value { font-size: 11px; }

    /* 모바일에서는 이미지 항상 선명하게 */
    .jobrank-illust {
        opacity: 0.85;
        filter: grayscale(10%) saturate(90%);
    }
    .jobrank-view-wrap.is-carousel .jobrank-card.is-current .jobrank-illust {
        opacity: 1;
        filter: none;
    }
}
@media (max-width: 400px) {
    .jobrank-visual { gap: 6px; padding: 8px; }
    .jobrank-chart-side { height: 120px; }
    .jobrank-illust-wrap { height: 120px; }
    .jobrank-donut-wrap { max-width: 100px; }
    .jobrank-name { font-size: 14px; }
    .jobrank-count { font-size: 15px; }
}
