/**
 * Speedex Calculator Public Styles - Complete Combined Version
 * 
 * This file contains all styles for the Speedex shipping calculator including:
 * - Main calculator styles
 * - Enhanced UI components
 * - RTL language support
 * - Font definitions for IRANSans
 * - Responsive design
 * - Modal and form styles
 *
 * @since      1.0.0
 * @package    Speedex
 * @version    1.0.0
 * @author     Ehsan Mirzaei
 */

/* ==========================================================================
   FONT DEFINITIONS - IRANSANS FONT FAMILY
   Professional Persian/Farsi font integration
   ========================================================================== */

/* IRANSans Regular */
@font-face {
    font-family: 'IRANSans';
    src: url('../../assets/fonts/IRANSansWeb.eot');
    src: url('../../assets/fonts/IRANSansWeb.eot?#iefix') format('embedded-opentype'),
         url('../../assets/fonts/iransansweb.woff2') format('woff2'),
         url('../../assets/fonts/iransansweb.woff') format('woff'),
         url('../../assets/fonts/iransansweb.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* IRANSans Light */
@font-face {
    font-family: 'IRANSans';
    src: url('../../assets/fonts/IRANSansWeb_Light.eot');
    src: url('../../assets/fonts/IRANSansWeb_Light.eot?#iefix') format('embedded-opentype'),
         url('../../assets/fonts/IRANSansWeb_Light.woff2') format('woff2'),
         url('../../assets/fonts/IRANSansWeb_Light.woff') format('woff'),
         url('../../assets/fonts/IRANSansWeb_Light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

/* IRANSans Medium */
@font-face {
    font-family: 'IRANSans';
    src: url('../../assets/fonts/IRANSansWeb_Medium.eot');
    src: url('../../assets/fonts/IRANSansWeb_Medium.eot?#iefix') format('embedded-opentype'),
         url('../../assets/fonts/IRANSansWeb_Medium.woff2') format('woff2'),
         url('../../assets/fonts/IRANSansWeb_Medium.woff') format('woff'),
         url('../../assets/fonts/IRANSansWeb_Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

/* IRANSans Bold */
@font-face {
    font-family: 'IRANSans';
    src: url('../../assets/fonts/IRANSansWeb_Bold.eot');
    src: url('../../assets/fonts/IRANSansWeb_Bold.eot?#iefix') format('embedded-opentype'),
         url('../../assets/fonts/IRANSansWeb_Bold.woff2') format('woff2'),
         url('../../assets/fonts/IRANSansWeb_Bold.woff') format('woff'),
         url('../../assets/fonts/IRANSansWeb_Bold.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

/* IRANSans Ultra Light */
@font-face {
    font-family: 'IRANSans';
    src: url('../../assets/fonts/IRANSansWeb_UltraLight.eot');
    src: url('../../assets/fonts/IRANSansWeb_UltraLight.eot?#iefix') format('embedded-opentype'),
         url('../../assets/fonts/IRANSansWeb_UltraLight.woff2') format('woff2'),
         url('../../assets/fonts/IRANSansWeb_UltraLight.woff') format('woff'),
         url('../../assets/fonts/IRANSansWeb_UltraLight.ttf') format('truetype');
    font-weight: 200;
    font-style: normal;
    font-display: swap;
}

/* Apply IRANSans font to specific elements */
.rtl,
.rtl .speedex-calculator-container,
.rtl .speedex-select,
.rtl .speedex-input,
.rtl .speedex-textarea,
.rtl .speedex-button,
.rtl .speedex-modal-content,
[class*="speedex-"],
[class*="speedex-"] *:not(.dashicons):not([class*="dashicons"]),
[class*="spx-"],
[class*="spx-"] *:not(.dashicons):not([class*="dashicons"]) {
    font-family: 'IRANSans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif !important;
}

/* Preserve dashicons font for WordPress icons */
.dashicons,
[class*="dashicons"],
[class*="speedex-"] .dashicons,
[class*="speedex-"] [class*="dashicons"],
[class*="spx-"] .dashicons,
[class*="spx-"] [class*="dashicons"] {
    font-family: 'dashicons' !important;
}

/* ==========================================================================
   ENHANCED CALCULATOR STYLES - MODERN UI
   Professional calculator interface with animations
   ========================================================================== */

/* Enhanced Calculator Wrapper */
.spx-calc-wrapper {
    position: relative;
    width: 100%;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 2rem 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    overflow-x: hidden;
    max-width: none;
}

/* Animated Background Elements */
.spx-bg-elements {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
}

.spx-bg-circle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    animation: spx-float 6s ease-in-out infinite;
}

.spx-bg-circle-1 {
    width: 200px;
    height: 200px;
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.spx-bg-circle-2 {
    width: 150px;
    height: 150px;
    top: 60%;
    right: 15%;
    animation-delay: 2s;
}

.spx-bg-circle-3 {
    width: 100px;
    height: 100px;
    bottom: 20%;
    left: 20%;
    animation-delay: 4s;
}

@keyframes spx-float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(180deg); }
}

/* Main Container */
.spx-calc-container {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem;
    z-index: 1;
    direction: ltr;
}

/* Header Section */
.spx-calc-header {
    text-align: center;
    margin-bottom: 2rem;
}

/* Language Switcher */
.spx-lang-switcher {
    display: none;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.spx-lang-toggle {
    display: flex;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 25px;
    padding: 0.25rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.spx-lang-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    text-decoration: none;
    color: #4a5568;
    transition: all 0.3s ease;
    font-weight: 500;
}

.spx-lang-btn.spx-active {
    background: #667eea;
    color: white;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

.spx-lang-btn:hover {
    color: #667eea;
    transform: translateY(-1px);
}

.spx-lang-btn.spx-active:hover {
    color: white;
}

.spx-lang-icon {
    font-size: 1.2rem;
}

/* Title Section */
.spx-title-section {
    color: #2d3748;
    margin-bottom: 2rem;
}

.spx-main-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.spx-title-icon {
    font-size: 2rem;
    animation: spx-bounce 2s infinite;
}

@keyframes spx-bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

.spx-title-subtitle {
    font-size: 1.1rem;
    opacity: 0.8;
    margin: 0;
    font-weight: 300;
    color: #4a5568;
}

/* Card Base Styles */
.spx-form-card,
.spx-origin-card {
    background: rgba(255, 255, 255, 0.95) !important;
    border-radius: 16px !important;
    padding: 2rem !important;
    margin-bottom: 1.5rem !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08) !important;
    backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    transition: all 0.3s ease !important;
}

.spx-form-card:hover,
.spx-origin-card:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.12) !important;
}

/* Card Headers */
.spx-card-header {
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 1rem;
}

.spx-card-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: #2d3748;
    margin: 0 0 0.5rem 0;
}

.spx-icon {
    font-size: 1.5rem;
}

.spx-card-desc {
    color: #718096;
    margin: 0;
    font-size: 0.95rem;
}

/* Origin Card Specific */
.spx-origin-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: center;
}

.spx-base-location {
    text-align: center;
}

.spx-location-label {
    font-size: 0.875rem;
    color: #718096;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.spx-location-value {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    padding: 0.75rem 1rem;
    /*background: linear-gradient(135deg, #4299e1, #667eea);*/
	background: #FDCD0F;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(66, 153, 225, 0.3);
}

.spx-location-icon {
    font-size: 1.5rem;
}

/* Route Selector */
.spx-route-selector {
    position: relative;
}

/* Field Labels */ 
.spx-field-label { 
    display: flex; 
    align-items: center; 
    gap: 0.25rem; 
    margin-bottom: 0.5rem; 
    font-weight: 600; 
    font-size: 0.875rem; 
    color: #374151; 
}

.spx-label-text { 
    color: #374151; 
}

.spx-required {
    color: #e53e3e;
    font-weight: bold;
}

/* Select Wrapper */
.spx-select-wrapper {
    position: relative;
}

.spx-select {
    width: 100%;
    padding: 0.875rem 3rem 0.875rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    font-size: 1rem;
    color: #2d3748;
    font-weight: 500;
    appearance: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.spx-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.spx-select-arrow {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #718096;
    pointer-events: none;
    transition: all 0.3s ease;
}

.spx-select:focus + .spx-select-arrow {
    color: #667eea;
    transform: translateY(-50%) rotate(180deg);
}

/* Package Grid - Fixed to show in one row */
.spx-package-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.spx-package-row {
    grid-template-columns: repeat(3, 1fr);
}

.spx-package-card {
    position: relative;
    padding: 1.5rem;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
}

.spx-package-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.spx-package-card:hover {
    border-color: #667eea;
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.2);
}

.spx-package-card:hover::before {
    transform: scaleX(1);
}

.spx-package-card.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
}

.spx-package-card.selected::before {
    transform: scaleX(1);
}

.spx-package-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
    color: #667eea;
}

.spx-package-info {
    text-align: center;
}

.spx-package-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: #2d3748;
    margin: 0 0 0.5rem 0;
}

