/**
 * WooCommerce Custom Product Size Fields Styles
 */

.diggler-size-fields {
    margin: 0 0 30px 0;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #e0e0e047;
}

.diggler-size-fields__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.diggler-size-fields__title {
    margin: 0 !important;
    font-size: 1.2em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.diggler-size-fields__grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.diggler-size-field {
    flex: 0 0 calc(50% - 7.5px);
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
}

.diggler-size-field__label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.7em;
    line-height: 1.2em;
}

.diggler-size-field__input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
    transition: border-color 0.3s ease;
}

.diggler-size-field__input:focus {
    outline: none;
}

/* Roter Rahmen nur bei Benutzer-Interaktion mit Fehler */
.diggler-size-field__input:user-invalid {
    border-color: #e74c3c;
}

/* Fallback für ältere Browser: nur nach Submit-Versuch */
form.woocommerce-cart-form--submitted .diggler-size-field__input:invalid,
.diggler-size-field__input.error {
    border-color: #e74c3c;
}

/* Measuring Guide Link */
.diggler-measuring-guide-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    background: transparent;
    border: none;
    font-size: 0.85em;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: underline;
    text-underline-offset: 3px;
    margin-left: auto;
}

.diggler-measuring-guide-btn:hover {
    opacity: 0.7;
}

.diggler-measuring-guide-btn svg {
    width: 14px;
    height: 14px;
}

/* Standalone Size Guide (when measurements not active) */
.diggler-standalone-size-guide {
    margin: 12px 0 12px 0;
    text-align: right;
}

.diggler-standalone-size-guide .diggler-measuring-guide-btn {
    margin-left: 0;
}

/* Modal Styles */
.diggler-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
}

.diggler-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

.diggler-modal__content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: auto;
    max-width: 90%;
    max-height: 80vh;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.diggler-modal__close {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.diggler-modal__close:hover {
    background: #fff;
    transform: rotate(90deg);
}

.diggler-modal__close svg {
    width: 20px;
    height: 20px;
    color: #333;
}

.diggler-modal__body {
    width: auto;
    max-width: 90vw;
    max-height: 80vh;
    overflow: auto;
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 0;
}

.diggler-modal__body img {
    max-width: 100%;
    max-height: calc(80vh - 30px);
    width: auto;
    height: auto;
    display: block;
    border-radius: 8px;
    object-fit: contain;
}

.diggler-modal__body iframe {
    width: 85vw;
    height: 80vh;
    border: none;
    border-radius: 8px;
}

/* Prevent body scroll when modal is open */
body.diggler-modal-open {
    overflow: hidden;
}

/* Cart & Checkout */
.diggler-order-item-meta {
    margin: 5px 0;
    font-size: 0.9em;
    color: #666;
}

/* Responsive */
@media (max-width: 768px) {
    .diggler-size-fields {
        padding: 20px 15px;
    }
    
    .diggler-size-fields__header {
        flex-direction: row;
        align-items: center;
    }
    
    .diggler-size-fields__title {
        font-size: 1.1em;
    }
    
    .diggler-measuring-guide-btn {
        font-size: 0.75em;
    }
    
    .diggler-size-field {
        flex: 0 0 100%;
    }
    
    .diggler-modal__content {
        width: 95%;
        max-width: 95%;
        max-height: 85vh;
        border-radius: 8px;
    }
    
    .diggler-modal__body {
        padding: 10px;
        max-height: 85vh;
    }
    
    .diggler-modal__body img {
        max-height: calc(85vh - 20px);
    }
    
    .diggler-modal__body iframe {
        height: 70vh;
    }
    
    .diggler-modal__close {
        width: 36px;
        height: 36px;
        top: 10px;
        right: 10px;
    }
}
