/* ================================
   큐브(잠재능력) 시스템 CSS
   MapleStory Black Cube 스타일
   ================================ */

/* 등급별 색상 변수 */
:root {
    --potential-normal: #888888;
    --potential-rare: #69c0ff;
    --potential-epic: #b37feb;
    --potential-unique: #ffd666;
    --potential-legendary: #52c41a;

    --potential-normal-glow: rgba(136, 136, 136, 0.5);
    --potential-rare-glow: rgba(105, 192, 255, 0.6);
    --potential-epic-glow: rgba(179, 127, 235, 0.6);
    --potential-unique-glow: rgba(255, 214, 102, 0.6);
    --potential-legendary-glow: rgba(82, 196, 26, 0.6);
}

/* 잠재능력 표시 섹션 (포켓몬 상세 모달 내) */
.potential-section {
    margin-top: 16px;
    padding: 16px;
    background: linear-gradient(145deg, #f0f4f8 0%, #e8eef5 100%);
    border-radius: 12px;
    border: 2px solid #9254de;
    box-shadow: 0 2px 8px rgba(146, 84, 222, 0.2);
}

.potential-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.potential-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
}

.potential-grade-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.potential-grade-badge.normal {
    background: var(--potential-normal);
    color: #fff;
}

.potential-grade-badge.rare {
    background: linear-gradient(135deg, #69c0ff, #40a9ff);
    color: #fff;
    box-shadow: 0 0 10px var(--potential-rare-glow);
}

.potential-grade-badge.epic {
    background: linear-gradient(135deg, #b37feb, #9254de);
    color: #fff;
    box-shadow: 0 0 10px var(--potential-epic-glow);
}

.potential-grade-badge.unique {
    background: linear-gradient(135deg, #ffd666, #ffc53d);
    color: #1a1a2e;
    box-shadow: 0 0 10px var(--potential-unique-glow);
}

.potential-grade-badge.legendary {
    background: linear-gradient(135deg, #52c41a, #389e0d);
    color: #fff;
    box-shadow: 0 0 10px var(--potential-legendary-glow);
}

.potential-options-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.potential-option-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #ffffff;
    border-radius: 6px;
    font-size: 13px;
    border: 1px solid #e0e0e0;
}

.potential-option-item .option-line-num {
    font-size: 11px;
    min-width: 28px;
    font-weight: 600;
}

.potential-option-item .option-text {
    font-weight: 600;
}

/* 등급별 색상 (가이드와 동일) - 1줄/2줄/3줄 + 옵션 텍스트, 기본 회색 제거해 여기서만 색 지정 */
.potential-option-item.option-grade-normal .option-line-num,
.potential-option-item.option-grade-normal .option-text {
    color: #888888 !important;
}

.potential-option-item.option-grade-rare .option-line-num,
.potential-option-item.option-grade-rare .option-text {
    color: #40a9ff !important;
}

.potential-option-item.option-grade-epic .option-line-num,
.potential-option-item.option-grade-epic .option-text {
    color: #9254de !important;
}

.potential-option-item.option-grade-unique .option-line-num,
.potential-option-item.option-grade-unique .option-text {
    color: #d48806 !important;
}

.potential-option-item.option-grade-legendary .option-line-num,
.potential-option-item.option-grade-legendary .option-text {
    color: #52c41a !important;
}

.potential-empty {
    color: #888;
    font-size: 13px;
    text-align: center;
    padding: 12px;
    background: #fff;
    border-radius: 6px;
}

.potential-section.potential-pending {
    border-color: #fa8c16;
    background: linear-gradient(145deg, #fff7e6 0%, #ffe7ba 100%);
}

.pending-indicator {
    background: #fa8c16;
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
    animation: pulse-pending 1.5s ease-in-out infinite;
}

@keyframes pulse-pending {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

.potential-pending-message {
    background: #fff;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    color: #d46b08;
    font-weight: 600;
    border: 2px dashed #fa8c16;
}

.potential-pending-message small {
    display: block;
    margin-top: 8px;
    color: #666;
}

.btn-cube {
    background: linear-gradient(135deg, #9254de, #722ed1);
    border: none;
    color: #fff;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(146, 84, 222, 0.4);
}

.btn-cube:hover {
    background: linear-gradient(135deg, #a366f0, #8339e3);
    box-shadow: 0 4px 12px rgba(146, 84, 222, 0.5);
    transform: translateY(-1px);
}

/* ================================
   큐브 비교 모달 (Black Cube Style)
   ================================ */
.cube-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.cube-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.cube-modal {
    background: linear-gradient(180deg, #1a1a2e 0%, #0d0d1a 100%);
    border: 2px solid rgba(179, 127, 235, 0.3);
    border-radius: 16px;
    padding: 24px;
    width: 90%;
    max-width: 600px;
    box-shadow:
        0 0 30px rgba(179, 127, 235, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.cube-modal-overlay.active .cube-modal {
    transform: scale(1);
}

.cube-modal-header {
    text-align: center;
    margin-bottom: 24px;
}

.cube-modal-header h2 {
    color: #fff;
    font-size: 20px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.cube-modal-header .pokemon-name {
    color: var(--potential-unique);
}

.cube-modal-header .gold-info {
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
}

.cube-modal-header .gold-info .gold-amount {
    color: #ffd666;
    font-weight: 600;
}

/* 비교 영역 */
.cube-compare-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 16px;
    align-items: stretch;
    margin-bottom: 24px;
}

.cube-compare-slot {
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.cube-compare-slot::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.cube-compare-slot.slot-before::before {
    background: linear-gradient(90deg, transparent, rgba(105, 192, 255, 0.5), transparent);
}

.cube-compare-slot.slot-after::before {
    background: linear-gradient(90deg, transparent, rgba(179, 127, 235, 0.5), transparent);
}

.cube-compare-slot.slot-after.hidden-result .cube-slot-options {
    filter: blur(10px);
    pointer-events: none;
}

.cube-compare-slot.slot-after.revealing {
    animation: cube-reveal 0.8s ease forwards;
}

@keyframes cube-reveal {
    0% {
        filter: blur(10px);
    }

    50% {
        filter: blur(5px);
        transform: scale(1.02);
    }

    100% {
        filter: blur(0);
        transform: scale(1);
    }
}

.cube-slot-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 10px;
}

.cube-slot-label.before {
    color: #69c0ff;
}

.cube-slot-label.after {
    color: #b37feb;
}

.cube-slot-grade {
    margin-bottom: 12px;
}

.cube-slot-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: filter 0.5s ease;
}

.cube-option-line {
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    font-size: 13px;
    text-align: left;
    font-weight: 600;
}

/* 큐브 모달 Before/After 옵션 등급별 색상 (가이드와 동일) */
.cube-option-line.option-grade-normal {
    color: #888888;
}
.cube-option-line.option-grade-rare {
    color: #40a9ff;
}
.cube-option-line.option-grade-epic {
    color: #9254de;
}
.cube-option-line.option-grade-unique {
    color: #ffc53d;
}
.cube-option-line.option-grade-legendary {
    color: #52c41a;
}

/* 비교 화살표 */
.cube-compare-arrow {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0 8px;
}

.cube-compare-arrow .arrow-icon {
    font-size: 24px;
    color: rgba(255, 255, 255, 0.3);
}

.cube-compare-arrow .grade-change {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    margin-top: 8px;
}

.cube-compare-arrow .grade-change.upgraded {
    background: rgba(82, 196, 26, 0.2);
    color: #52c41a;
}

.cube-compare-arrow .grade-change.same {
    color: rgba(255, 255, 255, 0.4);
}

/* 버튼 영역 */
.cube-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.cube-btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cube-btn.btn-reroll {
    background: linear-gradient(135deg, #722ed1, #531dab);
    color: #fff;
}

.cube-btn.btn-reroll:hover {
    box-shadow: 0 0 20px rgba(114, 46, 209, 0.5);
    transform: translateY(-2px);
}

.cube-btn.btn-reroll:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.cube-btn.btn-select-before {
    background: rgba(105, 192, 255, 0.1);
    border: 1px solid #69c0ff;
    color: #69c0ff;
}

.cube-btn.btn-select-before:hover {
    background: rgba(105, 192, 255, 0.2);
}

.cube-btn.btn-select-after {
    background: rgba(179, 127, 235, 0.1);
    border: 1px solid #b37feb;
    color: #b37feb;
}

.cube-btn.btn-select-after:hover {
    background: rgba(179, 127, 235, 0.2);
}

.cube-btn.btn-select-after:disabled,
.cube-btn.btn-select-before:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cube-btn.btn-close {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.7);
}

.cube-btn.btn-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* 확인 팝업 */
.cube-confirm-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(180deg, #2d2d4a 0%, #1a1a2e 100%);
    border: 2px solid rgba(255, 77, 79, 0.5);
    border-radius: 12px;
    padding: 24px;
    z-index: 10001;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 0 30px rgba(255, 77, 79, 0.3);
}

.cube-confirm-popup h3 {
    color: #ff4d4f;
    margin-bottom: 12px;
    font-size: 16px;
}

.cube-confirm-popup p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.cube-confirm-popup .popup-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* 애니메이션 */
@keyframes cube-rolling {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.cube-rolling-icon {
    animation: cube-rolling 1s linear infinite;
}

/* 반응형 */
@media (max-width: 600px) {
    .cube-modal-overlay {
        align-items: flex-start;
        padding: 10px;
        overflow-y: auto;
    }

    .cube-modal {
        max-height: none;
        overflow-y: visible;
        margin: 20px auto;
        padding: 20px 16px 24px;
    }

    .cube-compare-container {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .cube-compare-arrow {
        flex-direction: row;
        padding: 8px 0;
    }

    .cube-compare-arrow .arrow-icon {
        transform: rotate(90deg);
    }

    .cube-modal-actions {
        flex-direction: column;
        margin-top: 16px;
    }

    .cube-btn {
        width: 100%;
        justify-content: center;
    }
}