/* ==========================================================================
   Frontend Booking Form Styles - Đặt xe Online
   Premium Modern Design with Animations
   ========================================================================== */

:root {
    --dxo-primary: #1877f2;    /* Facebook Blue */
    --dxo-primary-dark: #166fe5;
    --dxo-secondary: #42b72a;  /* Facebook Green for accent */
    --dxo-success: #48bb78;
    --dxo-danger: #f56565;
    --dxo-text: #2d3748;
    --dxo-text-light: #718096;
    --dxo-border: #dfe3e8;
    --dxo-bg: #f0f2f5;        /* Facebook Background */
    --dxo-white: #ffffff;
    --dxo-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), 0 8px 16px rgba(0, 0, 0, 0.1);
    --dxo-shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.15);
    --dxo-radius: 8px;
    --dxo-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Main Wrapper */
.dxo-booking-form-wrapper {
    max-width: 800px;
    margin: 40px auto;
    padding: 0 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.dxo-booking-form-container {
    background: var(--dxo-white);
    border-radius: var(--dxo-radius);
    box-shadow: var(--dxo-shadow);
    overflow: hidden;
    animation: fadeInUp 0.6s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Tabs */
.dxo-tabs {
    display: flex;
    background: var(--dxo-primary);
    padding: 0;
}

.dxo-tab-btn {
    flex: 1;
    padding: 20px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--dxo-transition);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.dxo-tab-btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--dxo-white);
    transform: scaleX(0);
    transition: var(--dxo-transition);
}

.dxo-tab-btn.active {
    color: var(--dxo-white);
}

.dxo-tab-btn.active::after {
    transform: scaleX(1);
}

.dxo-tab-btn:hover {
    color: var(--dxo-white);
    background: rgba(255, 255, 255, 0.1);
}

.dxo-tab-icon {
    font-size: 24px;
}

/* Form */
.dxo-form {
    padding: 40px;
}

.dxo-tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

.dxo-tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Form Grid */
.dxo-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.dxo-form-group {
    margin-bottom: 0;
}

.dxo-form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--dxo-text);
    margin-bottom: 10px;
    font-size: 14px;
}

.dxo-label-icon {
    font-size: 18px;
}

.required {
    color: var(--dxo-danger);
}

/* Input Styles */
.dxo-form input[type="text"],
.dxo-form input[type="email"],
.dxo-form input[type="tel"],
.dxo-form input[type="datetime-local"],
.dxo-form select,
.dxo-form textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--dxo-border);
    border-radius: 10px;
    font-size: 15px;
    color: var(--dxo-text);
    transition: var(--dxo-transition);
    background: var(--dxo-white);
}

.dxo-form input:focus,
.dxo-form select:focus,
.dxo-form textarea:focus {
    outline: none;
    border-color: var(--dxo-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.dxo-form textarea {
    resize: vertical;
    min-height: 80px;
}

/* Distance Info */
.dxo-distance-info {
    margin: 20px 0;
    animation: slideDown 0.4s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 100px;
    }
}

.dxo-distance-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--dxo-primary);
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.dxo-distance-icon {
    font-size: 20px;
}