.spx-package-desc {
    font-size: 0.875rem;
    color: #718096;
    margin: 0;
}

.spx-package-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #FDCD0F;
	color: white;
    /* color: #4a5568; */
}

.spx-badge-popular {
    background: #FDCD0F;
    color: white;
}

.spx-badge-custom {
    background: #FDCD0F;
    color: white;
}

/* Destination Loading */
.spx-destination-wrapper {
    position: relative;
}

.spx-destination-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    color: #718096;
    font-size: 0.875rem;
}

.spx-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #e2e8f0;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spx-spin 1s linear infinite;
}

@keyframes spx-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Weight Section */
.spx-weight-section {
    space-y: 1.5rem;
}

.spx-weight-slider-container {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2rem;
    align-items: center;
    margin-bottom: 1rem;
}

.spx-slider-wrapper {
    position: relative;
}

.spx-weight-slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #e2e8f0;
    appearance: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.spx-weight-slider::-webkit-slider-thumb {
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    /* background: linear-gradient(135deg, #667eea, #764ba2); */
    background: #FDCD0F;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
}

.spx-weight-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.spx-weight-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.spx-weight-display {
    display: flex;
    align-items: center;
}

.spx-weight-input-wrapper {
    display: flex;
    align-items: center;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
}

.spx-weight-input-wrapper:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.spx-weight-input {
    border: none;
    outline: none;
    font-size: 1.125rem;
    font-weight: 600;
    color: #2d3748;
    width: 70px;
    text-align: center;
    background: transparent;
}

.spx-weight-unit {
    font-size: 1rem;
    color: #718096;
    font-weight: 500;
    margin-left: 0.5rem;
}

/* Weight Presets */
.spx-weight-presets {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.spx-preset-btn {
    padding: 0.5rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 20px;
    background: #FDCD0F !important;
    color: #4a5568;
    font-size: 0.875rem;
    font-weight: 500; 
    cursor: pointer;
    transition: all 0.3s ease;
	direction: ltr;
}

.spx-preset-btn:hover {
    border-color: #667eea;
    color: #667eea;
    transform: translateY(-1px);
}

.spx-preset-btn:active {
    transform: translateY(0);
}

/* Dimensions Grid */
.spx-dimensions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.spx-dimension-field {
    display: flex;
    flex-direction: column;
}

.spx-dim-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 0.5rem;
}

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

.spx-input-wrapper::after,
.spx-textarea-wrapper::after {
    content: '' !important;
    display: none !important;
}

.spx-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.spx-input-suffix {
    position: absolute !important;
    right: 1rem !important;
	top: 1rem !important;
    color: #718096 !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    pointer-events: none !important;
}

/* Volumetric Info */
.spx-volumetric-info {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
    border-radius: 12px;
    border-left: 4px solid #667eea;
}

.spx-info-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.spx-info-text {
    font-size: 0.875rem;
    color: #4a5568;
    line-height: 1.5;
}

/* Freight Notice */
.spx-freight-notice {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(245, 87, 108, 0.05), rgba(240, 147, 251, 0.05));
    border-radius: 12px;
    border-left: 4px solid #f5576c;
    margin-bottom: 1.5rem;
}

.spx-notice-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.spx-notice-content h4 {
    margin: 0 0 0.5rem 0;
    color: #2d3748;
    font-size: 1.125rem;
    font-weight: 600;
}

.spx-notice-content p {
    margin: 0;
    color: #4a5568;
    line-height: 1.5;
}


/* Contact Fields Grid */
.spx-contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Override any theme conflicts */ 
.spx-field-group input[type="text"], 
.spx-field-group input[type="email"], 
.spx-field-group input[type="tel"], 
.spx-field-group textarea { 
    width: 100% !important; 
    padding-right: 48px !important; 
    background-image: none !important; 
    background-position: unset !important; 
    background-repeat: unset !important; 
}

/* Phone number, email and number specific styling - always LTR */ 
.spx-field-group input[type="tel"], 
.spx-field-group input[type="email"],
.spx-field-group input[type="number"] { 
    direction: ltr !important; 
    text-align: left !important; 
    unicode-bidi: embed !important; 
}


.spx-field-full {
    grid-column: 1 / -1;
}

.spx-input-wrapper,
.spx-textarea-wrapper {
    position: relative !important;
    display: block !important;
    width: 100% !important;
}

.spx-input-icon,
.spx-textarea-icon {
    position: absolute !important;
    right: 16px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    font-size: 18px !important;
    color: #6b7280 !important;
    pointer-events: none !important;
    z-index: 10 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 20px !important;
    height: 20px !important;
}

.spx-textarea-icon {
    top: 20px !important;
    transform: none !important;
}

/* Base Input Styles */ 
.spx-input, 
.spx-textarea { 
    width: 100% !important; 
    min-height: 48px !important; 
    padding: 12px 48px 12px 16px !important; 
    border: 2px solid #e5e7eb !important; 
    border-radius: 8px !important; 
    font-size: 14px !important; 
    line-height: 1.5 !important; 
    background-color: #ffffff !important; 
    transition: all 0.2s ease-in-out !important; 
    box-sizing: border-box !important; 
}

/* Default LTR for inputs */ 
.spx-input, 
.spx-textarea { 
    direction: ltr !important; 
    text-align: left !important; 
}

.spx-textarea {
    min-height: 100px !important;
    resize: vertical !important;
    padding-top: 12px !important;
}

.spx-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Placeholder Styles */
.spx-input::placeholder,
.spx-textarea::placeholder {
    color: #9ca3af !important;
    opacity: 1 !important;
}


/* Email, Tel, and Number placeholders should always be LTR */ 
.spx-input[type="email"]::placeholder, 
.spx-input[type="tel"]::placeholder,
.spx-input[type="number"]::placeholder,
input[type="email"]::placeholder,
input[type="tel"]::placeholder,
input[type="number"]::placeholder { 
    direction: ltr !important; 
    text-align: left !important; 
    unicode-bidi: embed !important; 
}


/* Cross-browser placeholder support for email, tel and number fields */
.spx-input[type="email"]::-webkit-input-placeholder,
.spx-input[type="tel"]::-webkit-input-placeholder,
.spx-input[type="number"]::-webkit-input-placeholder,
input[type="email"]::-webkit-input-placeholder,
input[type="tel"]::-webkit-input-placeholder,
input[type="number"]::-webkit-input-placeholder {
    direction: ltr !important;
    text-align: left !important;
}

.spx-input[type="email"]::-moz-placeholder,
.spx-input[type="tel"]::-moz-placeholder,
.spx-input[type="number"]::-moz-placeholder,
input[type="email"]::-moz-placeholder,
input[type="tel"]::-moz-placeholder,
input[type="number"]::-moz-placeholder {
    direction: ltr !important;
    text-align: left !important;
}

.spx-input[type="email"]:-ms-input-placeholder,
.spx-input[type="tel"]:-ms-input-placeholder,
.spx-input[type="number"]:-ms-input-placeholder,
input[type="email"]:-ms-input-placeholder,
input[type="tel"]:-ms-input-placeholder,
input[type="number"]:-ms-input-placeholder {
    direction: ltr !important;
    text-align: left !important;
}

.spx-input[type="email"]:-moz-placeholder,
.spx-input[type="tel"]:-moz-placeholder,
.spx-input[type="number"]:-moz-placeholder,
input[type="email"]:-moz-placeholder,
input[type="tel"]:-moz-placeholder,
input[type="number"]:-moz-placeholder {
    direction: ltr !important;
    text-align: left !important;
}

/* RTL Text field placeholders */
.rtl .spx-input[type="text"]::-webkit-input-placeholder,
.rtl input[name="name"]::-webkit-input-placeholder,
.rtl input[id*="-name"]::-webkit-input-placeholder {
    text-align: right !important;
    direction: rtl !important;
}

.rtl .spx-input[type="text"]::-moz-placeholder,
.rtl input[name="name"]::-moz-placeholder,
.rtl input[id*="-name"]::-moz-placeholder {
    text-align: right !important;
    direction: rtl !important;
}

.rtl .spx-input[type="text"]:-ms-input-placeholder,
.rtl input[name="name"]:-ms-input-placeholder,
.rtl input[id*="-name"]:-ms-input-placeholder {
    text-align: right !important;
    direction: rtl !important;
}

.rtl .spx-input[type="text"]:-moz-placeholder,
.rtl input[name="name"]:-moz-placeholder,
.rtl input[id*="-name"]:-moz-placeholder {
    text-align: right !important;
    direction: rtl !important;
}



/* Action Section */
.spx-action-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
}

