/**
 * HILTES Voucher Product Frontend Styles
 */

.hiltes-voucher-amount-selector {
    margin: 20px 0;
    padding: 20px;
    border: 1px solid #e1e1e1;
    border-radius: 6px;
    background: #f9f9f9;
    font-family: inherit;
}

.hiltes-voucher-amount-selector h4 {
    margin: 0 0 15px 0;
    font-size: 1.1em;
    font-weight: 600;
    color: #333;
}

.voucher-predefined-amounts {
    margin-bottom: 20px;
}

.voucher-predefined-amounts label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.voucher-predefined-amounts select {
    width: 100%;
    max-width: 300px;
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 4px;
    background: white;
    transition: border-color 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
    padding-right: 40px;
}

.voucher-predefined-amounts select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 1px #007cba;
}

.voucher-custom-amount {
    margin-bottom: 20px;
    padding-top: 15px;
    border-top: 1px solid #e1e1e1;
}

.voucher-custom-amount label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.voucher-custom-amount input[type="number"] {
    width: 100%;
    max-width: 200px;
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 4px;
    background: white;
    transition: border-color 0.3s ease;
}

.voucher-custom-amount input[type="number"]:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 1px #007cba;
}

.voucher-amount-help {
    display: block;
    margin-top: 5px;
    font-size: 0.85em;
    color: #666;
    font-style: italic;
}

.voucher-amount-display {
    margin-top: 15px;
    padding: 15px;
    background: #fff;
    border: 1px solid #007cba;
    border-radius: 4px;
    text-align: center;
}

.voucher-amount-display strong {
    color: #007cba;
    font-size: 1.1em;
}

#selected-amount-display {
    color: #007cba;
    font-weight: 700;
    font-size: 1.2em;
}

/* Error styling */
.woocommerce-error {
    margin-bottom: 15px;
}

/* Disabled add to cart button styling */
.single_add_to_cart_button.disabled,
.single_add_to_cart_button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Responsive design */
@media (max-width: 768px) {
    .hiltes-voucher-amount-selector {
        margin: 15px 0;
        padding: 15px;
    }
    
    .voucher-predefined-amounts select,
    .voucher-custom-amount input[type="number"] {
        max-width: 100%;
    }
    
    .hiltes-voucher-amount-selector h4 {
        font-size: 1em;
    }
}

@media (max-width: 480px) {
    .hiltes-voucher-amount-selector {
        padding: 12px;
    }
    
    .voucher-predefined-amounts select,
    .voucher-custom-amount input[type="number"] {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* Integration with common WooCommerce themes */

/* Storefront theme compatibility */
.storefront .hiltes-voucher-amount-selector {
    border-color: rgba(0,0,0,0.1);
    background: rgba(0,0,0,0.02);
}

.storefront .voucher-predefined-amounts select:focus,
.storefront .voucher-custom-amount input[type="number"]:focus {
    border-color: #96588a;
    box-shadow: 0 0 0 1px #96588a;
}

.storefront .voucher-amount-display {
    border-color: #96588a;
}

.storefront .voucher-amount-display strong,
.storefront #selected-amount-display {
    color: #96588a;
}

/* Astra theme compatibility */
.astra-theme .hiltes-voucher-amount-selector h4 {
    font-family: inherit;
}

.astra-theme .voucher-predefined-amounts select,
.astra-theme .voucher-custom-amount input[type="number"] {
    font-family: inherit;
}

/* Twentytwentyone theme compatibility */
.wp-theme-twentytwentyone .hiltes-voucher-amount-selector {
    font-family: inherit;
}

/* Custom theme integration for Bricks */
.bricks-theme .hiltes-voucher-amount-selector,
.bricks .hiltes-voucher-amount-selector {
    font-family: inherit;
    border-radius: 3px;
}

.bricks-theme .voucher-predefined-amounts select,
.bricks .voucher-predefined-amounts select,
.bricks-theme .voucher-custom-amount input[type="number"],
.bricks .voucher-custom-amount input[type="number"] {
    border-radius: 3px;
    font-family: inherit;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .hiltes-voucher-amount-selector {
        border-color: #000;
        background: #fff;
    }
    
    .voucher-predefined-amounts select,
    .voucher-custom-amount input[type="number"] {
        border-color: #000;
    }
    
    .voucher-amount-display {
        border-color: #000;
        background: #fff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .voucher-predefined-amounts select,
    .voucher-custom-amount input[type="number"] {
        transition: none;
    }
}

/* Voucher Graphics Selector */
.hiltes-voucher-graphic-selector {
    margin: 20px 0;
    padding: 20px;
    border: 1px solid #e1e1e1;
    border-radius: 6px;
    background: #f9f9f9;
    font-family: inherit;
}

.hiltes-voucher-graphic-selector h4 {
    margin: 0 0 15px 0;
    font-size: 1.1em;
    font-weight: 600;
    color: #333;
}

.voucher-graphic-options {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 10px;
}

.voucher-graphic-options .graphic-option {
    flex: 1;
    min-width: 150px;
    max-width: 200px;
    text-align: center;
}

.voucher-graphic-options .graphic-option label {
    display: block;
    cursor: pointer;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    background: white;
    transition: all 0.3s ease;
    position: relative;
    min-height: 120px;
}

.voucher-graphic-options .graphic-option label:hover {
    border-color: #007cba;
    box-shadow: 0 2px 8px rgba(0,124,186,0.2);
    transform: translateY(-2px);
}

.voucher-graphic-options .graphic-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    top: 10px;
    right: 10px;
}

.voucher-graphic-options .graphic-option input[type="radio"]:checked ~ label {
    border-color: #007cba;
    background: #f0f8ff;
}

.voucher-graphic-options .graphic-option input[type="radio"]:checked ~ label .graphic-name {
    color: #007cba;
    font-weight: bold;
}

.voucher-graphic-options .graphic-option label::after {
    content: '';
    position: absolute;
    top: 10px;
    right: 10px;
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 50%;
    background: white;
    transition: all 0.3s ease;
}

.voucher-graphic-options .graphic-option input[type="radio"]:checked ~ label::after {
    border-color: #007cba;
    background: #007cba;
    box-shadow: inset 0 0 0 3px white;
}

.voucher-graphic-options .graphic-preview {
    display: block;
    width: 100%;
    max-width: 120px;
    height: auto;
    margin: 0 auto 10px;
    border-radius: 4px;
    border: 1px solid #eee;
    transition: transform 0.3s ease;
}

.voucher-graphic-options .graphic-option:hover .graphic-preview {
    transform: scale(1.05);
}

.voucher-graphic-options .graphic-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 120px;
    height: 80px;
    margin: 0 auto 10px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #666;
    font-size: 12px;
    text-align: center;
}

