/**
 * KS Quick View - Modal Styles
 * Matches frachtbedarf.de design language
 *
 * @package KS_Quick_View
 */

/* ============================================================
   Modal Overlay + Container
   ============================================================ */
.ksqv-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.ksqv-modal.ksqv-active {
    opacity: 1;
}

.ksqv-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.55);
    cursor: pointer;
}

/* ============================================================
   Dialog Box
   ============================================================ */
.ksqv-dialog {
    position: relative;
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    z-index: 1;
    transform: translateY(20px) scale(0.97);
    transition: transform 0.3s ease;
}
.ksqv-modal.ksqv-active .ksqv-dialog {
    transform: translateY(0) scale(1);
}

/* Close button */
.ksqv-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: none;
    background: #f5f5f5;
    color: #333;
    font-size: 22px;
    font-weight: 300;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s ease;
    line-height: 1;
}
.ksqv-close:hover {
    background: #e74c3c;
    color: #fff;
}

/* ============================================================
   Loading Spinner
   ============================================================ */
.ksqv-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}
.ksqv-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f0f0f0;
    border-top-color: #e74c3c;
    border-radius: 50%;
    animation: ksqv-spin 0.8s linear infinite;
}
@keyframes ksqv-spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   Content Layout - 2 columns
   ============================================================ */
.ksqv-content {
    display: flex;
    gap: 30px;
    padding: 30px;
}

.ksqv-left {
    flex: 0 0 45%;
    max-width: 45%;
}

.ksqv-right {
    flex: 1;
    min-width: 0;
}

/* ============================================================
   Product Image
   ============================================================ */
.ksqv-main-image-wrap {
    position: relative;
    background: #f8f8f8;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
}
.ksqv-main-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    padding: 15px;
}

/* Sale badge */
.ksqv-sale-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #e74c3c;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 2;
}

/* Thumbnails */
.ksqv-thumbs {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
}
.ksqv-thumb {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border: 2px solid #e5e5e5;
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.2s ease;
    background: #f8f8f8;
    padding: 4px;
    flex-shrink: 0;
}
.ksqv-thumb:hover,
.ksqv-thumb.active {
    border-color: #e74c3c;
}

/* ============================================================
   Product Details (right side)
   ============================================================ */
.ksqv-title {
    font-size: 22px;
    font-weight: 700;
    color: #222;
    margin: 0 0 12px;
    line-height: 1.3;
    padding-right: 30px;
}

/* Price */
.ksqv-price {
    font-size: 20px;
    font-weight: 700;
    color: #333;
    margin-bottom: 4px;
}
.ksqv-price del {
    color: #999;
    font-weight: 400;
    font-size: 0.85em;
}
.ksqv-price ins {
    text-decoration: none;
    color: #e74c3c;
}

.ksqv-tax-label {
    font-size: 12px;
    color: #999;
    margin-bottom: 12px;
}

/* Stock */
.ksqv-stock {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 15px;
}
.ksqv-in-stock {
    color: #27ae60;
}
.ksqv-out-of-stock {
    color: #e74c3c;
}

/* Description */
.ksqv-desc {
    font-size: 14px;
    color: #555;
    line-height: 1.6;
    margin-bottom: 18px;
    max-height: 150px;
    overflow-y: auto;
}
.ksqv-desc ul {
    margin: 5px 0;
    padding-left: 18px;
}
.ksqv-desc li {
    margin-bottom: 3px;
}

/* Meta (SKU, categories) */
.ksqv-meta {
    font-size: 13px;
    color: #777;
    margin-bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.ksqv-meta a {
    color: #e74c3c;
    text-decoration: none;
}

/* ============================================================
   Actions: Qty + Add to Cart + Link
   ============================================================ */
.ksqv-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Quantity selector */
.ksqv-qty-wrap {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
}
.ksqv-qty-btn {
    width: 36px;
    height: 40px;
    border: none;
    background: #f5f5f5;
    color: #333;
    font-size: 18px;
    font-weight: 400;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.ksqv-qty-btn:hover {
    background: #eee;
}
.ksqv-qty-input {
    width: 45px;
    height: 40px;
    border: none;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    -moz-appearance: textfield;
    appearance: textfield;
}
.ksqv-qty-input::-webkit-outer-spin-button,
.ksqv-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Add to cart button */
.ksqv-add-to-cart {
    padding: 10px 25px;
    background: #e74c3c;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    height: 40px;
    display: flex;
    align-items: center;
}
.ksqv-add-to-cart:hover {
    background: #c0392b;
}
.ksqv-loading-btn {
    opacity: 0.7;
    pointer-events: none;
}
.ksqv-added-btn {
    background: #27ae60 !important;
}

/* View full details link */
.ksqv-view-full {
    font-size: 13px;
    color: #e74c3c !important;
    text-decoration: none !important;
    font-weight: 500;
    transition: color 0.2s;
    white-space: nowrap;
}
.ksqv-view-full:hover {
    color: #c0392b !important;
    text-decoration: underline !important;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
    .ksqv-content {
        flex-direction: column;
        padding: 20px;
        gap: 20px;
    }
    .ksqv-left {
        flex: none;
        max-width: 100%;
    }
    .ksqv-main-image-wrap {
        aspect-ratio: auto;
        max-height: 300px;
    }
    .ksqv-title {
        font-size: 18px;
    }
    .ksqv-price {
        font-size: 18px;
    }
    .ksqv-dialog {
        width: 95%;
        max-height: 90vh;
        border-radius: 8px;
    }
    .ksqv-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .ksqv-add-to-cart {
        justify-content: center;
    }
    .ksqv-view-full {
        text-align: center;
    }
}

@media (max-width: 480px) {
    .ksqv-content {
        padding: 15px;
    }
    .ksqv-thumb {
        width: 50px;
        height: 50px;
    }
}
