/**
 * 토스페이먼츠 공통 스타일
 *
 * 상품 페이지, 장바구니, 마이페이지 등에서 사용
 *
 * @package Terra_TossPay
 */

/* =============================================================================
   테마 색상 오버라이드 (토스 디자인 시스템)
   ============================================================================= */
:root {
    /* Elementor 전역 색상 */
    --e-global-color-primary: #191F28 !important;
    --e-global-color-secondary: #191F28 !important;
    --e-global-color-text: #333D4B !important;
    --e-global-color-accent: #191F28 !important;
    /* WordPress 색상 */
    --wp--preset--color--primary: #191F28 !important;
    --wp--preset--color--secondary: #191F28 !important;
    --wp--preset--color--vivid-red: #191F28 !important;
    --wp--preset--color--luminous-vivid-orange: #191F28 !important;
    /* Hello Elementor 테마 색상 */
    --hello-elementor-color: #191F28 !important;
}

/* =============================================================================
   Hello Elementor 테마 기본 분홍색(#c36) 오버라이드 → 검은색
   (Elementor에서 수정 시 덮어씌워짐)
   ============================================================================= */
/* 모든 링크 색상 - 테마 기본값보다 높은 우선순위 */
html body a,
html body a:link,
html body a:visited {
    color: #191F28;
}

html body a:hover,
html body a:active,
html body a:focus {
    color: #4E5968;
}

/* 버튼 색상 (테마 기본) */
html body button:not(.woocommerce button):not([class*="elementor"]),
html body [type="button"]:not(.woocommerce [type="button"]),
html body [type="submit"]:not(.woocommerce [type="submit"]) {
    border-color: #191F28;
    color: #191F28;
}

html body button:not(.woocommerce button):not([class*="elementor"]):hover,
html body button:not(.woocommerce button):not([class*="elementor"]):focus,
html body [type="button"]:not(.woocommerce [type="button"]):hover,
html body [type="submit"]:not(.woocommerce [type="submit"]):hover {
    background-color: #191F28;
    color: #fff;
}

/* 사이트 헤더 - 사이트명, 메뉴 */
html body .site-header a,
html body .site-branding a,
html body .site-title a,
html body .main-navigation a,
html body .menu-item a,
html body header a,
html body nav a {
    color: #191F28;
}

html body .site-header a:hover,
html body .main-navigation a:hover,
html body .menu-item a:hover,
html body header a:hover,
html body nav a:hover {
    color: #4E5968;
}

/* WooCommerce 카테고리, 태그 링크 */
html body .woocommerce .posted_in a,
html body .woocommerce .tagged_as a,
html body .woocommerce-product-details__short-description a,
html body .product_meta a,
html body .woocommerce-breadcrumb a {
    color: #191F28;
}

html body .woocommerce .posted_in a:hover,
html body .woocommerce .tagged_as a:hover,
html body .product_meta a:hover,
html body .woocommerce-breadcrumb a:hover {
    color: #4E5968;
}

/* 상품평 링크 */
html body .woocommerce-review-link,
html body .woocommerce-Reviews-title a,
html body .woocommerce-review__author {
    color: #191F28;
}

/* 푸터 링크 */
html body .site-footer a,
html body footer a {
    color: #191F28;
}

html body .site-footer a:hover,
html body footer a:hover {
    color: #4E5968;
}

/* =============================================================================
   Hello Elementor 테마 전역 색상 오버라이드 (WooCommerce 콘텐츠 영역만)
   ============================================================================= */
/* WooCommerce 콘텐츠 내 일반 링크만 (버튼, 네비게이션 제외) */
body.woocommerce-page .woocommerce-MyAccount-content a:not(.button):not(.checkout-button),
body.woocommerce-cart .woocommerce a:not(.button):not(.checkout-button),
body.woocommerce-checkout .woocommerce a:not(.button):not(.checkout-button) {
    color: #191F28 !important;
}

body.woocommerce-page .woocommerce-MyAccount-content a:not(.button):not(.checkout-button):hover,
body.woocommerce-cart .woocommerce a:not(.button):not(.checkout-button):hover,
body.woocommerce-checkout .woocommerce a:not(.button):not(.checkout-button):hover {
    color: #4E5968 !important;
}

