/**
 * KRAIT Gift Cards - Frontend Styles
 */

/* Hide default WooCommerce price on single gift card product page */
.single-product.product-type-gift_card .product-summary > .price,
.single-product.product-type-gift_card .summary > .price,
body.single-product .product.product-type-gift_card .price:not(.kgc-selected-price),
body.single-product .product-type-gift_card .woocommerce-Price-amount {
    display: none !important;
}

/* But show price in catalog/archive pages */
.woocommerce-loop-product__link .price,
.woocommerce ul.products li.product .price {
    display: block !important;
}

/* Hide incl. VAT for gift card products */
.single-product.product-type-gift_card .product-summary .woocommerce-Price-suffix,
.product-type-gift_card .woocommerce-Price-suffix,
body.single-product .kgc-product-form ~ .price::after {
    display: none !important;
}

/* ============================================
   Product Form - Clean Design
   ============================================ */

.kgc-product-form {
    margin: 20px 0;
}

.kgc-form {
    max-width: 100%;
}

/* Section */
.kgc-section {
    margin-bottom: 25px;
}

.kgc-section-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Amount Selection */
.kgc-amounts {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.kgc-amount-option {
    margin: 0;
    cursor: pointer;
}

.kgc-amount-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.kgc-amount-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 90px;
    padding: 14px 24px;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    color: #333;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

.kgc-amount-option input:checked + .kgc-amount-btn {
    background: #1a1a1a;
    border-color: #1a1a1a;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.kgc-amount-option:hover .kgc-amount-btn {
    border-color: #1a1a1a;
    transform: translateY(-2px);
}

.kgc-amount-btn--custom {
    min-width: 110px;
    font-size: 14px;
}

.kgc-custom-amount {
    margin-top: 15px;
}

.kgc-input-group {
    display: flex;
    align-items: center;
    max-width: 200px;
}

.kgc-input-prefix {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: #1a1a1a;
    border: 2px solid #1a1a1a;
    border-right: none;
    border-radius: 8px 0 0 8px;
    font-weight: 700;
    color: #fff;
    font-size: 16px;
}

.kgc-input-group .kgc-input {
    border-radius: 0 8px 8px 0;
    flex: 1;
    height: 48px;
    border: 2px solid #e0e0e0;
    border-left: none;
}

/* Delivery Options */
.kgc-delivery-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

@media (max-width: 480px) {
    .kgc-delivery-options {
        grid-template-columns: 1fr;
    }
}

.kgc-delivery-option {
    margin: 0;
    cursor: pointer;
}

.kgc-delivery-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.kgc-delivery-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 20px;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    text-align: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

.kgc-delivery-option input:checked + .kgc-delivery-btn {
    border-color: #1a1a1a;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.kgc-delivery-option:hover .kgc-delivery-btn {
    border-color: #1a1a1a;
    transform: translateY(-2px);
}

.kgc-delivery-icon {
    font-size: 32px;
    margin-bottom: 10px;
}

.kgc-delivery-title {
    font-weight: 700;
    font-size: 15px;
    color: #1a1a1a;
    margin-bottom: 4px;
}

.kgc-delivery-desc {
    font-size: 12px;
    color: #888;
}

/* Form Inputs */
.kgc-field {
    margin-bottom: 20px;
}

.kgc-field:last-child {
    margin-bottom: 0;
}

.kgc-field-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
}

.kgc-field-label .required {
    color: #dc3545;
}

.kgc-field-label .optional {
    font-weight: 400;
    color: #999;
    font-size: 12px;
}

.kgc-input,
.kgc-textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.2s ease;
    background: #fff;
}

.kgc-input:focus,
.kgc-textarea:focus {
    outline: none;
    border-color: #1a1a1a;
    box-shadow: 0 0 0 3px rgba(26,26,26,0.1);
}

.kgc-input::placeholder,
.kgc-textarea::placeholder {
    color: #aaa;
}

.kgc-textarea {
    resize: vertical;
    min-height: 100px;
}

/* Two column layout for name fields */
.kgc-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

@media (max-width: 480px) {
    .kgc-field-row {
        grid-template-columns: 1fr;
    }
}

/* Submit Button - Very Specific Selectors to Override Theme */
.kgc-submit {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid #e0e0e0;
}

.kgc-submit-btn,
.kgc-product-form .kgc-submit-btn,
.kgc-form .kgc-submit-btn,
button.kgc-submit-btn,
button.kgc-submit-btn.button,
button.kgc-submit-btn.button.alt,
.woocommerce button.kgc-submit-btn,
.woocommerce .kgc-submit-btn,
body .kgc-submit-btn,
body button.kgc-submit-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    width: 100% !important;
    padding: 18px 32px !important;
    background: #1a1a1a !important;
    background-color: #1a1a1a !important;
    border: none !important;
    border-radius: 8px !important;
    color: #fff !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
}

.kgc-submit-btn:hover,
.kgc-product-form .kgc-submit-btn:hover,
.kgc-form .kgc-submit-btn:hover,
button.kgc-submit-btn:hover,
button.kgc-submit-btn.button:hover,
button.kgc-submit-btn.button.alt:hover,
.woocommerce button.kgc-submit-btn:hover,
.woocommerce .kgc-submit-btn:hover,
body .kgc-submit-btn:hover,
body button.kgc-submit-btn:hover {
    background: #333 !important;
    background-color: #333 !important;
    color: #fff !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(0,0,0,0.2) !important;
}

.kgc-submit-btn:active,
button.kgc-submit-btn:active {
    transform: translateY(0) !important;
}

.kgc-submit-price {
    font-weight: 400;
    opacity: 0.9;
    margin-left: 8px;
}

.kgc-submit-price::before {
    content: "- ";
}

