/**
 * WP Route Rate - Frontend Styles
 */

/* =====================================================
   CSS Variables (Defaults - overridden by dynamic styles)
   ===================================================== */

:root {
    --wprr-primary: #0073aa;
    --wprr-secondary: #23282d;
    --wprr-button: #0073aa;
    --wprr-button-text: #ffffff;
    --wprr-success: #46b450;
    --wprr-error: #dc3232;
}

/* =====================================================
   Calculator Container
   ===================================================== */

.wprr-calculator {
    max-width: 500px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: #333;
}

.wprr-calculator * {
    box-sizing: border-box;
}

/* =====================================================
   Form Styles
   ===================================================== */

.wprr-form {
    background: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.wprr-field {
    margin-bottom: 20px;
}

.wprr-field:last-child {
    margin-bottom: 0;
}

.wprr-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: var(--wprr-secondary);
}

.wprr-field input[type="text"],
.wprr-field select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
}

.wprr-field input[type="text"]:focus,
.wprr-field select:focus {
    outline: none;
    border-color: var(--wprr-primary);
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.wprr-field input[type="text"]::placeholder {
    color: #999;
}

.wprr-field select {
    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='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 40px;
    cursor: pointer;
}

/* =====================================================
   Service Type Buttons
   ===================================================== */

.wprr-service-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wprr-service-btn {
    display: block;
    width: 100%;
    padding: 15px 18px;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.wprr-service-btn:hover {
    border-color: var(--wprr-primary);
    background: rgba(0, 115, 170, 0.02);
}

.wprr-service-btn.selected {
    border-color: var(--wprr-primary);
    background: rgba(0, 115, 170, 0.05);
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.wprr-service-btn-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.wprr-service-icon {
    font-size: 24px;
    line-height: 1;
}

.wprr-service-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--wprr-secondary);
}

.wprr-service-price {
    font-size: 13px;
    color: #666;
    margin-left: auto;
}

@media (max-width: 480px) {
    .wprr-service-btn-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .wprr-service-price {
        margin-left: 0;
    }
}

/* =====================================================
   Button Styles
   ===================================================== */

.wprr-button,
.wprr-trigger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 14px 24px;
    background: var(--wprr-button);
    color: var(--wprr-button-text);
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s, opacity 0.2s;
}

.wprr-button:hover,
.wprr-trigger-btn:hover {
    opacity: 0.9;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.wprr-button:active,
.wprr-trigger-btn:active {
    transform: translateY(1px);
}

.wprr-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.wprr-btn-loading {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Spinner */
.wprr-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: wprr-spin 0.8s linear infinite;
}

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

/* Recalculate Button */
.wprr-recalculate {
    display: inline-block;
    margin-top: 15px;
    padding: 10px 20px;
    background: transparent;
    color: var(--wprr-primary);
    border: 2px solid var(--wprr-primary);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.wprr-recalculate:hover {
    background: var(--wprr-primary);
    color: #fff;
}

/* =====================================================
   Result Display
   ===================================================== */

.wprr-result {
    margin-top: 20px;
}

.wprr-result-inner {
    background: linear-gradient(135deg, rgba(70, 180, 80, 0.05) 0%, rgba(70, 180, 80, 0.1) 100%);
    border: 2px solid var(--wprr-success);
    border-radius: 8px;
    padding: 25px;
    text-align: center;
}

.wprr-result-title {
    margin: 0 0 15px;
    font-size: 16px;
    font-weight: 600;
    color: var(--wprr-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.wprr-result-price {
    margin-bottom: 20px;
}

.wprr-price-value {
    font-size: 42px;
    font-weight: 700;
    color: var(--wprr-primary);
    line-height: 1.2;
}

.wprr-result-details {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.wprr-detail {
    text-align: center;
}

.wprr-detail-label {
    display: block;
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
}

.wprr-detail-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--wprr-secondary);
}

.wprr-disclaimer {
    font-size: 12px;
    color: #666;
    margin: 15px 0 0;
    font-style: italic;
}

/* =====================================================
   Error Display
   ===================================================== */

.wprr-error {
    margin-top: 15px;
    padding: 15px;
    background: #fef2f2;
    border: 1px solid var(--wprr-error);
    border-radius: 6px;
    color: var(--wprr-error);
}

.wprr-error p {
    margin: 0;
    font-size: 14px;
}

/* =====================================================
   Modal / Popup
   ===================================================== */

.wprr-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.wprr-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
}

.wprr-modal-content {
    position: relative;
    background: #f5f5f5;
    border-radius: 12px;
    max-width: 550px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    animation: wprr-modal-in 0.3s ease;
}

@keyframes wprr-modal-in {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.wprr-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    background: #fff;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.wprr-modal-close:hover {
    background: var(--wprr-error);
    color: #fff;
}

.wprr-modal-body {
    padding: 20px;
}

.wprr-modal-body .wprr-calculator {
    max-width: 100%;
}

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

@media (max-width: 480px) {
    .wprr-form {
        padding: 20px 15px;
    }
    
    .wprr-price-value {
        font-size: 34px;
    }
    
    .wprr-result-details {
        flex-direction: column;
        gap: 15px;
    }
    
    .wprr-modal-content {
        margin: 10px;
        max-height: calc(100vh - 20px);
    }
}

/* =====================================================
   Form Integration Helpers
   ===================================================== */

/* Hide hidden fields from CF7 and other forms */
.wprr-calculator input[type="hidden"] {
    display: none !important;
}

/* Step transitions for multi-step forms */
.wprr-step {
    display: none;
}

.wprr-step.active {
    display: block;
}

/* Back button styling */
.wprr-back-button {
    display: inline-block;
    margin-bottom: 15px;
    padding: 8px 16px;
    background: transparent;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.wprr-back-button:hover {
    background: #f5f5f5;
    border-color: #999;
}

/* Summary display for step 2 */
.wprr-quote-summary-display {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
    text-align: center;
}

.wprr-quote-summary-display .price {
    font-size: 24px;
    font-weight: 700;
    color: var(--wprr-primary);
}

.wprr-quote-summary-display .details {
    font-size: 13px;
    color: #666;
    margin-top: 5px;
}

/* =====================================================
   Print Styles
   ===================================================== */

@media print {
    .wprr-button,
    .wprr-recalculate,
    .wprr-modal-close {
        display: none;
    }
    
    .wprr-result-inner {
        border: 2px solid #000;
        background: #fff;
    }
}