.spx-calc-button {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
/*    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);*/
	background : #FDCD0F !important;
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
    overflow: hidden;
}

.spx-calc-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.spx-calc-button:hover::before {
    left: 100%;
}

.spx-calc-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.4);
}

.spx-calc-button:active {
    transform: translateY(0);
}

.spx-calc-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.spx-btn-icon {
    font-size: 1.5rem;
}

.spx-btn-text {
    font-weight: 600;
}

.spx-btn-loader {
    position: absolute;
    right: 1rem;
}

.spx-btn-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spx-spin 1s linear infinite;
}

/* Progress Indicator */
.spx-progress-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    max-width: 300px;
}

.spx-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(102, 126, 234, 0.2);
    border-radius: 3px;
    overflow: hidden;
}

.spx-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 3px;
    animation: spx-progress 2s ease-in-out infinite;
}

@keyframes spx-progress {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

.spx-progress-text {
    color: #4a5568;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Success Card */
.spx-success-card {
    background: linear-gradient(135deg, rgba(72, 187, 120, 0.1), rgba(56, 178, 172, 0.1));
    border: 2px solid #48bb78;
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    margin-top: 1rem;
}

.spx-success-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.spx-success-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #48bb78, #38b2ac);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    animation: spx-success-bounce 0.6s ease-out;
}

@keyframes spx-success-bounce {
    0% { transform: scale(0); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.spx-success-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2d3748;
    margin: 0;
}

.spx-success-message {
    color: #4a5568;
    line-height: 1.6;
    margin: 0;
}

/* Error Card */
.spx-error-card {
    background: linear-gradient(135deg, rgba(229, 62, 62, 0.1), rgba(245, 87, 108, 0.1));
    border: 2px solid #e53e3e;
    border-radius: 16px;
    padding: 1.5rem;
    margin-top: 1rem;
}

.spx-error-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.spx-error-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.spx-error-text {
    color: #e53e3e;
    font-weight: 500;
    line-height: 1.5;
}

/* Loading Overlay */
.spx-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 16px;
}

.spx-loading-content {
    text-align: center;
    color: #4a5568;
}

.spx-loading-animation {
    position: relative;
    margin-bottom: 1rem;
}

.spx-loading-plane {
    font-size: 2rem;
    animation: spx-fly 2s ease-in-out infinite;
}

@keyframes spx-fly {
    0%, 100% { transform: translateX(-20px) rotate(-10deg); }
    50% { transform: translateX(20px) rotate(10deg); }
}

.spx-loading-path {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #667eea, transparent);
    border-radius: 1px;
    animation: spx-path 2s ease-in-out infinite;
}

@keyframes spx-path {
    0%, 100% { opacity: 0.3; transform: translateX(-50%) scaleX(0.5); }
    50% { opacity: 1; transform: translateX(-50%) scaleX(1); }
}

.spx-loading-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: #2d3748;
}

.spx-loading-desc {
    margin: 0;
    color: #718096;
}

/* ==========================================================================
   ORIGINAL CALCULATOR STYLES (BACKWARDS COMPATIBILITY)
   Maintaining compatibility with existing implementations
   ========================================================================== */

/* Main Container */
.speedex-calculator-container {
    max-width: none;
    width: 100%;
    margin: 0 auto 30px;
    padding: 40px 20px; 
    background-color: #f9f9f9;
    border-radius: 0; 
    box-shadow: none; 
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    direction: ltr;
    min-height: 100vh; 
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.speedex-form-wrapper {
    max-width: 800px;
    width: 100%;
    background-color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    padding: 30px;
    margin: 0 auto;
}

/* Title */
.speedex-calculator-title {
    text-align: center;
    margin-top: 0;
    margin-bottom: 25px;
    font-size: 24px;
    color: #333;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

/* Origin Display */
.speedex-calculator-origin {
    text-align: center;
    margin-bottom: 25px;
    padding: 20px;
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #e0e0e0;
}

.speedex-origin-info {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.speedex-origin-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 20px;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    border: 1px solid rgba(26, 115, 232, 0.2);
}

.speedex-origin-label {
    font-weight: 600;
    color: #555;
    font-size: 16px;
}

.speedex-origin-value {
    font-size: 20px;
    color: #1a73e8;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Route Selection Container */
.speedex-route-selection {
    width: 100%;
    max-width: 400px;
}

.speedex-route-selection .speedex-label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 600;
    font-size: 16px;
    text-align: center;
}

/* Enhanced Route Select Dropdown */
.speedex-route-select {
    width: 100%;
    padding: 14px 45px 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    background-color: #fff;
    font-size: 16px;
    color: #333;
    font-weight: 500;
    box-sizing: border-box;
    transition: all 0.3s ease;
    cursor: pointer;
}

.speedex-route-select:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
    transform: translateY(-1px);
}

.speedex-route-select:hover {
    border-color: #1a73e8;
    background-color: #fafbff;
}

/* Route Direction Indicator */
.speedex-route-indicator {
    display: inline-flex;
    align-items: center;
    margin-top: 8px;
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.speedex-route-indicator::before {
    content: "→";
    margin-right: 8px;
    font-weight: bold;
    color: #1a73e8;
    font-size: 16px;
}

.speedex-route-indicator.reverse::before {
    content: "←";
}

/* Form Layout */
.speedex-calculator-form {
    position: relative;
}

.speedex-row {
    margin-bottom: 20px;
}

/* Package Type Selector */
.speedex-package-selector {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    gap: 15px;
}

.speedex-package-option {
    flex: 1;
    text-align: center;
    padding: 15px 10px;
    background-color: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.speedex-package-option:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.speedex-package-option.selected {
    border-color: #1a73e8;
    background-color: #f0f7ff;
    box-shadow: 0 5px 15px rgba(26, 115, 232, 0.2);
}

.speedex-package-icon {
    height: 60px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.speedex-package-icon img {
    max-height: 100%;
    max-width: 100%;
}

.speedex-package-name {
    font-weight: 500;
    color: #333;
}

/* Labels */
.speedex-label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

.speedex-dimension-sublabel {
    font-size: 14px;
    font-weight: normal;
    color: #555;
}

.required {
    color: #d32f2f;
    margin-left: 2px;
}

/* Form Controls */
.speedex-select,
.speedex-input,
.speedex-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    background-color: #fff;
    font-size: 16px;
    color: #333;
    box-sizing: border-box;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.speedex-select:focus,
.speedex-input:focus,
.speedex-textarea:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

.speedex-select.error,
.speedex-input.error,
.speedex-textarea.error {
    border-color: #d32f2f;
    background-color: #fff6f6;
}

.speedex-textarea {
    min-height: 100px;
    resize: vertical;
}

/* Weight Slider */
.speedex-weight-slider-container {
    display: flex;
    align-items: center;
}

.speedex-weight-slider {
    flex-grow: 1;
    margin-right: 15px;
    height: 5px;
    background: #ddd;
    outline: none;
    opacity: 0.7;
    transition: opacity 0.2s;
    -webkit-appearance: none;
    border-radius: 2.5px;
}

.speedex-weight-slider:hover {
    opacity: 1;
}

.speedex-weight-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #1a73e8;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.speedex-weight-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #1a73e8;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    border: none;
}

.speedex-weight-display {
    display: flex;
    align-items: center;
    min-width: 100px;
}

.speedex-weight-input {
    width: 70px;
    padding: 8px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    text-align: right;
    font-size: 16px;
}

.speedex-weight-unit {
    margin-left: 5px;
    color: #555;
}

/* Dimensions */
.speedex-dimensions-container {
    background-color: #fff;
    padding: 15px;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.speedex-dimensions-label {
    margin-bottom: 10px;
    font-weight: 500;
    color: #333;
}

.speedex-dimensions-fields {
    display: flex;
    gap: 10px;
}

.speedex-dimension-field {
    flex: 1;
}

/* Freight Information */
.speedex-freight-container {
    background-color: #fff;
    padding: 15px;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.speedex-info-message {
    padding: 10px;
    background-color: #e8f0fe;
    border-radius: 4px;
    color: #1a73e8;
    margin-bottom: 15px;
    font-size: 14px;
    line-height: 1.5;
}

.speedex-freight-fields {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.speedex-freight-fields .speedex-field:last-child {
    grid-column: span 2;
}

/* Buttons */
.speedex-buttons-row {
    text-align: center;
    margin-top: 30px;
}

.speedex-button {
    display: inline-block;
    padding: 12px 30px;
    background-color: #1a73e8;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.speedex-button:hover {
    background-color: #1557b0;
    transform: translateY(-2px);
}

.speedex-button:active {
    transform: translateY(1px);
}

/* Results Container */
.speedex-results-container {
    margin-top: 30px;
    padding: 20px;
    background-color: #f1f8e9;
    border-left: 4px solid #7cb342;
    border-radius: 4px;
}

.speedex-result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px dashed #e0e0e0;
}

.speedex-result-row:last-child {
    border-bottom: none;
}

.speedex-result-label {
    font-weight: 500;
    color: #333;
}

.speedex-result-value {
    font-size: 18px;
    font-weight: 700;
    color: #1a73e8;
}

.speedex-currency {
    font-size: 16px;
    font-weight: normal;
    margin-left: 5px;
    color: #555;
}

.speedex-result-note {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
    font-size: 13px;
    color: #666;
    font-style: italic;
}

/* Volumetric Weight Info */
.speedex-volumetric-info {
    font-size: 14px;
}

.speedex-volumetric-info .speedex-result-label {
    font-weight: normal;
    color: #555;
}

.speedex-volumetric-info .speedex-result-value {
    font-size: 14px;
    font-weight: 500;
}

/* Freight Success Message */
.speedex-freight-success {
    margin-top: 30px;
    padding: 20px;
    background-color: #e8f5e9;
    border-radius: 6px;
    text-align: center;
}

.speedex-success-icon {
    display: inline-block;
    width: 40px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    background-color: #4caf50;
    color: white;
    border-radius: 50%;
    font-size: 24px;
    margin-bottom: 15px;
}

.speedex-success-message {
    color: #2e7d32;
    font-size: 16px;
}

/* Error Message */
.speedex-error-message {
    margin-top: 20px;
    padding: 12px 15px;
    background-color: #ffebee;
    border-left: 4px solid #d32f2f;
    color: #c62828;
    border-radius: 4px;
    font-size: 14px;
}

/* Loading Overlay */
.speedex-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    border-radius: 10px;
}

.speedex-loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(26, 115, 232, 0.2);
    border-radius: 50%;
    border-top-color: #1a73e8;
    animation: spin 1s ease-in-out infinite;
}

.speedex-loading-text {
    margin-top: 15px;
    color: #1a73e8;
    font-weight: 500;
}

.speedex-destination-loader {
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-left: 10px;
    border: 2px solid rgba(26, 115, 232, 0.2);
    border-radius: 50%;
    border-top-color: #1a73e8;
    animation: spin 1s ease-in-out infinite;
}

/* Specific selector overrides for better compatibility */
/* body .spx-input-wrapper .spx-input,
html body .spx-input-wrapper .spx-input,
body .spx-textarea-wrapper .spx-textarea,
html body .spx-textarea-wrapper .spx-textarea {
    padding-right: 48px !important;
    background: #ffffff !important;
    border: 2px solid #e5e7eb !important;
}
body .spx-input-wrapper .spx-input-icon,
html body .spx-input-wrapper .spx-input-icon,
body .spx-textarea-wrapper .spx-textarea-icon,
html body .spx-textarea-wrapper .spx-textarea-icon {
    position: absolute !important;
    right: 16px !important;
    z-index: 999 !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
} */

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   MODAL STYLES
   Modern modal interface for results and booking
   ========================================================================== */

/* Modal Base */
.speedex-modal,
.speedex-modal,
.speedex-centered-modal {
    display: none;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999999 !important;
    overflow-y: auto !important;
    justify-content: center !important;
    align-items: center !important;
    background-color: rgba(0, 0, 0, 0.5);
}


/* Fix modal z-index and position */
.speedex-modal.active,
.spx-modal.active,
.speedex-centered-modal.active {
    z-index: 9999999  !important; 
    position: fixed !important; 
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    overflow-y: auto !important; 
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

/* Modal Overlay for Enhanced Modals */
.spx-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    cursor: pointer;
}

.spx-modal-container {
    position: relative !important;
    z-index: 1 !important;
    width: 90% !important;
    max-width: 600px !important;
    max-height: 90vh !important;
    overflow-y: visible !important;
    pointer-events: none !important;
}



/* Modal Content */
.speedex-modal-content,
.spx-modal-content {
    position: relative !important;
    background-color: white;
    width: 90%;
    max-width: 500px;
    margin: auto;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2) !important;
    animation: speedexModalFadeIn 0.3s;
    max-height: 90vh !important; 
    overflow-y: auto !important;
    z-index: 10000000  !important;
    pointer-events: all;
}

.spx-modal-content {
    border-radius: 20px;
    overflow: visible;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    animation: spx-modal-slide-up 0.3s ease-out;
    max-height: 90vh;
    overflow-y: auto;
}

/* Ensure scrollbar is visible */
.speedex-modal-content,
.spx-modal-content {
    scrollbar-width: auto;
    -webkit-scrollbar-width: auto;
}

.speedex-modal-content::-webkit-scrollbar,
.spx-modal-content::-webkit-scrollbar {
    width: 12px;
    display: block;
}

.speedex-modal-content::-webkit-scrollbar-track,
.spx-modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 6px;
}

.speedex-modal-content::-webkit-scrollbar-thumb,
.spx-modal-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 6px;
}

