/**
 * Dynamic Modal Component Styles
 * Responsive modal that transforms into action sheet on mobile
 */

/* ===== BASE MODAL STYLES ===== */

.dynamic-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

.dynamic-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.dynamic-modal.closing {
    animation: fadeOut 0.3s ease;
}

.dynamic-modal.closing .dynamic-modal-container {
    animation: slideDown 0.3s ease;
}

.dynamic-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    cursor: pointer;
}

.dynamic-modal-container {
    position: relative;
    background: #ffffff;
    border-radius: 24px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    z-index: 1;
}

.dynamic-modal-container.small {
    max-width: 400px;
    width: 90%;
}

.dynamic-modal-container.medium {
    max-width: 600px;
    width: 90%;
}

.dynamic-modal-container.large {
    max-width: 800px;
    width: 95%;
}

.dynamic-modal-container.full {
    max-width: 100%;
    width: 100%;
    height: 100%;
    margin: 0;
    border-radius: 0;
}

.dynamic-modal-content {
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

/* ===== MODAL HEADER ===== */

.dynamic-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 32px 16px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.dynamic-modal-title {
    font-size: 24px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
    line-height: 1.3;
}

.dynamic-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: #f8f9fa;
    border-radius: 12px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.dynamic-modal-close:hover {
    background: #e9ecef;
    color: #333;
    transform: scale(1.05);
}

/* ===== MODAL BODY ===== */

.dynamic-modal-body {
    padding: 24px 32px;
    overflow-y: auto;
    flex: 1;
}

/* ===== MODAL FOOTER ===== */

.dynamic-modal-footer {
    padding: 16px 32px 24px;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
}

/* ===== CAR SELECTION STYLES ===== */

.car-selection-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.car-selection-item {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border: 2px solid #f0f0f0;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #ffffff;
}

.car-selection-item:hover {
    border-color: #000;
    background: #f8fbff;
}

.car-selection-item.selected {
    border-color: #000;
    background: #f0f8ff;
}

.car-image-container {
    width: 80px;
    height: 50px;
    margin-right: 16px;
    flex-shrink: 0;
}

.car-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.car-info {
    flex: 1;
}

.car-name {
    font-size: 18px;
    font-weight: 500;
    color: #1a1a1a;
    margin: 0 0 4px 0;
}

.car-description {
    font-size: 14px;
    color: #666;
    margin: 0;
}

.car-selection-indicator {
    width: 24px;
    height: 24px;
    color: #000;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.car-selection-item.selected .car-selection-indicator {
    opacity: 1;
}

/* ===== BOOKING FORM STYLES ===== */

.booking-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-field-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-field-label {
    font-size: 16px;
    font-weight: 500;
    color: #1a1a1a;
}

.form-field-input {
    padding: 16px 20px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    font-size: 16px;
    background: #ffffff;
    transition: border-color 0.2s ease;
}

.form-field-select-wrapper {
    position: relative;
    cursor: pointer;
}

.form-field-select {
    cursor: pointer;
    padding-right: 50px;
}

.form-field-arrow {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    pointer-events: none;
}

.verification-code-wrapper {
    display: flex;
    gap: 12px;
}

.verification-input {
    flex: 1;
}

.form-privacy-section {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
}

.privacy-text {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
    margin: 0 0 16px 0;
}

.privacy-checkbox-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
}

.privacy-checkbox {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
}

.privacy-label {
    font-size: 14px;
    color: #333;
    line-height: 1.4;
}