/* 버튼 링크는 반드시 흰색 글자 */
.woocommerce a.button,
.woocommerce a.button.alt,
.woocommerce-account .woocommerce a.button,
.woocommerce-account .button,
.woocommerce-account a.button {
    color: #fff !important;
}

.woocommerce a.button:hover,
.woocommerce a.button.alt:hover,
.woocommerce-account .woocommerce a.button:hover,
.woocommerce-account .button:hover,
.woocommerce-account a.button:hover {
    color: #fff !important;
}

/* WooCommerce 영역 내 버튼만 (엘리멘터 등 외부 버튼 제외) */
body.woocommerce-page .woocommerce button,
body.woocommerce-page .woocommerce input[type="submit"],
body.woocommerce-cart .woocommerce button,
body.woocommerce-cart .woocommerce input[type="submit"],
body.woocommerce-checkout .woocommerce button,
body.woocommerce-checkout .woocommerce input[type="submit"],
body.woocommerce-account .woocommerce button,
body.woocommerce-account .woocommerce input[type="submit"] {
    background-color: #0064FF !important;
    border-color: #0064FF !important;
    color: #fff !important;
}

body.woocommerce-page .woocommerce button:hover,
body.woocommerce-page .woocommerce input[type="submit"]:hover,
body.woocommerce-cart .woocommerce button:hover,
body.woocommerce-cart .woocommerce input[type="submit"]:hover,
body.woocommerce-checkout .woocommerce button:hover,
body.woocommerce-checkout .woocommerce input[type="submit"]:hover,
body.woocommerce-account .woocommerce button:hover,
body.woocommerce-account .woocommerce input[type="submit"]:hover {
    background-color: #0050CC !important;
    border-color: #0050CC !important;
    color: #fff !important;
}

/* WooCommerce 버튼 (모든 상황) */
.woocommerce a.button,
.woocommerce a.button.alt,
.woocommerce button.button,
.woocommerce button.button.alt,
.woocommerce input.button,
.woocommerce input.button.alt,
.woocommerce #respond input#submit,
.woocommerce #respond input#submit.alt,
.woocommerce .cart .button,
.woocommerce .checkout-button,
.woocommerce a.checkout-button,
.wc-proceed-to-checkout a.checkout-button,
.woocommerce #place_order,
.woocommerce-cart .wc-proceed-to-checkout a.checkout-button,
.woocommerce-page a.button,
.woocommerce-page button.button,
.woocommerce-page input.button {
    background-color: #0064FF !important;
    background: linear-gradient(135deg, #0064FF 0%, #0050CC 100%) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 8px !important;
}

.woocommerce a.button:hover,
.woocommerce a.button.alt:hover,
.woocommerce button.button:hover,
.woocommerce button.button.alt:hover,
.woocommerce input.button:hover,
.woocommerce input.button.alt:hover,
.woocommerce #respond input#submit:hover,
.woocommerce .cart .button:hover,
.woocommerce .checkout-button:hover,
.woocommerce a.checkout-button:hover,
.wc-proceed-to-checkout a.checkout-button:hover,
.woocommerce #place_order:hover,
.woocommerce-cart .wc-proceed-to-checkout a.checkout-button:hover,
.woocommerce-page a.button:hover,
.woocommerce-page button.button:hover,
.woocommerce-page input.button:hover {
    background-color: #0050CC !important;
    background: linear-gradient(135deg, #0050CC 0%, #003d99 100%) !important;
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 100, 255, 0.3) !important;
}

/* WooCommerce 가격 색상 (장바구니, 체크아웃) */
.woocommerce-cart .price,
.woocommerce-cart .amount,
.woocommerce-checkout .price,
.woocommerce-checkout .amount {
    color: #191F28 !important;
    font-size: 15px !important;
}

/* 연관 상품, 상품 목록 가격 - 통일된 스타일 */
.woocommerce .related .price,
.woocommerce .upsells .price,
.woocommerce .cross-sells .price,
.woocommerce ul.products .price,
.wc-block-grid .wc-block-grid__product-price {
    font-size: 0.875em;
    font-weight: 700;
    color: #191F28 !important;
}

/* 금액 부분만 굵게 */
.woocommerce .related .price .woocommerce-Price-amount,
.woocommerce .upsells .price .woocommerce-Price-amount,
.woocommerce .cross-sells .price .woocommerce-Price-amount,
.woocommerce ul.products .price .woocommerce-Price-amount,
.wc-block-grid .wc-block-grid__product-price .woocommerce-Price-amount {
    font-weight: 700;
    color: #0064FF !important;
}

/* 월, 연, 첫결제 등 단위/라벨 글자 - 연한색 통일 */
.woocommerce ul.products .price small,
.woocommerce .related .price small,
.tosspay-price-dual small,
.tosspay-price-single small,
.tosspay-recurring-price small,
.tosspay-initial-price strong,
.tosspay-recurring-price small {
    font-weight: 400 !important;
    color: #8B95A1 !important;
}

/* 기존 스타일 유지용 */
.woocommerce .related .amount,
.woocommerce .upsells .amount,
.woocommerce .cross-sells .amount,
.woocommerce ul.products .amount,
.wc-block-grid .wc-block-grid__product-price {
    color: #191F28 !important;
}



/* =============================================================================
   결제 컨테이너
   ============================================================================= */
#tosspay-payment-container,
#tosspay-billing-container {
    text-align: center;
    padding: 30px;
    background: #f9f9f9;
    border-radius: 8px;
    margin: 20px 0;
}