.speedex-modal-content::-webkit-scrollbar-thumb:hover,
.spx-modal-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

@keyframes speedexModalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes spx-modal-slide-up {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modal Close Button */
.speedex-modal-close,
.spx-modal-close {
    position: absolute !important;
    top: 12px !important;
    left: 12px !important;
    font-size: 24px !important;
    color: #888 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    z-index: 10 !important;
    width: 30px !important;
    height: 30px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    background-color: #f5f5f5 !important;
}

.speedex-modal-close::before,
.spx-modal-close::before {
    content: "×" !important;
    font-size: 24px !important;
    line-height: 1 !important;
}

.speedex-modal-close:hover,
.spx-modal-close:hover {
    color: #333 !important;
    background-color: #e0e0e0 !important;
    transform: scale(1.1) !important;
}

.spx-modal-close {
    width: 40px !important;
    height: 40px !important;
    border: none !important;
    background: rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.3s ease !important;
    top: 1rem !important;
    left: 1rem !important;
    font-size: 28px !important;
}

.spx-modal-close::before {
    content: "×" !important;
    font-size: 28px !important;
    line-height: 1 !important;
}

.spx-modal-close:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    transform: scale(1.1) !important;
}

/* Modal Header */
.speedex-modal-header {
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 15px;
    margin-bottom: 20px;
    text-align: right;
    direction: rtl;
}

.speedex-modal-header h3 {
    margin-top: 0;
    color: #333;
    font-size: 20px;
    margin-bottom: 15px;
    font-weight: 600;
    text-align: right;
}

.spx-modal-header {
    position: relative;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    text-align: center;
    direction: rtl;
}

.spx-modal-title-section {
    margin-bottom: 1.5rem;
    text-align: center;
}

.spx-modal-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    direction: rtl;
}

.spx-modal-icon {
    font-size: 2rem;
}

.spx-modal-subtitle {
    margin: 0;
    opacity: 0.9;
    font-size: 1rem;
    text-align: center;
}

/* Results Section */
.spx-results-section {
    padding: 0 2rem 1rem 2rem;
    margin-top: -1rem;
    position: relative;
    z-index: 1;
}

.spx-cost-display {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
}

.spx-cost-label {
    font-size: 1rem;
    color: #718096;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.spx-cost-value {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.5rem;
}

.spx-cost-amount {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2d3748;
    order: 1; 
}

.spx-cost-currency {
    font-size: 1.25rem;
    color: #667eea;
    font-weight: 600;
    order: 0; 
}

.spx-weight-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.spx-weight-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #f7fafc;
    border-radius: 8px;
}

.spx-weight-label {
    font-size: 0.875rem;
    color: #4a5568;
}

.spx-weight-value {
    font-weight: 600;
    color: #2d3748;
}

.spx-disclaimer {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 12px;
    border-left: 4px solid #667eea;
	text-align: left;
	direction: ltr;
}

.spx-disclaimer-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
	direction: ltr;
}

.spx-disclaimer p {
    margin: 0;
    font-size: 0.875rem;
    color: #4a5568;
    line-height: 1.5;
}