.modal-btn {
    padding: 16px 32px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-btn-primary {
    background: #1a1a1a;
    color: white;
    width: 100%;
}

.modal-btn-primary:hover {
    background: #333;
    transform: translateY(-1px);
}

/* ===== ANIMATIONS ===== */

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes slideDown {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    to {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
}

@keyframes slideUpMobile {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

@keyframes slideDownMobile {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(100%);
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(0);
    }
}

@keyframes slideOutLeft {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(-100%);
    }
}

/* ===== LOADING STATES ===== */

.dynamic-modal.loading .dynamic-modal-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* ===== MOBILE RESPONSIVE STYLES ===== */

@media (max-width: 768px) {

    /* Transform to action sheet on mobile */
    .dynamic-modal[data-mobile-style="action-sheet"] {
        align-items: flex-end;
    }

    .dynamic-modal[data-mobile-style="action-sheet"] .dynamic-modal-container {
        width: 100%;
        max-width: none;
        max-height: 85vh;
        border-radius: 24px 24px 0 0;
        animation: slideUpMobile 0.3s ease;
        margin: 0;
    }

    .dynamic-modal[data-mobile-style="action-sheet"].closing .dynamic-modal-container {
        animation: slideDownMobile 0.3s ease;
    }

    /* Slide from left for mobile menu */
    .dynamic-modal[data-mobile-style="slide-left"] {
        align-items: stretch;
        justify-content: flex-start;
    }

    .dynamic-modal[data-mobile-style="slide-left"] .dynamic-modal-container {
        width: 85%;
        max-width: 320px;
        height: 100%;
        max-height: none;
        border-radius: 0;
        animation: slideInLeft 0.3s ease;
        margin: 0;
    }

    .dynamic-modal[data-mobile-style="slide-left"].closing .dynamic-modal-container {
        animation: slideOutLeft 0.3s ease;
    }

    .dynamic-modal[data-mobile-style="slide-left"] .dynamic-modal-content {
        height: 100vh;
        max-height: 100vh;
    }

    .dynamic-modal[data-mobile-style="slide-left"] .dynamic-modal-header {
        display: none;
        /* Hide header for mobile menu as it has its own logo */
    }

    .dynamic-modal[data-mobile-style="slide-left"] .dynamic-modal-body {
        padding: 0;
        overflow-y: auto;
        height: 100vh;
        max-height: 100vh;
    }

    /* Full screen for mobile menu */
    .dynamic-modal[data-mobile-style="full-screen"] {
        align-items: stretch;
        justify-content: stretch;
    }

    .dynamic-modal[data-mobile-style="full-screen"] .dynamic-modal-container {
        width: 100%;
        max-width: none;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        animation: fadeIn 0.2s ease;
        margin: 0;
    }

    .dynamic-modal[data-mobile-style="full-screen"].closing .dynamic-modal-container {
        animation: fadeOut 0.2s ease;
    }

    .dynamic-modal[data-mobile-style="full-screen"] .dynamic-modal-content {
        height: 100vh;
        max-height: 100vh;
    }

    .dynamic-modal[data-mobile-style="full-screen"] .dynamic-modal-header {
        display: none;
        /* Hide header for mobile menu as it has its own logo */
    }

    .dynamic-modal[data-mobile-style="full-screen"] .dynamic-modal-body {
        padding: 0;
        overflow-y: auto;
        height: 100vh;
        max-height: 100vh;
    }

    .dynamic-modal-header {
        padding: 20px 24px 12px;
        position: relative;
    }

    .dynamic-modal-header::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 4px;
        background: #e0e0e0;
        border-radius: 2px;
    }

    .dynamic-modal-title {
        font-size: 20px;
        text-align: center;
    }

    .dynamic-modal-close {
        position: absolute;
        right: 24px;
        top: 50%;
        transform: translateY(-50%);
        width: 32px;
        height: 32px;
    }

    .dynamic-modal-body {
        padding: 16px 24px;
    }

    .dynamic-modal-footer {
        padding: 12px 24px 32px;
    }

    /* Car selection mobile adjustments */
    .car-selection-item {
        padding: 12px 16px;
    }

    .car-image-container {
        width: 60px;
        height: 40px;
        margin-right: 12px;
    }

    .car-name {
        font-size: 16px;
    }

    /* Form mobile adjustments */
    .form-field-input {
        padding: 14px 16px;
        font-size: 16px;
        /* Prevent zoom on iOS */
    }

    .verification-code-wrapper {
        flex-direction: column;
        gap: 8px;
    }

    .verification-btn {
        padding: 14px 16px;
    }

    /* Improve touch targets on mobile */
    .car-selection-item,
    .form-field-select-wrapper,
    .privacy-checkbox-wrapper {
        min-height: 48px;
        display: flex;
        align-items: center;
    }

    /* Better spacing for mobile forms */
    .booking-form {
        gap: 16px;
    }

    .form-privacy-section {
        padding: 16px;
        margin-top: 8px;
    }

    /* Prevent zoom on input focus for iOS */
    .form-field-input,
    .form-field-select {
        font-size: 16px !important;
    }

    /* Better modal positioning on small screens */
    .dynamic-modal[data-mobile-style="action-sheet"] .dynamic-modal-container {
        max-height: 90vh;
        min-height: 200px;
    }

    /* Ensure content is scrollable on very small screens */
    .dynamic-modal-body {
        max-height: calc(90vh - 120px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}