.kgc-delivery-note {
    margin-top: 15px;
    text-align: center;
    font-size: 13px;
    color: #888;
}

.kgc-delivery-note span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Summary Box */
.kgc-summary {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    border: 1px solid #e0e0e0;
}

.kgc-summary-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    margin: 0 0 15px;
}

.kgc-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

.kgc-summary-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.kgc-summary-row.kgc-summary-total {
    font-weight: 700;
    font-size: 18px;
    padding-top: 15px;
    margin-top: 10px;
    border-top: 2px solid #1a1a1a;
    border-bottom: none;
}

/* ============================================
   Balance Check Page
   ============================================ */

.kgc-balance-check {
    max-width: 600px;
    margin: 0 auto;
    padding: 40px 20px;
}

.kgc-balance-form-wrapper {
    background: #fff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.kgc-balance-title {
    margin: 0 0 30px;
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    color: #1a1a1a;
}

.kgc-balance-input-group {
    display: flex;
    gap: 10px;
}

@media (max-width: 480px) {
    .kgc-balance-input-group {
        flex-direction: column;
    }
}

.kgc-balance-input {
    flex: 1;
    padding: 16px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.kgc-balance-input:focus {
    outline: none;
    border-color: #1a1a1a;
}

.kgc-balance-submit {
    padding: 16px 32px;
    background: #1a1a1a !important;
    border: none !important;
    border-radius: 8px;
    color: #fff !important;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.kgc-balance-submit:hover {
    background: #333 !important;
    color: #fff !important;
}

/* Balance Result */
.kgc-balance-result {
    margin-top: 30px;
}

.kgc-balance-card {
    background: #fafafa;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

.kgc-balance-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px;
    background: #1a1a1a;
    color: #fff;
}

.kgc-balance-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #28a745;
    border-radius: 50%;
    font-size: 16px;
}

.kgc-balance-code {
    font-family: 'Courier New', monospace;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 2px;
}

.kgc-balance-info {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: #e0e0e0;
}

@media (max-width: 480px) {
    .kgc-balance-info {
        grid-template-columns: 1fr;
    }
}

.kgc-balance-amount,
.kgc-balance-status,
.kgc-balance-expires {
    padding: 24px 20px;
    background: #fff;
    text-align: center;
}

.kgc-balance-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #999;
    margin-bottom: 10px;
}

.kgc-balance-value {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a1a;
}

.kgc-balance-status-value {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    text-transform: capitalize;
}

.kgc-status--active {
    background: #d4edda;
    color: #155724;
}

.kgc-status--used {
    background: #e2e3e5;
    color: #383d41;
}

.kgc-status--expired {
    background: #f8d7da;
    color: #721c24;
}

.kgc-status--pending {
    background: #fff3cd;
    color: #856404;
}

.kgc-balance-expires-value {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

/* Transactions */
.kgc-balance-transactions {
    padding: 20px;
    border-top: 1px solid #e0e0e0;
}

.kgc-balance-transactions h4 {
    margin: 0 0 15px;
    font-size: 14px;
    font-weight: 600;
    color: #666;
}

.kgc-transactions-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.kgc-transaction-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

.kgc-transaction-item:last-child {
    border-bottom: none;
}

.kgc-trans-amount {
    font-weight: 700;
    min-width: 80px;
}

.kgc-trans-amount.positive {
    color: #28a745;
}

.kgc-trans-amount.negative {
    color: #dc3545;
}

.kgc-trans-date {
    color: #666;
}

.kgc-trans-order {
    color: #999;
    font-size: 12px;
}

/* Balance Actions */
.kgc-balance-actions {
    padding: 20px;
    text-align: center;
    border-top: 1px solid #e0e0e0;
}

.kgc-balance-actions .button {
    background: #1a1a1a !important;
    color: #fff !important;
    border: none !important;
    padding: 14px 30px;
    font-weight: 600;
}

.kgc-balance-actions .button:hover {
    background: #333 !important;
}

/* Error */
.kgc-balance-error {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
    padding: 18px 24px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #991b1b;
}

.kgc-error-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: #dc3545;
    border-radius: 50%;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
}

/* Loading */
.kgc-balance-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
    padding: 20px;
    color: #666;
}

.kgc-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e0e0e0;
    border-top-color: #1a1a1a;
    border-radius: 50%;
    animation: kgc-spin 0.8s linear infinite;
}

@keyframes kgc-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   Order Thank You Page
   ============================================ */

.kgc-order-gift-cards {
    margin: 30px 0;
    padding: 30px;
    background: #fafafa;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
}

.kgc-order-gift-cards h2 {
    margin: 0 0 20px;
    font-size: 22px;
    font-weight: 700;
}

.kgc-order-card {
    background: #fff;
    padding: 24px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid #e0e0e0;
}

.kgc-order-card:last-of-type {
    margin-bottom: 0;
}

.kgc-order-card__code code {
    display: inline-block;
    padding: 10px 20px;
    background: #1a1a1a;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 2px;
    border-radius: 6px;
    margin-left: 10px;
}

.kgc-order-card__amount,
.kgc-order-card__recipient,
.kgc-order-card__expires {
    margin-top: 12px;
    font-size: 14px;
    color: #666;
}

.kgc-order-card__amount strong {
    color: #1a1a1a;
    font-size: 20px;
}

.kgc-order-note {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
    font-size: 14px;
    color: #666;
}

/* ============================================
   Cart Item Styling
   ============================================ */

.woocommerce-cart-form .kgc-cart-item-meta {
    margin-top: 10px;
    font-size: 13px;
}

.woocommerce-cart-form .kgc-cart-item-meta dt {
    font-weight: 600;
    color: #666;
}

.woocommerce-cart-form .kgc-cart-item-meta dd {
    margin: 0 0 5px;
    color: #333;
}
