/**
 * Custom Store Credits & Gift Cards - Frontend Styles
 */

/* Amount Selector */
.wc-scgc-gift-card-form,
.wc-scgc-store-credit-form {
    margin-bottom: 20px;
}

.wc-scgc-amount-selector {
    margin-bottom: 25px;
}

.wc-scgc-amount-selector label {
    display: block;
    font-weight: 600;
    margin-bottom: 12px;
    font-size: 15px;
    color: #333;
}

.wc-scgc-preset-amounts {
    display: flex;
    flex-wrap: wrap;
    /* Grid layout */
    gap: 12px;
    width: 100%;
}

/* Amount Selector Radio Styles */
.wc-scgc-amount-option {
    position: relative;
    display: inline-block;
    cursor: pointer;
    flex: 1 0 30%;
    /* 3 per row approx */
    min-width: 100px;
    max-width: 100%;
}

.wc-scgc-amount-radio {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.wc-scgc-amount-btn {
    display: block;
    width: 100%;
    /* Force full width */
    text-align: center;
    /* Center text */
    padding: 14px 10px;
    border: 2px solid #e0e0e0;
    background: #fff;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
    color: #333;
}

.wc-scgc-amount-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.wc-scgc-amount-option:hover .wc-scgc-amount-btn {
    border-color: var(--wc-scgc-primary, #0073aa);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.2);
}

.wc-scgc-amount-btn:hover::before {
    left: 100%;
}

.wc-scgc-amount-radio:checked+.wc-scgc-amount-btn {
    border-color: var(--wc-scgc-primary, #0073aa);
    background: var(--wc-scgc-primary, #0073aa);
    color: #fff;
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 115, 170, 0.3);
}

.wc-scgc-amount-radio:focus+.wc-scgc-amount-btn {
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.3);
}

/* Custom Amount */
.wc-scgc-custom-amount {
    margin-bottom: 20px;
}

.wc-scgc-custom-amount label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
}

.wc-scgc-custom-input-wrap {
    display: flex;
    align-items: center;
    max-width: 200px;
}

.wc-scgc-currency {
    padding: 10px 15px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-right: none;
    border-radius: 4px 0 0 4px;
}

.wc-scgc-custom-input-wrap input {
    flex: 1;
    border-radius: 0 4px 4px 0;
}

.wc-scgc-range {
    font-weight: normal;
    font-size: 12px;
    color: #666;
}

/* Template Gallery */
.wc-scgc-templates {
    margin-bottom: 25px;
}

.wc-scgc-templates label {
    display: block;
    font-weight: 600;
    margin-bottom: 12px;
    font-size: 15px;
    color: #333;
}

.wc-scgc-template-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    /* Responsive grid */
    gap: 15px;
    width: 100%;
}

.wc-scgc-template-option {
    cursor: pointer;
    position: relative;
    display: block;
    /* Ensure it behaves as a block */
}

.wc-scgc-template-option input {
    display: none;
}

