/* Payment & Credit System Styles */

/* 상단 크레딧 표시 */
.credit-display {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-right: 10px;
}

.credit-items {
    display: flex;
    gap: 10px;
}

.credit-item {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 10px;
    border-radius: 15px;
    font-size: 14px;
    color: white;
}

.credit-icon {
    font-size: 16px;
}

.credit-count {
    font-weight: 600;
    color: #FFD700;
}

.recharge-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.recharge-btn:hover {
    background: #218838;
}

/* 크레딧 충전 모달 */
.credit-recharge-modal-content {
    max-width: 800px;
    width: 90%;
    height: auto;
    max-height: 90vh;
    overflow-y: auto;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    z-index: 1000;
}

/* PC에서 가로 레이아웃 */
@media (min-width: 768px) {
    .credit-recharge-modal-content {
        max-width: 1000px;
        width: 90%;
        height: auto;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    /* PC에서 크레딧 상태를 가로로 배치 */
    .credit-status-grid {
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }
    
    /* PC에서 구매 상품을 한 줄에 3개씩 */
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }
    
    /* PC에서 충전 모달 섹션들 단일 컬럼 */
    .credit-recharge-modal-content .modal-body {
        display: block;
        padding: 20px;
    }
    
    /* 섹션 간격 조정 */
    .usage-guide-section,
    .credit-status-section,
    .conversion-section,
    .purchase-section {
        margin-bottom: 25px;
    }
    
    /* 무제한 상품은 3칸 모두 차지 */
    .product-item[data-product="SPANNER_UNLIMITED"] {
        grid-column: span 3;
    }
    
    /* 정책 버튼들 PC에서 가로 정렬 */
    .policy-buttons {
        flex-direction: row;
        justify-content: center;
        align-items: center;
        padding: 25px;
        gap: 20px;
        width: 100%;
        max-width: none;
    }
    
    .policy-btn {
        flex: 1;
        max-width: 180px;
        min-width: 140px;
        padding: 12px 20px;
        font-size: 14px;
    }
}

.credit-status-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.credit-status-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 15px;
}

.credit-status-section .credit-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.credit-status-section .credit-icon {
    font-size: 24px;
}

.credit-info {
    flex: 1;
}

.credit-name {
    font-size: 14px;
    color: #666;
    margin-bottom: 4px;
}

.credit-status-section .credit-count {
    font-size: 20px;
    font-weight: 700;
    color: #007bff;
}

/* 변환 섹션 */
.conversion-section {
    background: #fff3cd;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid #ffeaa7;
}

.conversion-info {
    margin-top: 15px;
}

.conversion-info p {
    margin: 8px 0;
    color: #856404;
}

.conversion-info #spanner-from-hammers {
    font-weight: 600;
    color: #007bff;
}

/* 구매 섹션 */
.purchase-section {
    background: #d4edda;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid #c3e6cb;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.product-item {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
}

.product-item:hover {
    border-color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,123,255,0.15);
}