#tosspay-billing-container h3 {
    margin-bottom: 10px;
}

#tosspay-billing-container p {
    color: #666;
    margin-bottom: 20px;
}

#tosspay-billing-button {
    background: #0064ff;
    color: #fff;
    border: none;
    padding: 12px 30px;
    font-size: 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

#tosspay-billing-button:hover {
    background: #0050cc;
}

/* =============================================================================
   바로구매 버튼
   ============================================================================= */
.wp-block-woocommerce-add-to-cart-form form.cart:has(.tosspay-buy-now-button) {
    grid-template-columns: min-content max-content max-content;
}

.wp-block-woocommerce-add-to-cart-form form.cart > .tosspay-buy-now-button {
    grid-column: 3 / 4;
    grid-row: 1;
    justify-self: start;
}

.tosspay-buy-now-button.wp-element-button {
    background-color: #0064ff !important;
    color: #fff !important;
    cursor: pointer;
    transition: background-color 0.2s;
}

.tosspay-buy-now-button.wp-element-button:hover {
    background-color: #0050cc !important;
    color: #fff !important;
}

/* 바로구매 버튼 (연관상품/목록) */
.wc-block-product .tosspay-buy-now-loop.wp-element-button {
    background-color: #0064ff !important;
    color: #fff !important;
    text-decoration: none !important;
    display: flex;
    justify-content: center;
    align-items: center;
    width: fit-content;
    margin: 0 auto;
    padding: 0.6rem 1.5rem;
    font-size: var(--wp--preset--font-size--small, 0.875rem);
    border-radius: 4px;
}

.wc-block-product .tosspay-buy-now-loop.wp-element-button:hover {
    background-color: #0050cc !important;
    color: #fff !important;
}

/* =============================================================================
   구독 정보 표시
   ============================================================================= */
.tosspay-subscription-info {
    background: #f0f7ff;
    border: 1px solid #cce0ff;
    border-radius: 6px;
    padding: 15px;
    margin: 15px 0;
}

.tosspay-subscription-info p {
    margin: 5px 0;
}

.tosspay-subscription-info .subscription-period {
    font-size: 16px;
}

.tosspay-subscription-info .subscription-trial {
    color: #0064ff;
    font-size: 14px;
}



/* =============================================================================
   로딩 상태
   ============================================================================= */
.tosspay-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0064ff;
    border-radius: 50%;
    animation: tosspay-spin 1s linear infinite;
}

@keyframes tosspay-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


/* =============================================================================
   상품 페이지 수량 입력
   ============================================================================= */
