/* Frontend styles */
.wwa-shipping-estimator {
    max-width: 90%;
    width: 100%;
    margin: 20px auto;
    padding: 30px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.wwa-shipping-estimator h2 {
    margin-top: 0;
    color: #333;
}

.wwa-shipping-estimator .estimator-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.wwa-shipping-estimator .form-group {
    margin-bottom: 0;
}

.wwa-shipping-estimator button[type="submit"] {
    grid-column: 1 / -1;
}

.wwa-shipping-estimator label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.wwa-shipping-estimator input,
.wwa-shipping-estimator select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: #fff;
}

.wwa-shipping-estimator select {
    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 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 35px;
}

.wwa-shipping-estimator input:focus,
.wwa-shipping-estimator select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

.wwa-shipping-estimator button {
    width: 100%;
    padding: 15px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.wwa-shipping-estimator button:hover {
    background: #005177;
}

.wwa-shipping-estimator button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.wwa-shipping-estimator .estimate-result {
    margin-top: 30px;
    padding: 20px;
    background: #f0f6fc;
    border-left: 4px solid #0073aa;
    border-radius: 4px;
}

.wwa-shipping-estimator .cost-amount {
    font-size: 36px;
    font-weight: bold;
    color: #0073aa;
    text-align: center;
    margin: 20px 0;
}

.wwa-shipping-estimator .route-details {
    margin: 15px 0;
    padding: 15px;
    background: #fff;
    border-radius: 4px;
}

.wwa-shipping-estimator .route-details p {
    margin: 8px 0;
}

.wwa-shipping-estimator .confidence-bar-container {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin: 15px 0;
}

.wwa-shipping-estimator .confidence-bar {
    height: 100%;
    transition: width 0.5s ease;
    border-radius: 4px;
}

.wwa-shipping-estimator .spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* Map styles */
#wwa-shipping-map {
    z-index: 1;
}

.wwa-map-reset-btn {
    transition: all 0.2s ease;
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.wwa-map-reset-btn:hover {
    background: #d32f2f !important;
    transform: scale(1.15);
    box-shadow: 0 3px 8px rgba(0,0,0,0.4) !important;
}

#wwa-zoom-instructions {
    line-height: 1.4;
}

#wwa-zoom-instructions strong {
    color: #333;
}

.wwa-shipping-estimator .leaflet-popup-content-wrapper {
    border-radius: 8px;
}

.wwa-shipping-estimator .leaflet-tooltip {
    padding: 8px 12px;
    font-size: 13px;
    line-height: 1.4;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.wwa-shipping-estimator .origin-tooltip {
    background: #f44336;
    color: white;
    border: none;
    font-weight: bold;
}

.wwa-shipping-estimator .port-marker,
.wwa-shipping-estimator .origin-marker {
    cursor: pointer;
    transition: transform 0.2s;
}

.wwa-shipping-estimator .port-marker:hover,
.wwa-shipping-estimator .origin-marker:hover {
    transform: scale(1.2);
}

.wwa-shipping-estimator .leaflet-tooltip-top:before {
    border-top-color: white;
}

.wwa-shipping-estimator .origin-tooltip.leaflet-tooltip-top:before {
    border-top-color: #f44336;
}

/* Ocean Shipping Rates Styles */
.wwa-shipping-estimator #wwa-ocean-rates-section {
    margin-top: 30px;
    padding: 25px;
    background: #fff;
    border: 2px solid #1976d2;
    border-radius: 8px;
}

.wwa-shipping-estimator .ocean-rates-container h3 {
    color: #1976d2;
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 24px;
    border-bottom: 2px solid #1976d2;
    padding-bottom: 10px;
}

.wwa-shipping-estimator .ocean-rates-intro {
    background: #e3f2fd;
    padding: 12px 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    color: #0d47a1;
}

.wwa-shipping-estimator .shipping-line-group {
    margin-bottom: 25px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 6px;
}

.wwa-shipping-estimator .shipping-line-group h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 20px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 8px;
}

.wwa-shipping-estimator .rate-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
}

.wwa-shipping-estimator .rate-option {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    padding: 15px;
    transition: all 0.3s ease;
}

.wwa-shipping-estimator .rate-option:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.wwa-shipping-estimator .rate-option.best-rate {
    border-color: #4caf50;
    background: #f1f8f4;
}

.wwa-shipping-estimator .rate-option-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.wwa-shipping-estimator .container-info {
    font-weight: 600;
    color: #555;
}

