/* Modal Popup Styling - Compact & Professional */
.gemat-qo-popup {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.gemat-qo-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.gemat-qo-wrapper {
    position: relative;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    animation: gematQoSlideIn 0.3s ease-out;
}

@keyframes gematQoSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.gemat-qo-close {
    position: absolute;
    right: 12px;
    top: 12px;
    background: #f5f5f5;
    color: #666;
    border: 0;
    width: 28px;
    height: 28px;
    line-height: 1;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 300;
}

.gemat-qo-inner {
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.gemat-qo-product-info {
    padding-bottom: 16px;
    border-bottom: 1px solid #e8e8e8;
}

.gemat-qo-product-header {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    align-items: flex-start;
}

.gemat-qo-image {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    background: #f5f5f5;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.gemat-qo-image img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.gemat-qo-product-details {
    flex: 1;
    min-width: 0;
}

.gemat-qo-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 6px;
    line-height: 1.3;
    color: #1a1a1a;
}

.gemat-qo-price {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--fs-color-primary, #e63946);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.gemat-qo-price .old-price {
    color: #999;
    text-decoration: line-through;
    font-size: 13px;
    font-weight: 400;
}

.gemat-qo-price .current-price {
    font-size: 16px;
}

.gemat-qo-note {
    font-size: 12px;
    color: #e63946;
    line-height: 1.5;
    margin: 8px 0;
    font-weight: 500;
}

.gemat-qo-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.gemat-qo-row {
    margin-bottom: 0;
}

.gemat-qo-row label {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 500;
    color: #555;
}

.gemat-qo-row input[type="text"],
.gemat-qo-row input[type="email"],
.gemat-qo-row input[type="tel"],
.gemat-qo-row textarea,
.gemat-qo-row select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    color: #333;
}

.gemat-qo-row input[type="text"]:focus,
.gemat-qo-row input[type="email"]:focus,
.gemat-qo-row input[type="tel"]:focus,
.gemat-qo-row textarea:focus,
.gemat-qo-row select:focus {
    outline: none;
    border-color: var(--fs-color-primary, #17a2b8);
    box-shadow: 0 0 0 2px rgba(23, 162, 184, 0.1);
}

.gemat-qo-row textarea {
    min-height: 60px;
    resize: vertical;
    font-family: inherit;
}

.gemat-qo-quantity-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.gemat-qo-quantity-row label {
    font-size: 13px;
    font-weight: 500;
    color: #555;
    white-space: nowrap;
    margin-bottom: 0;
}

.gemat-qo-quantity-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
}

.gemat-qo-qty-btn {
    color: var(--fs-color-primary, #17a2b8);
    width: 30px;
    height: 30px;
    line-height: 1;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 550;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e0e0e0 !important;
    margin: 0 !important;
}

.gemat-qo-quantity-input {
    width: 60px !important;
    height: 38px !important;
    text-align: center;
    margin: 0 !important;
    appearance: textfield;
    -moz-appearance: textfield !important;
    font-weight: 600;
    font-size: 13px;
    border: 1px solid #e0e0e0 !important;
    border-radius: 8px !important;
}

.gemat-qo-quantity-input::-webkit-outer-spin-button,
.gemat-qo-quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

.gemat-qo-total {
    font-weight: 700;
    margin: 6px 0;
    font-size: 15px;
    color: var(--fs-color-primary, #e63946);
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 4px;
    text-align: center;
    border: 1px solid #e8e8e8;
}

.gemat-qo-total-amount {
    font-size: 17px;
    color: var(--fs-color-primary, #e63946);
}

.gemat-qo-actions {
    margin-top: 4px;
}

.gemat-qo-submit {
    background: var(--fs-color-primary, #17a2b8);
    color: #fff;
    border: 0;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(23, 162, 184, 0.3);
}

.gemat-qo-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.gemat-qo-result {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 4px;
    font-size: 13px;
}

.gemat-qo-processing {
    color: #0c5460;
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    padding: 8px 10px;
    border-radius: 4px;
    font-weight: 500;
}

/* Loading overlay */
.gemat-qo-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.gemat-qo-loading-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.8);
}

.gemat-qo-loading-box {
    position: relative;
    z-index: 1;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px 18px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 10px;
}

.gemat-qo-loading-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #e0f3f6;
    border-top-color: var(--fs-color-primary, #17a2b8);
    border-radius: 50%;
    animation: gematSpin 0.8s linear infinite;
}

.gemat-qo-loading-text {
    font-size: 14px;
    color: #0c5460;
    font-weight: 600;
}

@keyframes gematSpin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.gemat-qo-success {
    color: #155724;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    padding: 12px 14px;
    border-radius: 4px;
    font-weight: 500;
}

.gemat-qo-success h4 {
    margin: 0 0 12px !important;
    font-size: 16px !important;
    color: #155724 !important;
    font-weight: 600;
}

.gemat-qo-order-details {
    text-align: left;
    margin-top: 12px;
}

.gemat-qo-order-details p {
    margin: 6px 0;
    font-size: 13px;
    line-height: 1.5;
}

.gemat-qo-order-details strong {
    font-weight: 600;
    color: #155724;
    min-width: 100px;
    display: inline-block;
}

.gemat-qo-error {
    color: #721c24;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 8px 10px;
    border-radius: 4px;
    font-weight: 500;
}

/* Hide Add to Cart Button */
form.cart,
.woocommerce-variation-add-to-cart,
.single_add_to_cart_button,
.quantity {
    display: none !important;
}

/* Button Styles - Single Product Page */
.gemat-qo-single-wrapper {
    margin: 20px 0;
}

.gemat-qo-btn.gemat-qo-single {
    background: var(--fs-color-primary, #17a2b8);
    color: #fff;
    width: fit-content;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 8px 12px;

}

.gemat-qo-btn.gemat-qo-single:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.gemat-qo-btn-text {
    display: block;
    font-weight: 600;
    font-size: 1.2em;
    line-height: 2em;
}

.gemat-qo-btn-note {
    display: block;
    font-size: 13px;
    text-transform: none;
    font-weight: 400;
    line-height: 1.5em;
}

/* Loop Button Styles */
.gemat-qo-btn.gemat-qo-loop {
    background: var(--fs-color-primary, #17a2b8);
    color: #fff;
    border: 0;
    padding: 4px 8px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    margin: 0 1.2em 1em 1em;
    display: inline-block;
    width: calc(100% - 2.4em);
    text-align: center;
}

.gemat-qo-btn.gemat-qo-loop:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Responsive Design */
@media(max-width: 768px) {
    .gemat-qo-popup {
        padding: 10px;
    }

    .gemat-qo-wrapper {
        max-width: 100%;
        max-height: 95vh;
        border-radius: 8px;
    }

    .gemat-qo-inner {
        padding: 16px;
        gap: 12px;
    }

    .gemat-qo-product-header {
        gap: 10px;
    }

    .gemat-qo-image {
        width: 70px;
        height: 70px;
    }

    .gemat-qo-title {
        font-size: 14px;
    }

    .gemat-qo-price {
        font-size: 15px;
    }

    .gemat-qo-close {
        right: 10px;
        top: 10px;
        width: 26px;
        height: 26px;
        font-size: 18px;
    }

    .gemat-qo-form {
        gap: 8px;
    }
}