.woocommerce div.product form.cart .quantity,
.woocommerce .quantity {
    display: inline-flex;
    align-items: center;
    border: 1px solid #e5e8eb;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    height: 48px;
}

.woocommerce div.product form.cart .quantity .qty,
.woocommerce .quantity .qty {
    width: 44px;
    height: 100%;
    text-align: center;
    font-size: 15px;
    font-weight: 500;
    border: none;
    background: transparent;
    color: #191F28;
    -moz-appearance: textfield;
    appearance: textfield;
    padding: 0;
    margin: 0;
}

.woocommerce div.product form.cart .quantity .qty::-webkit-outer-spin-button,
.woocommerce div.product form.cart .quantity .qty::-webkit-inner-spin-button,
.woocommerce .quantity .qty::-webkit-outer-spin-button,
.woocommerce .quantity .qty::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

.woocommerce div.product form.cart .quantity .qty:focus,
.woocommerce .quantity .qty:focus {
    outline: none;
}

/* 수량 버튼 (+/-) */
.woocommerce .quantity button,
.woocommerce .quantity .minus,
.woocommerce .quantity .plus {
    width: 36px;
    height: 100%;
    background: #f8f9fa !important;
    border: none !important;
    color: #4E5968 !important;
    font-size: 16px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1;
}

.woocommerce .quantity button:hover,
.woocommerce .quantity .minus:hover,
.woocommerce .quantity .plus:hover {
    background: #e5e8eb !important;
    color: #191F28 !important;
}

.woocommerce .quantity .minus {
    border-right: 1px solid #e5e8eb !important;
}

.woocommerce .quantity .plus {
    border-left: 1px solid #e5e8eb !important;
}


/* =============================================================================
   상품평 별점 (노란색)
   ============================================================================= */
.woocommerce .star-rating,
.woocommerce .star-rating span,
.woocommerce p.stars a,
.woocommerce .woocommerce-product-rating .star-rating,
.comment-form-rating .stars a {
    color: #FFB800 !important;
}

/* 별점 before/after 색상 */
.woocommerce .star-rating::before,
.woocommerce .star-rating span::before {
    color: #FFB800 !important;
}

/* 빈 별 (배경) */
.woocommerce .star-rating::before {
    color: #e0e0e0 !important;
}

/* 채워진 별 */
.woocommerce .star-rating span::before {
    color: #FFB800 !important;
}

/* 리뷰 작성 시 별 선택 */
.woocommerce p.stars a::before,
.woocommerce p.stars a:hover ~ a::before,
.woocommerce p.stars.selected a.active ~ a::before {
    color: #e0e0e0 !important;
}

.woocommerce p.stars:hover a::before,
.woocommerce p.stars.selected a.active::before,
.woocommerce p.stars.selected a:not(.active)::before {
    color: #FFB800 !important;
}

/* =============================================================================
   Responsive
   ============================================================================= */
@media (max-width: 768px) {
    .subscription-action {
        display: block;
        margin: 5px 0;
        width: 100%;
    }

    .woocommerce div.product form.cart .quantity,
    .woocommerce .quantity {
        height: 42px;
    }

    .woocommerce div.product form.cart .quantity .qty,
    .woocommerce .quantity .qty {
        width: 36px;
        font-size: 14px;
    }

    .woocommerce .quantity button,
    .woocommerce .quantity .minus,
    .woocommerce .quantity .plus {
        width: 32px;
        font-size: 14px;
    }

}

/* =============================================================================
   취소선 가격 전역 스타일 (통일)
   ============================================================================= */
del,
del .woocommerce-Price-amount,
del .woocommerce-Price-amount bdi,
.tosspay-col-del del,
.tosspay-ob-price del,
.tosspay-sm-discount del,
.tosspay-sm-right del,
.price del {
    color: #9CA3AF !important;
    text-decoration: line-through !important;
    text-decoration-thickness: 1px !important;
    text-decoration-color: #9CA3AF !important;
    vertical-align: middle !important;
}

/* 정기결제 행 간격 */
.tosspay-price-row--sub {
    margin-top: 12px !important;
    padding-top: 12px !important;
}

