/**
 * KB Sell By Box - Frontend Styles
 *
 * @author    Starter
 * @copyright 2024
 * @license   http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */

/* ============================================
   Area Calculator Widget
   ============================================ */

.kbsbb-calculator {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.kbsbb-calculator-header {
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 1px solid #dee2e6;
}

.kbsbb-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #232323;
}

.kbsbb-title i {
    font-size: 20px;
    color: #2fb5d2;
}

/* Coverage Info */
.kbsbb-coverage-info,
.kbsbb-unit-price-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #fff;
    border-radius: 4px;
    margin-bottom: 10px;
    font-size: 14px;
}

.kbsbb-coverage-label,
.kbsbb-unit-price-label {
    color: #6c757d;
}

.kbsbb-coverage-value,
.kbsbb-unit-price-value {
    font-weight: 600;
    color: #232323;
}

/* Area Input */
.kbsbb-input-group {
    margin-bottom: 15px;
}

.kbsbb-input-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #495057;
    font-size: 14px;
}

.kbsbb-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.kbsbb-area-input {
    flex: 1;
    padding-right: 60px !important;
    font-size: 16px;
    height: 44px;
}

.kbsbb-area-input:focus {
    border-color: #2fb5d2;
    box-shadow: 0 0 0 3px rgba(47, 181, 210, 0.15);
}

.kbsbb-input-unit {
    position: absolute;
    right: 12px;
    color: #6c757d;
    font-size: 14px;
    pointer-events: none;
}

.kbsbb-area-limits {
    display: block;
    margin-top: 4px;
    color: #6c757d;
    font-size: 12px;
}

/* Calculate Button */
.kbsbb-calculate-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 15px;
}

.kbsbb-calculate-btn i {
    font-size: 18px;
}

/* Results */
.kbsbb-results {
    background: #fff;
    border: 2px solid #28a745;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
}

.kbsbb-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
}

.kbsbb-result-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.kbsbb-result-item:first-child {
    padding-top: 0;
}

.kbsbb-result-label {
    color: #495057;
    font-size: 14px;
}

.kbsbb-result-value {
    font-weight: 700;
    font-size: 16px;
    color: #232323;
}

.kbsbb-boxes-needed .kbsbb-result-value {
    font-size: 20px;
    color: #28a745;
}

.kbsbb-total-price .kbsbb-result-value {
    color: #007bff;
}

/* Error */
.kbsbb-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 15px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    color: #721c24;
    font-size: 14px;
    margin-bottom: 15px;
}

.kbsbb-error i {
    color: #dc3545;
}

/* Apply Button */
.kbsbb-apply-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
}

.kbsbb-apply-btn i {
    font-size: 18px;
}

.kbsbb-apply-btn:hover {
    transform: translateY(-1px);
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 767px) {
    .kbsbb-calculator {
        padding: 15px;
    }

    .kbsbb-title {
        font-size: 14px;
    }

    .kbsbb-coverage-info,
    .kbsbb-unit-price-info {
        flex-direction: column;
        gap: 4px;
        text-align: center;
    }

    .kbsbb-result-item {
        flex-direction: column;
        gap: 4px;
        text-align: center;
    }
}

/* ============================================
   Animation
   ============================================ */

.kbsbb-results.kbsbb-show {
    animation: kbsbb-fadeIn 0.3s ease;
}

@keyframes kbsbb-fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.kbsbb-calculating {
    position: relative;
    pointer-events: none;
}

.kbsbb-calculating::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: kbsbb-spin 0.8s linear infinite;
}

@keyframes kbsbb-spin {
    to {
        transform: rotate(360deg);
    }
}