/* Price Display */
.dxo-price-display {
    background: var(--dxo-primary);
    padding: 30px;
    border-radius: 12px;
    margin: 30px 0;
    text-align: center;
    color: white;
    animation: scaleIn 0.4s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.dxo-price-label {
    font-size: 16px;
    margin-bottom: 10px;
    opacity: 0.9;
}

.dxo-price-value {
    font-size: 42px;
    font-weight: bold;
    margin-bottom: 15px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.dxo-price-breakdown {
    font-size: 14px;
    opacity: 0.9;
    line-height: 1.8;
}

.dxo-price-breakdown div {
    margin: 5px 0;
}

/* Form Note */
.dxo-form-note {
    background: #fef5e7;
    border-left: 4px solid #f39c12;
    padding: 15px 20px;
    border-radius: 8px;
    margin: 20px 0;
    color: #7d6608;
    line-height: 1.6;
}

.dxo-form-note p {
    margin: 8px 0;
}

/* Submit Button */
.dxo-form-actions {
    margin-top: 30px;
}

.dxo-submit-btn {
    width: 100%;
    padding: 18px 32px;
    background: var(--dxo-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--dxo-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.dxo-submit-btn:hover {
    background: var(--dxo-primary-dark);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25);
}

.dxo-submit-btn:active {
    transform: translateY(0);
}

.dxo-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.dxo-btn-icon {
    font-size: 24px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

/* Success Message */
.dxo-success-message {
    padding: 60px 40px;
    text-align: center;
    animation: fadeIn 0.5s ease;
}

.dxo-success-icon {
    font-size: 80px;
    margin-bottom: 20px;
    animation: successPop 0.6s ease;
}

@keyframes successPop {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

.dxo-success-message h3 {
    color: var(--dxo-success);
    font-size: 28px;
    margin-bottom: 15px;
}

.dxo-success-message p {
    color: var(--dxo-text-light);
    margin: 10px 0;
    font-size: 16px;
}

.dxo-order-code {
    font-weight: bold;
    color: var(--dxo-primary);
    font-size: 18px;
}

.dxo-btn-secondary {
    padding: 12px 32px;
    background: white;
    color: var(--dxo-primary);
    border: 2px solid var(--dxo-primary);
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--dxo-transition);
    margin-top: 20px;
}

.dxo-btn-secondary:hover {
    background: var(--dxo-primary);
    color: white;
}

/* Loading State */
.dxo-loading {
    position: relative;
    pointer-events: none;
}

.dxo-loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    z-index: 10;
}

.dxo-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--dxo-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 11;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .dxo-form {
        padding: 30px 20px;
    }
    
    .dxo-form-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .dxo-tab-label {
        display: none;
    }
    
    .dxo-tab-btn {
        padding: 15px;
    }
    
    .dxo-price-value {
        font-size: 32px;
    }
    
    .dxo-submit-btn {
        font-size: 16px;
        padding: 15px 24px;
    }
}

/* Autocomplete Styling */
.pac-container {
    border-radius: 8px;
    margin-top: 5px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border: none;
    font-family: inherit;
}

.pac-item {
    padding: 12px 16px;
    border-top: 1px solid var(--dxo-border);
    cursor: pointer;
}

.pac-item:hover {
    background: var(--dxo-bg);
}

.pac-icon {
    margin-top: 4px;
}

/* Micro-animations */
.dxo-form input:not(:placeholder-shown),
.dxo-form select:valid,
.dxo-form textarea:not(:placeholder-shown) {
    border-color: var(--dxo-success);
}

/* Focus visible for accessibility */
.dxo-form input:focus-visible,
.dxo-form select:focus-visible,
.dxo-form textarea:focus-visible,
.dxo-submit-btn:focus-visible {
    outline: 3px solid var(--dxo-primary);
    outline-offset: 2px;
}

/* ==========================================================================
   Location Picker Modal
   ========================================================================== */

/* Input with Map Icon */
.dxo-location-input-wrapper {
    position: relative;
}

.dxo-location-input-wrapper input {
    padding-right: 45px;
    cursor: text; /* Allow typing */
}

.dxo-location-input-wrapper .dxo-map-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    color: var(--dxo-primary);
    pointer-events: auto; /* Enable clicking */
    cursor: pointer; /* Show it's clickable */
    opacity: 0.7;
    transition: var(--dxo-transition);
}

.dxo-location-input-wrapper:hover .dxo-map-icon {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

/* Modal Overlay */
.dxo-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    animation: fadeIn 0.3s ease;
    backdrop-filter: blur(4px);
}

.dxo-modal-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Modal Container */
.dxo-location-modal {
    background: var(--dxo-white);
    border-radius: var(--dxo-radius);
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--dxo-shadow-lg);
    display: flex;
    flex-direction: column;
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modal Header */
.dxo-modal-header {
    background: var(--dxo-primary);
    color: white;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.dxo-modal-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dxo-modal-title-icon {
    font-size: 24px;
}

.dxo-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 28px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--dxo-transition);
    line-height: 1;
    padding: 0;
}