/* Modal Results Container Styles */
.speedex-modal .speedex-results-container {
    margin: 10px 0;
    padding: 15px;
    background: linear-gradient(145deg, #f1f8e9, #e8f5e9);
    border-left: 3px solid #7cb342;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.speedex-modal .speedex-result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px dashed rgba(0, 0, 0, 0.1);
}

.speedex-modal .speedex-result-row:last-child {
    border-bottom: none;
}

.speedex-modal .speedex-result-label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.speedex-modal .speedex-result-value {
    font-size: 16px;
    font-weight: 700;
    color: #1a73e8;
}

.speedex-modal .speedex-volumetric-info {
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    padding: 8px 12px;
}

.speedex-modal .speedex-volumetric-info .speedex-result-label {
    font-weight: 500;
    color: #555;
    font-size: 14px;
}

.speedex-modal .speedex-volumetric-info .speedex-result-value {
    font-size: 14px;
    font-weight: 600;
    color: #666;
}

.speedex-modal .speedex-result-note {
    font-size: 11px; 
    color: #666;
    font-style: italic;
    text-align: center;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.speedex-modal .speedex-currency {
    font-size: 16px;
    font-weight: normal;
    margin-left: 5px;
    color: #555;
}

/* Modal Body */
.speedex-modal-body,
.spx-modal-body {
    padding-top: 5px;
    text-align: left;
    direction: ltr;
}

.spx-modal-body {
    padding: 2rem;
    text-align: left;
    direction: ltr;
}

.spx-booking-intro {
    text-align: center;
    margin-bottom: 2rem;
    direction: ltr;
}

.spx-booking-intro h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2d3748;
    margin: 0 0 0.5rem 0;
    text-align: center;
}

.spx-booking-intro p {
    margin: 0;
    color: #718096;
    text-align: center;
}

/* Booking Form */
.speedex-booking-form,
.spx-booking-form {
    display: contents !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 15px !important;
    direction: ltr !important;
    text-align: left !important;
}

.spx-booking-grid {
    display: contents !important;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)) !important;
    gap: 1rem !important;
    margin-bottom: 1.5rem !important;
    direction: ltr !important;
    text-align: left !important;
}

.speedex-booking-intro {
    margin-bottom: 15px !important;
    color: #555 !important;
    font-size: 14px !important;
    line-height: 1.6;
    text-align: center !important;
    direction: ltr !important;
}

.speedex-booking-field,
.spx-booking-field {
    margin-bottom: 0 !important;
    text-align: left !important;
    direction: ltr !important;
}

.speedex-booking-field.full-width,
.spx-field-full {
    grid-column: span 2;
}

.spx-field-full {
    grid-column: 1 / -1;
}

.speedex-booking-field .speedex-label,
.spx-booking-label {
    display: block !important;
    margin-bottom: 5px !important;
    color: #333 !important;
    font-weight: 600 !important;
    font-size: 13px !important;
    text-align: left !important;
    direction: ltr!important;
}

.spx-booking-label {
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    color: #2d3748 !important;
    margin-bottom: 0.5rem !important;
}

.speedex-booking-field .speedex-input,
.speedex-booking-field .speedex-textarea,
.spx-booking-input,
.spx-booking-textarea {
    width: 100% !important;
    padding: 10px 12px !important;
    border: 2px solid #e0e0e0 !important;
    border-radius: 6px !important;
    background-color: #fff !important;
    font-size: 14px !important;
    color: #333 !important;
    box-sizing: border-box !important;
    transition: all 0.3s ease !important;
    text-align: left !important;
    direction: ltr !important;
}

.spx-booking-textarea {
    padding: 0.875rem 1rem 0.875rem 3rem !important;
    border: 2px solid #e2e8f0 !important;
    border-radius: 12px !important;
    background: white !important;
    font-size: 1rem !important;
    color: #2d3748 !important;
    transition: all 0.3s ease !important;
    font-family: inherit !important;
    text-align: left !important;
    direction: ltr !important;
}

.speedex-booking-field .speedex-input:focus,
.speedex-booking-field .speedex-textarea:focus,
.spx-booking-input:focus,
.spx-booking-textarea:focus {
    outline: none !important;
    border-color: #1a73e8 !important;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.1) !important;
}

.spx-booking-input:focus,
.spx-booking-textarea:focus {
    border-color: #667eea !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
}

.speedex-booking-field .speedex-textarea,
.spx-booking-textarea {
    min-height: 60px !important;
    resize: vertical !important;
}

.spx-booking-textarea {
    min-height: 80px !important;
    resize: vertical !important;
}

/* Booking Input Wrappers */
.spx-booking-input-wrapper,
.spx-booking-textarea-wrapper {
    position: relative !important;
    direction: ltr !important;
}

.spx-booking-icon {
    position: absolute !important;
    right: 1rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    color: #718096 !important;
    pointer-events: none !important;
    font-size: 1.25rem !important;
}

/* Booking Actions */
.speedex-booking-footer,
.spx-booking-actions {
    grid-column: span 2;
    margin-top: 20px;
    text-align: center;
}

.spx-booking-actions {
    text-align: center;
    margin-bottom: 1rem;
}

.speedex-booking-button,
.spx-booking-submit {
    padding: 12px 30px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    /* background: linear-gradient(145deg, #1a73e8, #1557b0); */
    background: #FDCD0F !important;
    border: none !important;
    border-radius: 6px !important;
    color: white !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 3px 12px rgba(26, 115, 232, 0.3) !important;
}

.spx-booking-submit {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #48bb78 0%, #38b2ac 100%);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(72, 187, 120, 0.3);
}

.speedex-booking-button:hover,
.spx-booking-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(26, 115, 232, 0.4);
}

.spx-booking-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(72, 187, 120, 0.4);
}

.spx-booking-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Booking Loading */
.speedex-booking-loading,
.spx-booking-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    border-radius: 12px;
}

.spx-booking-loading {
    backdrop-filter: blur(5px);
    border-radius: 20px;
}

.spx-loading-dots {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.spx-dot {
    width: 12px;
    height: 12px;
    background: #667eea;
    border-radius: 50%;
    animation: spx-dot-bounce 1.4s ease-in-out infinite both;
}

.spx-dot:nth-child(1) { animation-delay: -0.32s; }
.spx-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes spx-dot-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Booking Success */
.speedex-booking-success,
.spx-booking-success {
    text-align: center;
    padding: 20px;
    grid-column: span 2;
}

.spx-booking-success {
    text-align: center;
    padding: 2rem;
}

.speedex-booking-success .speedex-success-icon,
.spx-success-animation {
    display: contents;
    width: 50px;
    height: 50px;
    line-height: 50px;
    text-align: center;
    background-color: #4caf50;
    color: white;
    border-radius: 50%;
    font-size: 24px;
    margin-bottom: 15px;
}

.spx-success-animation {
    margin-bottom: 1.5rem;
}

.spx-success-checkmark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #48bb78, #38b2ac);
    border-radius: 50%;
    color: white;
    animation: spx-success-bounce 0.6s ease-out;
}

.speedex-booking-success .speedex-success-message,
.spx-success-title {
    color: #2e7d32;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.5;
}

.spx-success-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2d3748;
    margin: 0 0 1rem 0;
}

.spx-success-message {
    color: #4a5568;
    line-height: 1.6;
    margin: 0;
}

/* Booking Error */
.speedex-booking-form .speedex-error-message,
.spx-booking-error {
    grid-column: span 2;
    margin-top: 10px;
}

.spx-booking-error {
    background: linear-gradient(135deg, rgba(229, 62, 62, 0.1), rgba(245, 87, 108, 0.1));
    border: 2px solid #e53e3e;
    border-radius: 12px;
    padding: 1rem;
    color: #e53e3e;
    font-weight: 500;
    text-align: center;
}

/* Package Type Badges for Admin */
.speedex-package-type {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
}

.speedex-package-type-document {
    background-color: #e3f2fd;
    color: #0277bd;
}