/* 무제한 상품 강조 */
.product-item[data-product="SPANNER_UNLIMITED"] {
    position: relative;
    border: 3px solid #ff4444;
    background: linear-gradient(135deg, #fff5f5 0%, #ffe0e0 100%);
    box-shadow: 0 4px 20px rgba(255, 68, 68, 0.15);
}

.product-item[data-product="SPANNER_UNLIMITED"]::before {
    content: "🔥 BEST VALUE";
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #ff4444, #ff6666);
    color: white;
    padding: 6px 20px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(255, 68, 68, 0.4);
    z-index: 1;
}

.product-item[data-product="SPANNER_UNLIMITED"] .product-info {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
}

.product-item[data-product="SPANNER_UNLIMITED"] .product-icon {
    font-size: 48px;
}

.product-item[data-product="SPANNER_UNLIMITED"] .product-price {
    font-size: 24px;
    color: #ff4444;
}

.product-item .product-icon {
    font-size: 32px;
    margin-bottom: 10px;
}

.product-name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.product-desc {
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
    line-height: 1.4;
}

.product-price {
    font-size: 18px;
    font-weight: 700;
    color: #007bff;
    margin-bottom: 15px;
}

.purchase-btn {
    width: 100%;
    padding: 10px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.purchase-btn:hover {
    background: #0056b3;
}

.purchase-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* 운영자 테스트 섹션 */
.admin-test-section {
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px dashed #6c757d;
    border-radius: 10px;
}

.test-product {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 2px solid #ffc107;
}

.test-product .product-icon {
    font-size: 28px;
}

.test-product .product-name {
    color: #856404;
    font-weight: 700;
}

.test-product .product-desc {
    color: #856404;
    font-weight: 500;
}

.test-product .product-price {
    color: #856404;
    font-weight: 700;
}

.btn-admin {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    color: #333;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
}

.btn-admin:hover {
    background: linear-gradient(135deg, #e0a800 0%, #f57c00 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 193, 7, 0.4);
}

/* 사용법 안내 */
.usage-guide-section {
    background: #d1ecf1;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #bee5eb;
}

/* 정책 버튼들 */
.policy-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    margin-top: 20px;
    width: 100%;
}

.policy-btn {
    padding: 8px 16px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    color: #666;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.policy-btn:hover {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

/* 정책 모달 */
.policy-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.policy-modal.visible {
    opacity: 1;
}

.policy-modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.policy-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
}

.policy-modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.policy-modal-close {
    font-size: 24px;
    color: #999;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.policy-modal-close:hover {
    background: #dee2e6;
    color: #333;
}

.policy-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.policy-section h4 {
    color: #1428A0;
    font-size: 16px;
    margin: 20px 0 10px;
    padding-bottom: 5px;
    border-bottom: 2px solid #e9ecef;
}

.policy-section h4:first-child {
    margin-top: 0;
}

.policy-section ul {
    margin: 10px 0;
    padding-left: 25px;
}

.policy-section li {
    margin: 8px 0;
    color: #666;
    line-height: 1.6;
}

.policy-section strong {
    color: #ff4444;
    font-weight: 600;
}

.policy-modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: center;
}

.policy-modal-footer .btn-primary {
    padding: 10px 30px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.policy-modal-footer .btn-primary:hover {
    background: #0056b3;
}

.usage-guide {
    margin-top: 15px;
}

.guide-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    color: #0c5460;
}

.guide-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.guide-text {
    font-size: 14px;
    line-height: 1.4;
}

/* Mobile Credit Section (below header) */
.mobile-credit-section {
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 10px 15px;
    display: none; /* 기본적으로 숨김, 모바일에서만 표시 */
}

.mobile-credit-display {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 15px;
}

.mobile-credit-display .credit-items {
    display: flex;
    gap: 10px;
}

.mobile-credit-display .credit-item {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(20, 40, 160, 0.1);
    padding: 6px 10px;
    border-radius: 15px;
    font-size: 14px;
    color: #1428A0;
}

.mobile-credit-display .credit-icon {
    font-size: 16px;
}

.mobile-credit-display .credit-count {
    font-weight: 600;
    color: #1428A0;
}

.mobile-credit-display .recharge-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.mobile-credit-display .recharge-btn:hover {
    background: #218838;
}

/* PC에서 헤더 크레딧 표시 유지 */
@media (min-width: 769px) {
    .mobile-credit-section {
        display: none !important;
    }
}

/* 모바일 대응 */
@media (max-width: 768px) {
    /* PC 헤더의 크레딧 표시 숨기기 */
    .credit-display {
        display: none !important;
    }
    
    /* 모바일 크레딧 섹션 숨김 (헤더로 이동) */
    .mobile-credit-section {
        display: none !important;
    }
    
    /* 헤더 버튼들 통일된 스타일 */
    .header-nav {
        display: flex;
        align-items: center;
        gap: 4px;
    }
    
    /* 모든 헤더 버튼 통일 */
    .header-nav .btn-primary,
    .header-nav .btn-secondary,
    .header-nav .recharge-btn {
        padding: 6px 10px !important;
        font-size: 12px !important;
        height: 32px;
        min-width: 60px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 6px;
    }
    
    /* 충전하기 버튼 */
    .recharge-btn {
        background: #28a745;
        color: white;
        border: none;
    }
    
    /* 로그아웃 버튼 색상 유지 */
    .header-nav .btn-secondary.logout {
        background: #EF4444 !important;
    }
    
    .credit-recharge-modal-content {
        width: 95%;
        max-width: 400px;
        left: 50% !important;
        top: 50% !important;
        transform: translate(-50%, -50%) !important;
        margin: 0;
    }
    
    .credit-status-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .product-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .product-item {
        padding: 15px;
    }
    
    /* 모바일에서 무제한 상품도 전체 너비 */
    .product-item[data-product="SPANNER_UNLIMITED"] {
        grid-column: span 1;
    }
    
    .product-item[data-product="SPANNER_UNLIMITED"] .product-info {
        flex-direction: column;
        gap: 10px;
    }
    
    /* 모바일에서 정책 버튼들 */
    .policy-buttons {
        flex-direction: column;
        padding: 15px;
    }
    
    .policy-btn {
        width: 100%;
        padding: 10px;
    }
    
    /* 모바일에서 정책 모달 */
    .policy-modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .policy-modal-header h3 {
        font-size: 16px;
    }
    
    .policy-section h4 {
        font-size: 14px;
    }
    
    .policy-section li {
        font-size: 13px;
    }
}

/* 서비스 준비중 팝업 스타일 */
.service-alert-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease-out;
}

.service-alert-modal {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    animation: slideUp 0.3s ease-out;
}

.service-alert-content {
    padding: 30px;
    text-align: center;
}

.service-alert-icon {
    font-size: 48px;
    margin-bottom: 20px;
    animation: bounce 0.6s ease-out;
}

.service-alert-title {
    font-size: 22px;
    font-weight: 700;
    color: #333;
    margin-bottom: 16px;
    line-height: 1.3;
}

.service-alert-message {
    font-size: 16px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 16px;
}

.service-alert-sub {
    font-size: 14px;
    color: #28a745;
    line-height: 1.5;
    margin-bottom: 24px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #28a745;
}

.service-alert-button {
    background: #007bff;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
}

.service-alert-button:hover {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.service-alert-button:active {
    transform: translateY(0);
}

/* 애니메이션 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* 모바일 대응 */
@media (max-width: 768px) {
    .service-alert-modal {
        width: 95%;
        max-width: 350px;
    }
    
    .service-alert-content {
        padding: 25px;
    }
    
    .service-alert-icon {
        font-size: 40px;
        margin-bottom: 16px;
    }
    
    .service-alert-title {
        font-size: 18px;
        margin-bottom: 14px;
    }
    
    .service-alert-message {
        font-size: 14px;
        margin-bottom: 14px;
    }
    
    .service-alert-sub {
        font-size: 13px;
        margin-bottom: 20px;
        padding: 10px;
    }
    
    .service-alert-button {
        padding: 10px 20px;
        font-size: 14px;
    }
}