.dxo-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Modal Body */
.dxo-modal-body {
    flex: 1;
    overflow: auto;
    display: flex;
    flex-direction: column;
}

/* Search Section */
.dxo-modal-search {
    padding: 20px 24px;
    background: var(--dxo-bg);
    border-bottom: 2px solid var(--dxo-border);
    flex-shrink: 0;
}

.dxo-modal-search-wrapper {
    position: relative;
}

.dxo-modal-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    color: var(--dxo-text-light);
    pointer-events: none;
}

.dxo-modal-search input {
    width: 100%;
    padding: 16px 20px 16px 50px;
    border: 2px solid var(--dxo-border);
    border-radius: 12px;
    font-size: 16px;
    background: var(--dxo-white);
    transition: var(--dxo-transition);
}

.dxo-modal-search input:focus {
    outline: none;
    border-color: var(--dxo-primary);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

/* Map Container */
.dxo-modal-map {
    flex: 1;
    min-height: 400px;
    position: relative;
    background: #e5e3df;
}

.dxo-modal-map-inner {
    width: 100%;
    height: 100%;
    min-height: 400px;
}

/* Map Loading */
.dxo-map-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--dxo-text-light);
}

.dxo-map-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--dxo-border);
    border-top-color: var(--dxo-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

/* Selected Address Display */
.dxo-modal-selected {
    padding: 16px 24px;
    background: var(--dxo-white);
    border-top: 2px solid var(--dxo-border);
    flex-shrink: 0;
}

.dxo-modal-selected-label {
    font-size: 13px;
    color: var(--dxo-text-light);
    margin-bottom: 6px;
    font-weight: 600;
}

.dxo-modal-selected-address {
    font-size: 15px;
    color: var(--dxo-text);
    font-weight: 500;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.dxo-modal-selected-icon {
    color: var(--dxo-primary);
    margin-top: 2px;
    flex-shrink: 0;
}

/* Modal Footer */
.dxo-modal-footer {
    padding: 20px 24px;
    background: var(--dxo-bg);
    border-top: 2px solid var(--dxo-border);
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

.dxo-modal-btn {
    flex: 1;
    padding: 14px 24px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--dxo-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.dxo-modal-btn-cancel {
    background: var(--dxo-white);
    color: var(--dxo-text);
    border: 2px solid var(--dxo-border);
}

.dxo-modal-btn-cancel:hover {
    background: var(--dxo-bg);
    border-color: var(--dxo-text-light);
}

.dxo-modal-btn-confirm {
    background: var(--dxo-primary);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.dxo-modal-btn-confirm:hover {
    background: var(--dxo-primary-dark);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.dxo-modal-btn-confirm:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Map Marker Instruction */
.dxo-map-instruction {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 12px 20px;
    border-radius: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    font-weight: 600;
    color: var(--dxo-text);
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: bounce 2s infinite;
}

.dxo-map-instruction-icon {
    font-size: 18px;
}

/* Responsive */
@media (max-width: 768px) {
    .dxo-modal-overlay.active {
        padding: 0;
        align-items: flex-end;
    }
    
    .dxo-location-modal {
        max-width: 100%;
        max-height: 95vh;
        border-radius: var(--dxo-radius) var(--dxo-radius) 0 0;
        animation: slideUpMobile 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    @keyframes slideUpMobile {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }
    
    .dxo-modal-header {
        padding: 16px 20px;
    }
    
    .dxo-modal-title {
        font-size: 18px;
    }
    
    .dxo-modal-search,
    .dxo-modal-selected,
    .dxo-modal-footer {
        padding: 16px 20px;
    }
    
    .dxo-modal-map {
        min-height: 300px;
    }
    
    .dxo-modal-map-inner {
        min-height: 300px;
    }
    
    .dxo-modal-footer {
        flex-direction: column-reverse;
    }
    
    .dxo-map-instruction {
        top: 10px;
        font-size: 13px;
        padding: 10px 16px;
    }
}

/* Accessibility */
.dxo-modal-overlay:focus-within .dxo-location-modal {
    outline: 3px solid var(--dxo-primary);
    outline-offset: -3px;
}
