/**
 * KB Shipping Rate Calculator - Frontend CSS
 */

/* Wrapper */
.kbsc-wrapper {
    margin: 15px 0;
}

/* Estimate Button */
.kbsc-estimate-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-weight: 600;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    justify-content: center;
    font-size: 14px;
}

.kbsc-estimate-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.kbsc-estimate-btn i.material-icons {
    font-size: 20px;
}

/* Modal Overlay */
.kbsc-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.kbsc-modal.active {
    display: flex;
}

body.kbsc-modal-open {
    overflow: hidden;
}

/* Modal Content */
.kbsc-modal-content {
    background: #fff;
    border-radius: 8px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: kbscSlideIn 0.3s ease;
}

@keyframes kbscSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal Header */
.kbsc-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    color: #fff;
}

.kbsc-modal-header h3 {
    margin: 0;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.kbsc-modal-header i.material-icons {
    font-size: 24px;
}

.kbsc-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    font-size: 24px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
    line-height: 1;
}

.kbsc-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Modal Body */
.kbsc-modal-body {
    padding: 25px;
    max-height: calc(90vh - 80px);
    overflow-y: auto;
}

/* Form Section */
.kbsc-form-section h4,
.kbsc-results-section h4 {
    margin: 0 0 20px 0;
    font-size: 16px;
    color: #333;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

/* Form Groups */
.kbsc-form-group {
    margin-bottom: 20px;
}

.kbsc-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.kbsc-form-group label .required {
    color: #e74c3c;
    margin-left: 2px;
}

.kbsc-form-group .form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.kbsc-form-group .form-control:focus {
    border-color: #619651;
    outline: none;
    box-shadow: 0 0 0 3px rgba(97, 150, 81, 0.1);
}

.kbsc-form-group select.form-control {
    background-color: #fff;
    cursor: pointer;
    height: auto;
    min-height: 46px;
    line-height: 1.5;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 35px;
}

.kbsc-form-group select.form-control option {
    padding: 10px;
    line-height: 1.5;
}

/* Toggle Group */
.kbsc-toggle-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.kbsc-toggle-group > label {
    margin-bottom: 0;
}

.kbsc-toggle {
    display: flex;
    gap: 5px;
    background: #f5f5f5;
    padding: 4px;
    border-radius: 4px;
}

.kbsc-toggle-option {
    padding: 8px 16px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 13px;
    color: #666;
}

.kbsc-toggle-option input {
    display: none;
}

.kbsc-toggle-option.active {
    background: #619651;
    color: #fff;
}

.kbsc-toggle-option:hover:not(.active) {
    background: #e0e0e0;
}

/* Calculate Button */
.kbsc-calculate-btn {
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: 4px;
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.kbsc-calculate-btn:hover {
    opacity: 0.9;
}

/* Results Section */
.kbsc-results-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.kbsc-results-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Carrier Item */
.kbsc-carrier-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #619651;
}

.kbsc-carrier-info {
    flex: 1;
}

.kbsc-carrier-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.kbsc-carrier-delay {
    font-size: 13px;
    color: #666;
}

.kbsc-carrier-price {
    font-size: 18px;
    font-weight: 700;
    color: #619651;
    margin-left: 15px;
}

/* Loading */
.kbsc-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 15px;
}

.kbsc-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f0f0f0;
    border-top-color: #619651;
    border-radius: 50%;
    animation: kbscSpin 1s linear infinite;
}

@keyframes kbscSpin {
    to {
        transform: rotate(360deg);
    }
}

.kbsc-loading span {
    color: #666;
    font-size: 14px;
}

/* Error Message */
.kbsc-error {
    padding: 15px;
    background: #fee2e2;
    color: #dc2626;
    border-radius: 6px;
    text-align: center;
    font-size: 14px;
    margin-top: 20px;
}

/* Responsive */
@media (max-width: 576px) {
    .kbsc-modal {
        padding: 10px;
    }

    .kbsc-modal-content {
        max-height: 95vh;
    }

    .kbsc-modal-body {
        padding: 15px;
    }

    .kbsc-modal-header {
        padding: 15px;
    }

    .kbsc-modal-header h3 {
        font-size: 16px;
    }

    .kbsc-toggle-group {
        flex-direction: column;
        align-items: flex-start;
    }

    .kbsc-carrier-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .kbsc-carrier-price {
        margin-left: 0;
    }
}
