/**
 * 일본 여행 쇼핑 안심 계산기 스타일
 * Version: 1.0.0
 */

/* ========== 기본 컨테이너 ========== */
.jp-calc-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans KR', sans-serif;
    max-width: 480px;
    margin: 0 auto;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.3);
}

.jp-calc-container * {
    box-sizing: border-box;
}

.jp-calc-title {
    text-align: center;
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.jp-calc-subtitle {
    text-align: center;
    color: rgba(255,255,255,0.9);
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.jp-calc-warning {
    text-align: center;
    color: #ff4444;
    font-size: 0.8rem;
    font-weight: 700;
    background: rgba(255,255,255,0.95);
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    line-height: 1.6;
    border: 2px solid #ff4444;
}

/* ========== 카드 스타일 ========== */
.jp-calc-card {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.jp-calc-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.jp-calc-card-title .icon {
    font-size: 1.3rem;
}

/* ========== 라디오 버튼 (교통수단) ========== */
.jp-transport-options {
    display: flex;
    gap: 12px;
}

.jp-transport-option {
    flex: 1;
    position: relative;
}

.jp-transport-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 2;
}

.jp-transport-option label {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 12px;
    border: 3px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafafa;
}

.jp-transport-option input[type="radio"]:checked + label {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
}

.jp-transport-option .transport-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.jp-transport-option .transport-name {
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

.jp-transport-option .transport-limit {
    font-size: 0.75rem;
    color: #888;
    margin-top: 4px;
}

/* ========== 입력 필드 ========== */
.jp-input-group {
    margin-bottom: 16px;
}

.jp-input-group:last-child {
    margin-bottom: 0;
}

.jp-input-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
}

.jp-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.jp-input-field {
    flex: 1;
}

.jp-input-field input[type="number"],
.jp-input-field select {
    width: 100%;
    padding: 14px 16px;
    font-size: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    background-color: #fff;
    color: #333 !important;
    transition: all 0.3s ease;
}

/* 주류 종류 라디오 버튼 스타일 */
.jp-liquor-type-options {
    display: flex;
    gap: 10px;
}

.jp-liquor-type-option {
    flex: 1;
    position: relative;
    cursor: pointer;
}

.jp-liquor-type-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 2;
}

.jp-liquor-type-label {
    display: block;
    padding: 12px 10px;
    background: #f5f5f5;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    transition: all 0.2s ease;
}

.jp-liquor-type-label small {
    display: block;
    font-size: 0.75rem;
    color: #888;
    font-weight: 500;
    margin-top: 2px;
}

.jp-liquor-type-option input[type="radio"]:checked + .jp-liquor-type-label {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: #fff;
}

.jp-liquor-type-option input[type="radio"]:checked + .jp-liquor-type-label small {
    color: rgba(255,255,255,0.8);
}

.jp-input-field input[type="number"]:focus,
.jp-input-field select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
}

.jp-input-field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.jp-input-unit {
    font-size: 0.9rem;
    color: #888;
    white-space: nowrap;
    min-width: 40px;
}

.jp-input-hint {
    font-size: 0.75rem;
    color: #999;
    margin-top: 6px;
}