.voucher-graphic-options .graphic-name {
    display: block;
    font-size: 14px;
    color: #333;
    margin-top: 5px;
    line-height: 1.3;
    font-weight: 500;
}

/* Theme compatibility for graphics */
.bricks-theme .hiltes-voucher-graphic-selector,
.bricks .hiltes-voucher-graphic-selector {
    font-family: inherit;
    border-radius: 3px;
}

.storefront .voucher-graphic-options .graphic-option input[type="radio"]:checked ~ label {
    border-color: #96588a;
    background: #faf5f9;
}

.storefront .voucher-graphic-options .graphic-option input[type="radio"]:checked ~ label::after {
    border-color: #96588a;
    background: #96588a;
}

.storefront .voucher-graphic-options .graphic-option label:hover {
    border-color: #96588a;
    box-shadow: 0 2px 8px rgba(150,88,138,0.2);
}

/* Responsive design for graphics */
@media (max-width: 768px) {
    .voucher-graphic-options {
        flex-direction: column;
        gap: 10px;
    }
    
    .voucher-graphic-options .graphic-option {
        max-width: none;
    }
    
    .voucher-graphic-options .graphic-option label {
        display: flex;
        align-items: center;
        text-align: left;
        padding: 15px;
        min-height: auto;
    }
    
    .voucher-graphic-options .graphic-preview {
        width: 80px;
        margin: 0 15px 0 0;
        flex-shrink: 0;
    }
    
    .voucher-graphic-options .graphic-placeholder {
        width: 80px;
        height: 60px;
        margin: 0 15px 0 0;
        flex-shrink: 0;
    }
    
    .voucher-graphic-options .graphic-name {
        margin-top: 0;
        flex: 1;
        text-align: left;
    }
    
    .voucher-graphic-options .graphic-option label::after {
        position: static;
        margin-left: auto;
        flex-shrink: 0;
    }
}

@media (max-width: 480px) {
    .hiltes-voucher-graphic-selector {
        padding: 15px;
    }
    
    .voucher-graphic-options .graphic-option label {
        padding: 12px;
    }
    
    .voucher-graphic-options .graphic-preview {
        width: 60px;
        margin-right: 12px;
    }
    
    .voucher-graphic-options .graphic-placeholder {
        width: 60px;
        height: 45px;
        margin-right: 12px;
        font-size: 10px;
    }
}

/* High contrast mode for graphics */
@media (prefers-contrast: high) {
    .hiltes-voucher-graphic-selector {
        border-color: #000;
        background: #fff;
    }
    
    .voucher-graphic-options .graphic-option label {
        border-color: #000;
    }
    
    .voucher-graphic-options .graphic-option input[type="radio"]:checked ~ label {
        border-color: #000;
        background: #f0f0f0;
    }
    
    .voucher-graphic-options .graphic-option label::after {
        border-color: #000;
    }
    
    .voucher-graphic-options .graphic-option input[type="radio"]:checked ~ label::after {
        background: #000;
    }
}

/* Print styles */
@media print {
    .hiltes-voucher-amount-selector,
    .hiltes-voucher-graphic-selector {
        border: 1px solid #000;
        background: #fff;
        break-inside: avoid;
    }
    
    .voucher-graphic-options .graphic-option label {
        border: 1px solid #000;
        background: #fff;
    }
}