.wwa-shipping-estimator .best-badge {
    background: #4caf50;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

.wwa-shipping-estimator .rate-pricing {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.wwa-shipping-estimator .price-per-vehicle,
.wwa-shipping-estimator .price-per-container {
    text-align: center;
}

.wwa-shipping-estimator .price-label {
    display: block;
    font-size: 11px;
    color: #777;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.wwa-shipping-estimator .price-amount {
    display: block;
    font-size: 28px;
    font-weight: bold;
    color: #1976d2;
}

.wwa-shipping-estimator .price-amount-small {
    display: block;
    font-size: 18px;
    font-weight: 600;
    color: #666;
}

.wwa-shipping-estimator .rate-destination {
    padding: 8px;
    background: #f9f9f9;
    border-radius: 4px;
    margin-bottom: 8px;
    font-size: 14px;
}

.wwa-shipping-estimator .rate-notes {
    padding: 8px;
    background: #fff3cd;
    border-left: 3px solid #ffc107;
    border-radius: 4px;
    margin-top: 10px;
}

.wwa-shipping-estimator .rate-notes small {
    color: #856404;
    line-height: 1.4;
}

.wwa-shipping-estimator .no-ocean-rates {
    text-align: center;
    padding: 30px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    color: #856404;
    font-size: 16px;
}

.wwa-shipping-estimator #ocean-rates-loading {
    text-align: center;
    padding: 40px;
}

.wwa-shipping-estimator #ocean-rates-loading .spinner {
    border-color: rgba(25, 118, 210, 0.3);
    border-top-color: #1976d2;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .wwa-shipping-estimator {
        max-width: 100%;
        margin: 10px auto;
        padding: 15px;
        border-radius: 0;
    }
    
    .wwa-shipping-estimator h2 {
        font-size: 22px;
        text-align: center;
    }
    
    .wwa-shipping-estimator .estimator-form {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .wwa-shipping-estimator input,
    .wwa-shipping-estimator select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 14px;
    }
    
    .wwa-shipping-estimator button {
        padding: 16px;
        font-size: 18px;
    }
    
    /* Map adjustments */
    #wwa-shipping-map {
        height: 250px !important;
        margin-bottom: 15px;
    }
    
    /* Estimate result */
    .wwa-shipping-estimator .estimate-result {
        padding: 15px;
        margin-top: 20px;
    }
    
    .wwa-shipping-estimator .estimate-result h3 {
        font-size: 18px;
        text-align: center;
    }
    
    .wwa-shipping-estimator .cost-amount {
        font-size: 32px;
        margin: 15px 0;
    }
    
    .wwa-shipping-estimator .route-details {
        padding: 12px;
    }
    
    .wwa-shipping-estimator .route-details p {
        font-size: 14px;
    }
    
    /* Ocean rates mobile styles */
    .wwa-shipping-estimator #wwa-ocean-rates-section {
        margin-top: 20px;
        padding: 15px;
        border-radius: 6px;
    }
    
    .wwa-shipping-estimator .ocean-rates-container h3 {
        font-size: 18px;
        margin-bottom: 15px;
    }
    
    .wwa-shipping-estimator .ocean-rates-intro {
        padding: 10px 12px;
        font-size: 14px;
        margin-bottom: 15px;
    }
    
    .wwa-shipping-estimator .shipping-line-group {
        margin-bottom: 20px;
        padding: 12px;
    }
    
    .wwa-shipping-estimator .shipping-line-group h4 {
        font-size: 16px;
        margin-bottom: 12px;
    }
    
    .wwa-shipping-estimator .rate-options {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .wwa-shipping-estimator .rate-option {
        padding: 12px;
    }
    
    .wwa-shipping-estimator .rate-option-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .wwa-shipping-estimator .container-info {
        font-size: 14px;
    }
    
    .wwa-shipping-estimator .best-badge {
        align-self: flex-start;
    }
    
    .wwa-shipping-estimator .rate-pricing {
        flex-direction: column;
        gap: 15px;
        margin-bottom: 15px;
    }
    
    .wwa-shipping-estimator .price-per-vehicle,
    .wwa-shipping-estimator .price-per-container {
        text-align: left;
    }
    
    .wwa-shipping-estimator .price-amount {
        font-size: 24px;
    }
    
    .wwa-shipping-estimator .price-amount-small {
        font-size: 16px;
    }
    
    .wwa-shipping-estimator .rate-destination {
        padding: 8px;
        font-size: 13px;
    }
    
    .wwa-shipping-estimator .rate-notes {
        padding: 8px;
        margin-top: 8px;
    }
    
    .wwa-shipping-estimator .rate-notes small {
        font-size: 12px;
        line-height: 1.5;
    }
}

/* Extra small devices (phones in portrait, less than 375px) */
@media (max-width: 374px) {
    .wwa-shipping-estimator {
        padding: 10px;
    }
    
    .wwa-shipping-estimator h2 {
        font-size: 20px;
    }
    
    .wwa-shipping-estimator .cost-amount {
        font-size: 28px;
    }
    
    .wwa-shipping-estimator .price-amount {
        font-size: 22px;
    }
    
    .wwa-shipping-estimator .ocean-rates-container h3 {
        font-size: 16px;
    }
    
    .wwa-shipping-estimator .shipping-line-group h4 {
        font-size: 15px;
    }
}

/* Landscape phone optimization */
@media (max-width: 768px) and (orientation: landscape) {
    #wwa-shipping-map {
        height: 200px !important;
    }
    
    .wwa-shipping-estimator .estimator-form {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .wwa-shipping-estimator button[type="submit"] {
        grid-column: 1 / -1;
    }
}
