/**
 * Dr. Moskyt Kalkulačka - Frontend CSS
 *
 * @package DrMoskyt_Calculator
 */

/* Hlavní kontejner kalkulačky */
.drmoskyt-calculator {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 25px;
    margin: 25px 0;
}

.drmoskyt-calculator h3 {
    margin: 0 0 20px 0;
    font-size: 20px;
    color: #333;
    border-bottom: 2px solid #333;
    padding-bottom: 10px;
}

/* Sekce formuláře */
.calculator-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.calculator-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.calculator-section h4 {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: #555;
}

/* Pole formuláře */
.calculator-field {
    margin-bottom: 15px;
    width: 100%;
}

.calculator-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.calculator-field .required {
    color: #dc3232;
    margin-left: 3px;
}

.calculator-input,
.calculator-select {
    width: 100%;
    /*max-width: 400px;*/
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    transition: border-color 0.3s ease;
}

.calculator-input:focus,
.calculator-select:focus {
    outline: none;
    border-color: #333;
}

.calculator-hint {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #666;
    font-style: italic;
}

/* Zobrazení plochy */
.calculator-area {
    margin-top: 15px;
    padding: 12px 15px;
    background: #fff;
    border-left: 3px solid #333;
    border-radius: 4px;
}

.calculator-area strong {
    display: inline-block;
    margin-right: 10px;
    color: #333;
}

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

/* Varování */
.calculator-warning {
    margin-top: 15px;
    padding: 12px 15px;
    background: #fff3cd;
    border-left: 3px solid #ffc107;
    border-radius: 4px;
}

.calculator-warning .warning-message {
    margin: 0;
    color: #856404;
    font-weight: 600;
}

/* Sekce s cenou */
.calculator-price-section {
    background: #fff;
    border: 2px solid #333;
    border-radius: 6px;
    padding: 20px;
}

.calculator-price-display {
    /*min-height: 80px;*/
}

/* Loading stav */
.price-loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.price-loading .spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #333;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

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

/* Výsledek ceny */
.price-result {
    text-align: center;
}

.price-amount {
    font-size: 3rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 20px;
}

.price-breakdown {
    text-align: left;
    border-top: 1px solid #e0e0e0;
    padding-top: 15px;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
}

.breakdown-label {
    color: #666;
}

.breakdown-value {
    font-weight: 600;
    color: #333;
}

/* Chybová hláška */
.price-error {
    text-align: center;
    padding: 20px;
}

.error-message {
    margin: 0;
    color: #dc3232;
    font-weight: 600;
}

/* Radio a checkbox styly s obrázky */
.calculator-radio-group,
.calculator-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 10px;
}