.speedex-package-type-parcel {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.speedex-package-type-freight {
    background-color: #fff3e0;
    color: #ef6c00;
}

/* Admin Filters */
.speedex-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.speedex-filters select {
    min-width: 150px;
}

/* Theme Variations */
.speedex-theme-dark {
    background-color: #2d2d2d;
    color: #f5f5f5;
}

.speedex-theme-dark .speedex-calculator-title {
    color: #f5f5f5;
    border-bottom-color: #444;
}

.speedex-theme-dark .speedex-calculator-origin,
.speedex-theme-dark .speedex-package-option,
.speedex-theme-dark .speedex-dimensions-container,
.speedex-theme-dark .speedex-freight-container {
    background-color: #3d3d3d;
    border-color: #4d4d4d;
}

.speedex-theme-dark .speedex-label,
.speedex-theme-dark .speedex-package-name,
.speedex-theme-dark .speedex-origin-value {
    color: #f5f5f5;
}

.speedex-theme-dark .speedex-origin-label,
.speedex-theme-dark .speedex-dimension-sublabel,
.speedex-theme-dark .speedex-weight-unit {
    color: #bbb;
}

.speedex-theme-dark .speedex-select,
.speedex-theme-dark .speedex-input,
.speedex-theme-dark .speedex-textarea {
    background-color: #2d2d2d;
    border-color: #4d4d4d;
    color: #f5f5f5;
}

.speedex-theme-dark .speedex-modal-content {
    background-color: #2d2d2d;
    color: #f5f5f5;
}

.speedex-theme-dark .speedex-modal-header h3 {
    color: #f5f5f5;
}

.speedex-theme-dark .speedex-modal .speedex-result-row {
    background-color: #3d3d3d;
}

.speedex-theme-dark .speedex-modal .speedex-result-label {
    color: #f5f5f5;
}

.speedex-theme-dark .speedex-booking-intro {
    color: #bbb;
}

.speedex-theme-dark .speedex-modal-close {
    color: #bbb;
}

.speedex-theme-dark .speedex-modal-close:hover {
    color: #f5f5f5;
}

.speedex-theme-dark .speedex-booking-loading {
    background-color: rgba(45, 45, 45, 0.8);
}

.speedex-theme-dark .speedex-modal .speedex-volumetric-info {
    background-color: #333;
}

.speedex-theme-blue {
    background-color: #e3f2fd;
}

.speedex-theme-blue .speedex-calculator-title {
    color: #0d47a1;
    border-bottom-color: #bbdefb;
}

.speedex-theme-blue .speedex-button {
    background-color: #1976d2;
}

.speedex-theme-blue .speedex-button:hover {
    background-color: #1565c0;
}

.speedex-theme-blue .speedex-package-option.selected {
    border-color: #1976d2;
    background-color: #e3f2fd;
}

/* Lock body scroll when modal is open */
body.speedex-modal-open {
    overflow: hidden !important;
    height: 100vh !important;
    position: relative !important;
}


/* Language Switcher */
.speedex-language-switcher {
    text-align: right;
    margin-bottom: 15px;
    padding: 5px 10px;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 4px;
}

.speedex-language-switcher a {
    text-decoration: none;
    color: #555;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.speedex-language-switcher a.active {
    background-color: #1a73e8;
    color: white;
}

.speedex-language-switcher .separator {
    margin: 0 5px;
    color: #999;
}

/* ==========================================================================
   RTL SUPPORT
   Right-to-left language support for Persian/Arabic
   ========================================================================== */

/* RTL General Adjustments */
.rtl .speedex-button {
    letter-spacing: 0;
    font-weight: bold;
}

.rtl .speedex-modal-content {
    text-align: right;
    direction: rtl;
}

.rtl input::placeholder,
.rtl textarea::placeholder {
    direction: rtl;
    text-align: right;
}

.rtl .speedex-calculator-origin {
    direction: rtl; 
}

.rtl .booking-reference-container {
    display: block;
    text-align: right;
    direction: rtl;
}

.rtl .booking-reference {
    font-weight: bold;
    direction: ltr; 
    display: inline-block;
    unicode-bidi: plaintext;
}

.rtl .speedex-freight-fields .speedex-field:last-child {
    direction: rtl;
}

.rtl .speedex-label {
    direction: rtl;
}

.rtl .speedex-row {
    direction: rtl;
}

.rtl .speedex-origin-label {
    direction: rtl;
}

/* RTL Weight Slider */
.rtl .speedex-weight-slider {
    margin-right: 0;
    margin-left: 15px;
    direction: rtl;
}

.rtl .speedex-weight-input {
    text-align: left;
}

.rtl .speedex-weight-unit {
    margin-left: 0;
    margin-right: 5px;
}

.rtl .speedex-weight-slider::-webkit-slider-thumb {
    transform: scaleX(-1);
}

.rtl .speedex-weight-slider::-moz-range-thumb {
    transform: scaleX(-1);
}

/* RTL Language Switcher */
.rtl .speedex-language-switcher {
    text-align: left;
}

/* RTL Enhanced Calculator */
.rtl .spx-calc-wrapper {
    direction: rtl;
}

.rtl .spx-calc-container{
    direction: rtl;
}

.rtl .spx-select-arrow {
    right: auto;
    left: 1rem;
}

/* .rtl .spx-input-suffix, */
.rtl .spx-input-icon,
.rtl .spx-textarea-icon,
.rtl .spx-booking-icon {
    left: 1rem !important;
    right: auto !important;

}

/* RTL Specific Styles - only for text inputs and textareas (not email/tel) */ 
.rtl .spx-input[type="text"], 
.rtl .spx-textarea, 
.rtl .spx-booking-input[type="text"], 
.rtl .spx-booking-textarea { 
    padding: 12px 16px 12px 48px !important; 
    text-align: right !important; 
    direction: rtl !important; 
}

/* RTL Placeholder alignment for text fields */ 
.rtl .spx-input[type="text"]::placeholder, 
.rtl .spx-textarea::placeholder,
.rtl input[name="name"]::placeholder,
.rtl input[id*="-name"]::placeholder { 
    text-align: right !important; 
    direction: rtl !important; 
}


/* Icon positioning for LTR fields in RTL context */ 
.rtl .spx-input-wrapper:has(input[type="email"]) .spx-input-icon,
.rtl .spx-input-wrapper:has(input[type="tel"]) .spx-input-icon { 
    right: 12px !important; 
    left: auto !important; 
}

/* Name field specific - should be RTL in Persian */ 
.rtl input[name="name"], 
.rtl input[id*="-name"] { 
    padding: 12px 16px 12px 48px !important; 
    text-align: right !important; 
    direction: rtl !important; 
}


/* Icon positioning for RTL */ 
.rtl .spx-input-wrapper .spx-input-icon { 
    right: auto !important; 
    left: 12px !important; 
}


.rtl .spx-select {
    padding: 0.875rem 1rem 0.875rem 3rem;
}

.rtl .spx-weight-unit {
    margin-left: 0;
    margin-right: 0.5rem;
}

.rtl .spx-label-text {
    margin-right: 0;
    margin-left: 0.25rem;
}

.rtl .spx-required {
    margin-left: 0;
    margin-right: 0.25rem;
}

.rtl .spx-modal-close {
    right: auto;
    left: 1rem;
}

.rtl .spx-booking-label {
    text-align: right !important;
    direction: rtl !important;
}

.rtl .spx-booking-grid {
    direction: rtl;
    text-align: right;
}

.rtl .speedex-booking-form,
.rtl .spx-booking-form {
    direction: rtl;
    text-align: right;
}

.rtl .spx-cost-currency {
	order: 2;
}

.rtl .spx-cost-value {
    direction: rtl;
}

.rtl .spx-cost-amount {
    order: 1; 
}

.rtl .spx-disclaimer {
	text-align: right;
	direction: rtl;
}

.rtl .spx-disclaimer-icon {
	direction: rtl;
}


.rtl .speedex-booking-field,
.rtl .spx-booking-field {
    text-align: right;
    direction: rtl;
}


.rtl .spx-booking-input-wrapper,
.rtl .spx-booking-textarea-wrapper {
    direction: rtl;
}

.rtl .spx-preset-btn {
	direction: rtl;
}

.rtl .spx-form-card,
.rtl .spx-origin-card {
	direction: rtl !important;
}

/* RTL Icon Position Fixes */
[dir="rtl"] .speedex-freight-search-icon,
.rtl .speedex-freight-search-icon,
[lang="fa"] .speedex-freight-search-icon {
    right: auto !important;
    left: 12px !important;
}

[dir="rtl"] .speedex-manual-input-suffix,
.rtl .speedex-manual-input-suffix,
[lang="fa"] .speedex-manual-input-suffix {
    right: auto !important;
    left: 16px !important;
}

[dir="rtl"] .speedex-settings-input-icon,
.rtl .speedex-settings-input-icon,
[lang="fa"] .speedex-settings-input-icon {
    right: auto !important;
    left: 14px !important;
}

[dir="rtl"] .speedex-settings-select-arrow,
.rtl .speedex-settings-select-arrow,
[lang="fa"] .speedex-settings-select-arrow {
    right: auto !important;
    left: 14px !important;
}

[dir="rtl"] .speedex-freight-search-input,
.rtl .speedex-freight-search-input,
[lang="fa"] .speedex-freight-search-input {
    padding-right: 15px !important;
    padding-left: 45px !important;
}

[dir="rtl"] [class*="speedex-"] input:not([class*="no-icon"]),
.rtl [class*="speedex-"] input:not([class*="no-icon"]),
[lang="fa"] [class*="speedex-"] input:not([class*="no-icon"]) {
    padding-right: 35px !important;
    padding-left: 40px !important;
}

[dir="rtl"] [class*="speedex-"] button [class*="icon"],
[dir="rtl"] [class*="speedex-"] .button [class*="icon"],
.rtl [class*="speedex-"] button [class*="icon"],
.rtl [class*="speedex-"] .button [class*="icon"],
[lang="fa"] [class*="speedex-"] button [class*="icon"],
[lang="fa"] [class*="speedex-"] .button [class*="icon"] {
    margin-right: 0 !important;
    margin-left: 8px !important;
}

[dir="rtl"] [class*="speedex-"] button,
[dir="rtl"] [class*="speedex-"] .button,
.rtl [class*="speedex-"] button,
.rtl [class*="speedex-"] .button,
[lang="fa"] [class*="speedex-"] button,
[lang="fa"] [class*="speedex-"] .button {
    flex-direction: row-reverse !important;
}

[dir="rtl"] [class*="speedex-action-arrow"],
[dir="rtl"] [class*="speedex-"] [class*="action-arrow"],
.rtl [class*="speedex-action-arrow"],
.rtl [class*="speedex-"] [class*="action-arrow"],
[lang="fa"] [class*="speedex-action-arrow"],
[lang="fa"] [class*="speedex-"] [class*="action-arrow"] {
    transform: scaleX(-1) !important;
}

[dir="rtl"] [class*="speedex-"] .breadcrumb::after,
.rtl [class*="speedex-"] .breadcrumb::after,
[lang="fa"] [class*="speedex-"] .breadcrumb::after {
    transform: scaleX(-1) !important;
}

[dir="rtl"] [class*="speedex-notice"] .close,
[dir="rtl"] [class*="speedex-"] [class*="notice"] .close,
.rtl [class*="speedex-notice"] .close,
.rtl [class*="speedex-"] [class*="notice"] .close,
[lang="fa"] [class*="speedex-notice"] .close,
[lang="fa"] [class*="speedex-"] [class*="notice"] .close {
    right: auto !important;
    left: 15px !important;
}

/* RTL Phone number, email and number styling */ 
.rtl .spx-field-group input[type="tel"], 
.rtl .spx-field-group input[type="email"],
.rtl .spx-field-group input[type="number"] { 
    direction: ltr !important; 
    text-align: left !important; 
    unicode-bidi: embed !important; 
    padding: 12px 48px 12px 16px !important; 
}



/* RTL Text field placeholders */
.rtl .spx-input[type="text"]::-webkit-input-placeholder,
.rtl input[name="name"]::-webkit-input-placeholder,
.rtl input[id*="-name"]::-webkit-input-placeholder {
    text-align: right !important;
    direction: rtl !important;
}

.rtl .spx-input[type="text"]::-moz-placeholder,
.rtl input[name="name"]::-moz-placeholder,
.rtl input[id*="-name"]::-moz-placeholder {
    text-align: right !important;
    direction: rtl !important;
}

.rtl .spx-input[type="text"]:-ms-input-placeholder,
.rtl input[name="name"]:-ms-input-placeholder,
.rtl input[id*="-name"]:-ms-input-placeholder {
    text-align: right !important;
    direction: rtl !important;
}

.rtl .spx-input[type="text"]:-moz-placeholder,
.rtl input[name="name"]:-moz-placeholder,
.rtl input[id*="-name"]:-moz-placeholder {
    text-align: right !important;
    direction: rtl !important;
}



/* ==========================================================================
   RESPONSIVE DESIGN
   Mobile and tablet optimizations
   ========================================================================== */

/* Tablet and Below (768px) */
@media screen and (max-width: 768px) {
    /* Enhanced Calculator Responsive */
    .spx-modal-content {
        width: 95vw;
        padding: 20px;
        font-size: 15px;
    }
    .spx-calc-wrapper {
        padding: 1rem 0;
    }
    
    .spx-main-title {
        font-size: 2rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .spx-title-icon {
        font-size: 1.5rem;
    }
    
    .spx-form-card,
    .spx-origin-card {
        padding: 1.5rem !important;
    }
    
    .spx-origin-content {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .spx-package-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
    
    .spx-package-card {
        padding: 1rem;
    }
    
    .spx-package-name {
        font-size: 1rem;
    }
    
    .spx-package-desc {
        font-size: 0.8rem;
    }
    
    .spx-weight-slider-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .spx-dimensions-grid {
        grid-template-columns: 1fr;
    }
    
    .spx-contact-grid {
        grid-template-columns: 1fr;
    }
    
    .spx-modal-container {
        width: 95%;
        max-height: 95vh;
    }
    
    .spx-modal-header,
    .spx-modal-body,
    .spx-results-section {
        padding: 1.5rem;
    }
    
    .spx-booking-grid {
        grid-template-columns: 1fr;
    }

    .spx-cost-amount {
        font-size: 2rem;
    }

    /* Original Calculator Responsive */
    .speedex-calculator-container {
        padding: 20px 15px;
        min-height: auto;
    }
    
    .speedex-form-wrapper {
        padding: 20px;
        margin: 0 10px;
    }
    
    .speedex-package-selector {
        flex-direction: column;
        gap: 15px;
    }
    
    .speedex-package-option {
        width: 100%;
    }
    
    .speedex-dimensions-fields {
        flex-direction: column;
    }
    
    .speedex-freight-fields {
        grid-template-columns: 1fr;
    }
    
    .speedex-freight-fields .speedex-field:last-child {
        grid-column: span 1;
    }
    
    .speedex-modal-content {
        position: relative !important;
        width: 100% !important;
        height: 100% !important;
        margin: 0 !important;
        padding: 20px !important;
        border-radius: 0 !important;
        overflow-y: auto !important;
        z-index: 2147483648 !important;
        background-color: #fff !important;
    }
    
    .speedex-modal,
    .speedex-centered-modal {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        z-index: 2147483647 !important; 
        background-color: rgba(0, 0, 0, 0.5);
    }

    .speedex-booking-form {
        grid-template-columns: 1fr; 
        gap: 12px;
    }

    .speedex-modal .speedex-result-row {
        padding: 8px 10px;
    }
    
    .speedex-modal .speedex-result-value {
        font-size: 18px;
    }
    
    .speedex-booking-button {
        width: 100%;
        padding: 12px 20px;
    }
    
    .speedex-modal-header h3 {
        font-size: 20px;
    }

    /* Admin Responsive */
    .speedex-filters {
        flex-direction: column;
        gap: 8px;
    }
    
    .speedex-filters select,
    .speedex-filters button {
        width: 100%;
    }
    
    .speedex-requests-table {
        display: block;
        overflow-x: auto;
    }
    
    .speedex-row-actions {
        flex-direction: column;
        gap: 5px;
    }
    
    .speedex-row-actions .button {
        width: 100%;
        text-align: center;
    }

    /* Route Selection Responsive */
    .speedex-calculator-origin {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .speedex-origin-info {
        gap: 15px;
    }
    
    .speedex-origin-display {
        flex-direction: column;
        gap: 8px;
        padding: 10px 15px;
    }
    
    .speedex-origin-label {
        font-size: 14px;
    }
    
    .speedex-origin-value {
        font-size: 18px;
    }
    
    .speedex-route-select {
        font-size: 14px;
        padding: 12px 40px 12px 14px;
        background-size: 16px;
        background-position: right 12px center;
    }
}

/* Mobile and Small Devices (480px and below) */
@media screen and (max-width: 480px) {
    /* Enhanced Calculator Mobile */
    .spx-calc-wrapper {
        padding: 0.5rem 0;
    }
    
    .spx-calc-container {
        padding: 0 0.5rem;
    }
    
    .spx-main-title {
        font-size: 1.75rem;
    }
    
    .spx-form-card,
    .spx-origin-card {
        padding: 1rem !important;
        margin-bottom: 1rem !important;
    }

    .spx-modal-container {
        width: 100%;
        height: 100%;
        max-height: 100vh;
    }
    
    .spx-modal-content {
        border-radius: 0;
        height: 100%;
        margin: 0;
        max-height: 100vh;
    }
    
    .spx-weight-presets {
        justify-content: center;
    }
    
    .spx-preset-btn {
        flex: 1;
        min-width: 60px;
    }
    
    .spx-package-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Original Calculator Mobile */
    .speedex-calculator-container {
        padding: 15px 10px;
    }
    
    .speedex-form-wrapper {
        padding: 15px;
        margin: 0 5px;
    }

    .speedex-result-row {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .speedex-result-value {
        margin-top: 5px;
    }
    
    .speedex-modal-content {
        position: relative !important;
        width: 100% !important;
        height: 100% !important;
        margin: 0 !important;
        padding: 20px !important;
        border-radius: 0 !important;
        overflow-y: auto !important;
        z-index: 2147483648 !important;
        background-color: #fff !important;
    }
    
    .speedex-modal,
    .speedex-centered-modal {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        z-index: 2147483647 !important; 
        background-color: rgba(0, 0, 0, 0.5);
    }
    
    .speedex-modal-header h3 {
        font-size: 18px;
        margin-bottom: 15px;
    }
    
    .speedex-modal .speedex-result-value {
        font-size: 16px;
    }
    
    .speedex-modal .speedex-result-label {
        font-size: 14px;
    }
    
    .speedex-booking-field {
        margin-bottom: 15px;
    }
    
    .speedex-booking-intro {
        font-size: 14px;
        margin-bottom: 15px;
    }
    
    .speedex-label {
        font-size: 14px;
    }
    
    .speedex-modal-close {
        top: 10px;
        right: 10px;
        font-size: 20px;
    }
    
    .speedex-booking-form {
        max-height: 60vh;
        overflow-y: auto;
        padding-right: 5px;
        padding-bottom: 40px;
    }

    .speedex-booking-field.full-width {
        grid-column: span 1;
    }
    
    .speedex-booking-footer {
        grid-column: span 1;
    }
    
    .speedex-booking-form .speedex-error-message {
        grid-column: span 1;
    }

    .speedex-modal-body {
        -webkit-overflow-scrolling: touch;
    }

    .speedex-booking-button {
        width: 100%;
        padding: 15px 20px;
    }

    /* Route Selection Mobile */
    .speedex-calculator-origin {
        padding: 12px;
    }
    
    .speedex-origin-display {
        padding: 8px 12px;
    }
    
    .speedex-origin-label {
        font-size: 13px;
    }
    
    .speedex-origin-value {
        font-size: 16px;
    }
    
    .speedex-route-selection .speedex-label {
        font-size: 14px;
    }

    /* RTL Mobile Fixes */
    .rtl .speedex-modal-close {
        right: auto;
        left: 10px;
    }

    .rtl .spx-modal-close {
        right: auto;
        left: 1rem;
    }

    /* Mobile Modal Scrolling Fix */
    .speedex-modal-content,
    .spx-modal-content {
        overflow-y: scroll !important;
        -webkit-overflow-scrolling: touch !important;
    }
}

/* ==========================================================================
   HIGH CONTRAST AND ACCESSIBILITY
   Support for high contrast mode and accessibility features
   ========================================================================== */

@media screen and (max-width: 480px) {
    body.speedex-modal-open .site-header,
    body.speedex-modal-open .main-header,
    body.speedex-modal-open .sticky-header,
    body.speedex-modal-open header,
    body.speedex-modal-open .menu {
        display: none !important;
    }
}


/* High Contrast Mode */
@media (prefers-contrast: high) {
    .spx-form-card,
    .spx-origin-card,
    .speedex-form-wrapper {
        border: 2px solid #000 !important;
    }
    
    .spx-select,
    .spx-input,
    .spx-textarea,
    .speedex-select,
    .speedex-input,
    .speedex-textarea {
        border: 2px solid #000;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================================================
   PRINT STYLES
   Optimized styles for printing
   ========================================================================== */

@media print {
    .spx-calc-wrapper,
    .speedex-calculator-container {
        background: white !important;
        color: black !important;
    }
    
    .spx-bg-elements,
    .spx-loading-overlay,
    .spx-modal,
    .speedex-loading-overlay,
    .speedex-modal {
        display: none !important;
    }
}

/* ==========================================================================
   IOS SAFARI SPECIFIC FIXES
   Compatibility fixes for iOS Safari browser
   ========================================================================== */

@supports (-webkit-overflow-scrolling: touch) {
    .speedex-modal-content,
    .spx-modal-content {
        -webkit-overflow-scrolling: touch;
    }
    
    .speedex-booking-form,
    .spx-booking-form {
        -webkit-overflow-scrolling: touch;
    }
}

/* ==========================================================================
   ENHANCED HOVER EFFECTS
   Additional hover and interaction effects
   ========================================================================== */

/* Enhanced hover effects for origin display */
.speedex-calculator-origin:hover,
.spx-origin-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

/* Animation for route change */
.speedex-route-select,
.spx-select {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.speedex-route-changing,
.spx-route-changing {
    transform: scale(0.98);
    opacity: 0.8;
}

/* Focus states for accessibility */
.speedex-route-select:focus-visible,
.spx-select:focus-visible {
    outline: 2px solid #1a73e8;
    outline-offset: 2px;
}

/* ==========================================================================
   UTILITIES AND HELPER CLASSES
   Utility classes for common operations
   ========================================================================== */

/* Visibility helpers */
.speedex-hidden {
    display: none !important;
}

.speedex-sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Text alignment helpers */
.speedex-text-center {
    text-align: center !important;
}

.speedex-text-left {
    text-align: left !important;
}

.speedex-text-right {
    text-align: right !important;
}

/* Margin and padding helpers */
.speedex-mt-0 { margin-top: 0 !important; }
.speedex-mb-0 { margin-bottom: 0 !important; }
.speedex-ml-0 { margin-left: 0 !important; }
.speedex-mr-0 { margin-right: 0 !important; }

.speedex-pt-0 { padding-top: 0 !important; }
.speedex-pb-0 { padding-bottom: 0 !important; }
.speedex-pl-0 { padding-left: 0 !important; }
.speedex-pr-0 { padding-right: 0 !important; }

/* ==========================================================================
   CUSTOM SCROLLBAR STYLES
   Enhanced scrollbar appearance - FIXED VERSION
   ========================================================================== */

/* Webkit Scrollbar - Force Visible */
.speedex-modal-content::-webkit-scrollbar,
.spx-modal-content::-webkit-scrollbar {
    width: 12px !important;
    display: block !important;
}

.speedex-modal-content::-webkit-scrollbar-track,
.spx-modal-content::-webkit-scrollbar-track {
    background: #f1f1f1 !important;
    border-radius: 6px !important;
}

.speedex-modal-content::-webkit-scrollbar-thumb,
.spx-modal-content::-webkit-scrollbar-thumb {
    background: #c1c1c1 !important;
    border-radius: 6px !important;
}

.speedex-modal-content::-webkit-scrollbar-thumb:hover,
.spx-modal-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8 !important;
}

/* Force scrollbar visibility */
.speedex-modal-content,
.spx-modal-content {
    scrollbar-width: thin !important;
    scrollbar-color: #c1c1c1 #f1f1f1 !important;
    overflow-y: scroll !important;
}

/* ==========================================================================
   DARK MODE SUPPORT (SYSTEM PREFERENCE)
   Automatic dark mode based on system preference
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .speedex-calculator-container:not(.speedex-theme-light) {
        background-color: #1a1a1a;
        color: #ffffff;
    }
    
    .speedex-form-wrapper:not(.speedex-theme-light) {
        background-color: #2d2d2d;
        border-color: #404040;
    }
    
    .speedex-select:not(.speedex-theme-light),
    .speedex-input:not(.speedex-theme-light),
    .speedex-textarea:not(.speedex-theme-light) {
        background-color: #1a1a1a;
        border-color: #404040;
        color: #ffffff;
    }
    
    .speedex-modal-content:not(.speedex-theme-light) {
        background-color: #2d2d2d;
        color: #ffffff;
    }
}

/* ==========================================================================
   LOADING STATES AND SKELETONS
   Enhanced loading state styles
   ========================================================================== */

/* Skeleton loading animation */
@keyframes skeleton-loading {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.speedex-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s infinite;
}

/* Pulse loading animation */
@keyframes pulse-loading {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.speedex-pulse {
    animation: pulse-loading 2s infinite;
}

/* ==========================================================================
   ERROR STATES AND VALIDATION
   Enhanced error and validation styles
   ========================================================================== */

/* Field validation states */
.speedex-field-valid {
    border-color: #48bb78 !important;
    box-shadow: 0 0 0 2px rgba(72, 187, 120, 0.2) !important;
}

.speedex-field-invalid {
    border-color: #e53e3e !important;
    box-shadow: 0 0 0 2px rgba(229, 62, 62, 0.2) !important;
}

/* Error message styling */
.speedex-field-error {
    color: #e53e3e;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.speedex-field-error::before {
    content: "⚠️";
    font-size: 0.75rem;
}

/* Success message styling */
.speedex-field-success {
    color: #48bb78;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.speedex-field-success::before {
    content: "✅";
    font-size: 0.75rem;
}

/* ==========================================================================
   PERFORMANCE OPTIMIZATIONS
   CSS optimizations for better performance
   ========================================================================== */

/* GPU acceleration for animations */
.speedex-package-option,
.spx-package-card,
.speedex-button,
.spx-calc-button {
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Contain layout changes */
.speedex-modal-content,
.spx-modal-content {
    contain: layout;
}

/* ==========================================================================
   FINAL COMPATIBILITY AND FALLBACKS
   Ensure compatibility across all browsers
   ========================================================================== */

/* Flexbox fallbacks */
.speedex-package-selector {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
}

/* Grid fallbacks */
@supports not (display: grid) {
    .speedex-freight-fields,
    .spx-booking-grid {
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
        -webkit-box-orient: vertical;
        -webkit-box-direction: normal;
        -ms-flex-direction: column;
        flex-direction: column;
    }
}

/* Backdrop filter fallbacks */
@supports not (backdrop-filter: blur(10px)) {
    .spx-form-card,
    .spx-origin-card {
        background: rgba(255, 255, 255, 0.98) !important;
    }
}

/* Custom properties fallbacks */
.speedex-button {
    background-color: #1a73e8; /* Fallback */
    background-color: var(--speedex-primary-color, #1a73e8);
}

/* ==========================================================================
   END OF STYLESHEET
   ========================================================================== */