.wc-scgc-template-option img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border: 3px solid #e0e0e0;
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.wc-scgc-template-option:hover img {
    border-color: var(--wc-scgc-primary, #0073aa);
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(0, 115, 170, 0.2);
}

.wc-scgc-template-option input:checked+img {
    border-color: var(--wc-scgc-primary, #0073aa);
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
    transform: scale(1.05);
}

.wc-scgc-template-option input:checked+img::after {
    content: '✓';
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--wc-scgc-primary, #0073aa);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Recipient Section */
.wc-scgc-recipient-section {
    margin-bottom: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 4px;
}

.wc-scgc-recipient-toggle label {
    cursor: pointer;
    font-weight: 600;
}

.wc-scgc-recipient-fields {
    margin-top: 15px;
}

.wc-scgc-recipient-fields .form-row {
    margin-bottom: 10px;
}

.wc-scgc-recipient-fields label {
    display: block;
    margin-bottom: 5px;
}

.wc-scgc-recipient-fields input,
.wc-scgc-recipient-fields textarea {
    width: 100%;
}

/* Preview */
.wc-scgc-preview-section {
    margin-top: 15px;
}

.wc-scgc-preview-modal {
    max-width: 500px;
    margin: 0 auto;
}

.wc-scgc-preview-image {
    position: relative;
    min-height: 300px;
    background-size: cover;
    background-position: center;
    border-radius: 10px;
    overflow: hidden;
}

.wc-scgc-default-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.wc-scgc-preview-overlay {
    padding: 30px;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.wc-scgc-preview-amount {
    font-size: 48px;
    font-weight: 700;
    margin: 20px 0;
}

.wc-scgc-preview-message {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

/* Force coupon container to wrap and display flex */
.coupon {
    display: flex !important;
    flex-wrap: wrap !important;
}

.wc-scgc-cart-form {
    padding: 20px;
    background: #fdfdfd;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-top: 20px;
    margin-bottom: 20px;
    display: block !important;
    width: 100% !important;
    clear: both !important;
    flex: 0 0 100% !important;
    /* Force flex break if parent is flex */
    order: 100;
    /* Ensure it stays after coupon inputs */
    box-sizing: border-box;
}

.wc-scgc-cart-form h4 {
    margin: 0 0 15px;
}

.wc-scgc-code-form {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.wc-scgc-code-form input {
    flex: 1;
}

.wc-scgc-applied-code-notice,
.wc-scgc-applied-credit-notice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    background: #e8f5e9;
    border-radius: 4px;
    margin-bottom: 10px;
}

.wc-scgc-balance-info {
    margin-bottom: 10px;
    font-weight: 600;
}

.wc-scgc-apply-credit-form {
    display: flex;
    gap: 10px;
}

.wc-scgc-apply-credit-form input {
    flex: 1;
    max-width: 150px;
}

.wc-scgc-message {
    padding: 10px;
    border-radius: 4px;
    margin-top: 10px;
}

.wc-scgc-message.success {
    background: #e8f5e9;
    color: #2e7d32;
}

.wc-scgc-message.error {
    background: #ffebee;
    color: #c62828;
}

/* My Account */
.wc-scgc-my-account {
    max-width: 100%;
}

.wc-scgc-balance-box {
    text-align: center;
    padding: 40px;
    background: linear-gradient(135deg, var(--wc-scgc-gradient-start, #667eea) 0%, var(--wc-scgc-gradient-end, #764ba2) 100%);
    color: #fff;
    border-radius: 16px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.wc-scgc-balance-box::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: pulse 15s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

.wc-scgc-balance-box h3 {
    margin: 0 0 15px;
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.95;
    position: relative;
    z-index: 1;
}

.wc-scgc-balance-amount {
    font-size: 48px;
    font-weight: 700;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.wc-scgc-gift-cards-section,
.wc-scgc-history-section {
    margin-bottom: 30px;
}

.wc-scgc-gift-cards-section h3,
.wc-scgc-history-section h3 {
    margin-bottom: 15px;
}

.wc-scgc-status {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 12px;
    text-transform: uppercase;
}

.wc-scgc-status.status-active {
    background: #e8f5e9;
    color: #2e7d32;
}

.wc-scgc-status.status-pending,
.wc-scgc-status.status-sent {
    background: #fff3e0;
    color: #ef6c00;
}

.wc-scgc-status.status-used {
    background: #e3f2fd;
    color: #1565c0;
}

.wc-scgc-status.status-expired,
.wc-scgc-status.status-cancelled {
    background: #ffebee;
    color: #c62828;
}

.wc-scgc-history-table .positive {
    color: #2e7d32;
}

.wc-scgc-history-table .negative {
    color: #c62828;
}

/* RTL Support */
[dir="rtl"] .wc-scgc-currency {
    border-right: 1px solid #ddd;
    border-left: none;
    border-radius: 0 4px 4px 0;
}

[dir="rtl"] .wc-scgc-custom-input-wrap input {
    border-radius: 4px 0 0 4px;
}

/* Responsive */
@media (max-width: 600px) {
    .wc-scgc-preset-amounts {
        flex-direction: column;
    }

    .wc-scgc-amount-btn {
        width: 100%;
        text-align: center;
    }

    .wc-scgc-template-gallery {
        justify-content: center;
    }

    .wc-scgc-code-form,
    .wc-scgc-apply-credit-form {
        flex-direction: column;
    }

    .wc-scgc-apply-credit-form input {
        max-width: 100%;
    }
}