/* ========== 주류 아이템 ========== */
.jp-liquor-items {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.jp-liquor-item {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px;
    border: 1px solid #e9ecef;
}

.jp-liquor-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.jp-liquor-item-title {
    font-weight: 600;
    color: #333;
}

.jp-remove-liquor {
    background: #ff6b6b;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
}

.jp-remove-liquor:hover {
    background: #ee5a5a;
    transform: scale(1.1);
}

.jp-add-liquor {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.jp-add-liquor:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* 주류 미입력 안내 */
.jp-liquor-placeholder {
    text-align: center;
    padding: 20px;
    color: #999;
    font-size: 0.9rem;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px dashed #e0e0e0;
}

/* ========== 계산 버튼 ========== */
.jp-calc-button {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: #fff;
    border: none;
    border-radius: 16px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(245, 87, 108, 0.4);
    margin-top: 8px;
}

/* ========== 일반 물품 아이템 ========== */
.jp-items-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.jp-item-placeholder {
    text-align: center;
    padding: 20px;
    color: #999;
    font-size: 0.9rem;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px dashed #e0e0e0;
}

.jp-selected-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.jp-selected-item-info {
    flex: 1;
}

.jp-selected-item-name {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.jp-selected-item-detail {
    font-size: 0.75rem;
    color: #888;
    margin-top: 4px;
}

.jp-selected-item-qty {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 12px;
}

.jp-qty-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: #667eea;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.jp-qty-btn:hover {
    background: #5a6fd6;
}

.jp-qty-value {
    font-weight: 700;
    min-width: 24px;
    text-align: center;
}

.jp-remove-item {
    background: #ff6b6b;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.jp-remove-item:hover {
    background: #ee5a5a;
}

.jp-add-item {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.jp-add-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* ========== 물품 선택 모달 ========== */
.jp-item-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    justify-content: center;
    align-items: flex-end;
}

.jp-item-modal.show {
    display: flex;
}

.jp-item-modal-content {
    background: #fff;
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    border-radius: 20px 20px 0 0;
    overflow: hidden;
    animation: slideUpModal 0.3s ease;
}

@keyframes slideUpModal {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.jp-item-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
}

.jp-modal-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.jp-item-categories {
    padding: 16px;
    overflow-y: auto;
    max-height: calc(80vh - 60px);
}

.jp-item-category {
    margin-bottom: 20px;
}

.jp-item-category-title {
    font-weight: 700;
    color: #333;
    font-size: 1rem;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid #667eea;
}

.jp-item-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.jp-item-btn {
    padding: 10px 14px;
    background: #f0f0f0;
    border: 2px solid transparent;
    border-radius: 20px;
    font-size: 0.85rem;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
}

.jp-item-btn:hover {
    background: #e8e8ff;
    border-color: #667eea;
}

.jp-item-btn:active {
    transform: scale(0.95);
}

/* 직접 입력 폼 */
.jp-custom-item-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.jp-custom-input {
    padding: 12px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    width: 100%;
}

.jp-custom-input:focus {
    outline: none;
    border-color: #667eea;
}

.jp-custom-row {
    display: flex;
    gap: 10px;
}

.jp-custom-row .jp-custom-input {
    flex: 1;
}

.jp-custom-add-btn {
    padding: 12px;
    background: #667eea;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
}

.jp-custom-add-btn:hover {
    background: #5a6fd6;
}

.jp-calc-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(245, 87, 108, 0.5);
}

.jp-calc-button:active {
    transform: translateY(-1px);
}

/* ========== 결과 영역 ========== */
.jp-result-container {
    display: none;
    margin-top: 20px;
}

.jp-result-container.show {
    display: block;
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.jp-result-card {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 12px;
}

.jp-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.jp-result-item:last-child {
    border-bottom: none;
}

.jp-result-label {
    color: #666;
    font-size: 0.95rem;
}

.jp-result-value {
    font-weight: 700;
    font-size: 1.1rem;
    color: #333;
}

.jp-result-value.tax-free {
    color: #10b981;
}

.jp-result-value.tax-due {
    color: #f59e0b;
}

/* ========== 메시지 박스 ========== */
.jp-message-box {
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 12px;
}

.jp-message-box.warning {
    background: linear-gradient(135deg, #fff5f5 0%, #fed7d7 100%);
    border: 2px solid #fc8181;
}

.jp-message-box.success {
    background: linear-gradient(135deg, #f0fff4 0%, #c6f6d5 100%);
    border: 2px solid #68d391;
}

.jp-message-box .message-icon {
    font-size: 2rem;
    margin-bottom: 12px;
}

.jp-message-box .message-title {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.jp-message-box.warning .message-title {
    color: #c53030;
}

.jp-message-box.success .message-title {
    color: #276749;
}

.jp-message-box .message-text {
    font-size: 0.95rem;
    line-height: 1.6;
}

.jp-message-box.warning .message-text {
    color: #742a2a;
}

.jp-message-box.success .message-text {
    color: #22543d;
}

/* ========== 예약 버튼 ========== */
.jp-cta-button {
    display: block;
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: #fff;
    text-decoration: none;
    text-align: center;
    border-radius: 16px;
    font-size: 1.1rem;
    font-weight: 700;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(56, 239, 125, 0.4);
}

.jp-cta-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(56, 239, 125, 0.5);
    color: #fff;
    text-decoration: none;
}

/* ========== 세부 내역 ========== */
.jp-detail-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 16px;
    margin-top: 16px;
}

.jp-detail-title {
    font-weight: 600;
    color: #555;
    font-size: 0.9rem;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.jp-detail-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 0.85rem;
    color: #666;
    border-bottom: 1px dashed #e0e0e0;
}

.jp-detail-item:last-child {
    border-bottom: none;
}

/* ========== 환율 토글 ========== */
.jp-exchange-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 12px;
    background: #f0f0f0;
    border-radius: 10px;
    margin-bottom: 12px;
}

.jp-exchange-toggle span {
    font-size: 0.9rem;
    color: #666;
}

.jp-exchange-settings {
    display: none;
    padding-top: 12px;
}

.jp-exchange-settings.show {
    display: block;
}

/* ========== Travelpayouts 환율 위젯 ========== */
.jp-exchange-widget-card {
    overflow: hidden;
}

.jp-exchange-widget-wrapper {
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9f9f9;
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 12px;
}

.jp-exchange-widget-wrapper iframe {
    max-width: 100% !important;
    border: none !important;
}

#tp-exchange-widget {
    width: 100%;
}

#tp-exchange-widget > div,
#tp-exchange-widget iframe {
    width: 100% !important;
    max-width: 100% !important;
}

/* 위젯 로딩 중 표시 */
.jp-exchange-widget-wrapper:empty::before {
    content: '환율 정보 로딩 중...';
    color: #999;
    font-size: 0.9rem;
}

/* ========== 반응형 ========== */
@media (max-width: 400px) {
    .jp-calc-container {
        padding: 16px;
        border-radius: 16px;
    }
    
    .jp-calc-title {
        font-size: 1.3rem;
    }
    
    .jp-input-field input[type="number"],
    .jp-input-field select {
        padding: 12px 14px;
        font-size: 1rem;
    }
    
    .jp-transport-option label {
        padding: 12px 8px;
    }
    
    .jp-transport-option .transport-icon {
        font-size: 1.6rem;
    }
    
    .jp-transport-option .transport-name {
        font-size: 0.85rem;
    }
}

/* ========== 실시간 환율 표시 ========== */
.jp-exchange-rate-display {
    background: linear-gradient(135deg, #f8f9ff 0%, #eef1ff 100%);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
}

.jp-exchange-rate-loading {
    text-align: center;
    color: #888;
    padding: 20px;
}

.jp-exchange-rate-error {
    text-align: center;
    color: #e74c3c;
    font-size: 0.85rem;
    padding: 10px;
}

.jp-exchange-rate-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(102, 126, 234, 0.1);
}

.jp-exchange-rate-item:last-child {
    border-bottom: none;
}

.jp-rate-flag {
    font-size: 1.5rem;
    margin-right: 10px;
}

.jp-rate-label {
    flex: 1;
    font-weight: 600;
    color: #333;
}

.jp-rate-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #667eea;
}

.jp-apply-rate-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 8px;
}

.jp-apply-rate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.jp-apply-rate-btn:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