.calculator-radio-option,
.calculator-checkbox-option {
    flex: 0 1 calc(33.333% - 10px);
    min-width: 150px;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.calculator-radio-option:hover,
.calculator-checkbox-option:hover {
    border-color: #333;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.calculator-radio-option input[type="radio"],
.calculator-checkbox-option input[type="checkbox"] {
    /*margin: 0 0 10px 0;*/
}

.calculator-radio-option input[type="radio"]:checked + img,
.calculator-checkbox-option input[type="checkbox"]:checked + img {
    outline: 3px solid #333;
    outline-offset: 3px;
}

.calculator-radio-option img,
.calculator-checkbox-option img {
    max-width: 100%;
    height: auto;
    margin-bottom: 10px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.calculator-radio-option span,
.calculator-checkbox-option span {
    font-weight: 500;
    color: #333;
}

.calculator-radio-option input[type="radio"]:checked ~ span,
.calculator-checkbox-option input[type="checkbox"]:checked ~ span {
    font-weight: 700;
}

/* Fieldset styling */
fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

fieldset legend {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #333;
    padding: 0;
}

/* Animace pro změny ceny */
.price-amount,
.breakdown-value {
    transition: all 0.3s ease;
}

.price-amount.updating {
    opacity: 0.6;
    transform: scale(0.98);
}

/* Lepší visual feedback pro input fields */
.calculator-input:focus,
.calculator-select:focus {
    box-shadow: 0 0 0 3px rgba(51, 51, 51, 0.1);
}

.calculator-input.invalid,
.calculator-select.invalid {
    border-color: #dc3232;
}

.calculator-input.valid,
.calculator-select.valid {
    border-color: #46b450;
}

/* Vylepšená plocha sekce */
.calculator-area {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.area-value {
    padding: 5px 15px;
    background: #f0f0f0;
    border-radius: 20px;
}

/* Responzivní design */
@media (max-width: 768px) {
    .drmoskyt-calculator {
        padding: 15px;
    }

    .calculator-input,
    .calculator-select {
        max-width: 100%;
    }

    .price-amount {
        font-size: 24px;
    }

    .breakdown-item {
        font-size: 13px;
    }

    .calculator-radio-option,
    .calculator-checkbox-option {
        flex: 0 1 100%;
    }

    .calculator-radio-group,
    .calculator-checkbox-group {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .calculator-area {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .area-value {
        align-self: stretch;
        text-align: center;
    }
}

/* Skrytý JSON data element */
#drmoskyt-disabled-combinations,
#drmoskyt-attributes-data {
    display: none;
}

/* Tooltip styling */
.calculator-tooltip-icon {
    display: inline-block;
    margin-left: 8px;
    cursor: help;
    position: relative;
    vertical-align: middle;
    color: #666;
    transition: color 0.2s ease;
}

.calculator-tooltip-icon:hover {
    color: #333;
}

.calculator-tooltip-inline {
    margin-left: 4px;
}

.calculator-tooltip-icon svg {
    display: block;
}

/* JavaScript-based tooltip popup */
.calculator-tooltip-popup {
    position: absolute;
    padding: 8px 12px;
    background: #333;
    color: #fff;
    font-size: 13px;
    line-height: 1.4;
    font-weight: normal;
    border-radius: 6px;
    max-width: 300px;
    white-space: normal;
    z-index: 10000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
}

.calculator-tooltip-popup.visible {
    opacity: 1;
    visibility: visible;
}

/* Tooltip pro vybranou hodnotu v selectu */
.calculator-value-tooltip {
    margin-top: 8px;
    padding: 8px 12px;
    background: #f9f9f9;
    border-left: 3px solid #333;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.4;
    color: #555;
}

/* Boolean (True/False) checkbox styling */
.calculator-boolean-wrapper {
    margin-top: 10px;
}

.calculator-boolean-option {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fff;
}

.calculator-boolean-option:hover {
    border-color: #333;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.calculator-boolean-option input[type="checkbox"] {
    margin: 0 10px 0 0;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.calculator-boolean-label {
    font-weight: 500;
    color: #333;
    cursor: pointer;
}

.calculator-boolean-option input[type="checkbox"]:checked ~ .calculator-boolean-label {
    font-weight: 700;
}

/* Sekce přidání do košíku */
.calculator-add-to-cart-section {
    padding-top: 20px;
    border-top: 2px solid #333;
    margin-top: 20px;
}

.calculator-quantity-selector {
    margin-bottom: 15px;
}

.calculator-quantity-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

/* Tlačítko přidat do košíku */
.drmoskyt-add-to-cart {
    width: 100%;
    padding: 15px 30px;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    background: #333;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.drmoskyt-add-to-cart:hover:not(:disabled) {
    background: #000;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.drmoskyt-add-to-cart:disabled,
.drmoskyt-add-to-cart.disabled {
    background: #ccc;
    color: #999;
    cursor: not-allowed;
    opacity: 0.6;
}

.drmoskyt-add-to-cart.loading {
    position: relative;
    color: transparent;
}

.drmoskyt-add-to-cart.loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 3px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Validační zprávy */
.calculator-validation-messages {
    margin-top: 15px;
}

.calculator-validation-messages .woocommerce-error,
.calculator-validation-messages .woocommerce-message,
.calculator-validation-messages .woocommerce-info {
    padding: 12px 15px;
    margin: 0;
    border-radius: 4px;
    border-left: 4px solid;
}

.calculator-validation-messages .woocommerce-error {
    background: #fff3cd;
    border-left-color: #dc3232;
    color: #856404;
}

.calculator-validation-messages .woocommerce-message {
    background: #d4edda;
    border-left-color: #46b450;
    color: #155724;
}

.calculator-validation-messages .woocommerce-info {
    background: #d1ecf1;
    border-left-color: #00a0d2;
    color: #0c5460;
}
