/**
 * Create Ticket Modal - Ultra Responsive Design (v4.5 - Mobile First)
 * Optimized for iPhone 16 Pro Max & Safari Bottom Bar
 */

/* ========================================
   MODAL MOBILE-FIRST REDESIGN
======================================== */

#mec-ticket-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    /* Dynamic viewport height for Safari */
    z-index: 999999;
    padding: 0;
    margin: 0;
    display: none;
    align-items: flex-end;
    /* Slide up from bottom on mobile */
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(12px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#mec-ticket-modal.active {
    display: flex;
}

#mec-ticket-modal .mec-modal-content {
    width: 100%;
    max-width: 600px;
    height: 92vh;
    height: 92dvh;
    background: #ffffff;
    border-radius: 32px 32px 0 0;
    /* Premium rounded corners at top */
    box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    animation: slideUpSpring 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
    margin: 0 auto;
}

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

    to {
        transform: translateY(0);
    }
}

/* Header Tweaks */
#mec-ticket-modal .mec-modal-header {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    padding: clamp(18px, 4vw, 24px) 20px;
    border-radius: 32px 32px 0 0;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: none;
}

#mec-ticket-modal .mec-modal-title {
    font-size: clamp(20px, 5vw, 24px) !important;
    font-weight: 800;
    letter-spacing: -0.5px;
}

/* Close Button Position */
#mec-ticket-modal .mec-modal-close {
    top: 50% !important;
    right: 20px !important;
    transform: translateY(-50%) !important;
}

/* Body Optimizations */
#mec-ticket-modal .mec-modal-body {
    padding: 24px 20px 160px 20px;
    /* Extra padding for sticky footer + safe area */
    flex: 1;
    overflow-y: auto;
    background: #f8fafc;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Custom Body Scrollbar */
#mec-ticket-modal .mec-modal-body::-webkit-scrollbar {
    width: 5px;
}

#mec-ticket-modal .mec-modal-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

/* Form Groups & Labels */
#mec-ticket-modal .mec-form-group {
    margin-bottom: 24px;
    width: 100%;
}

#mec-ticket-modal label {
    font-size: 14px;
    font-weight: 700;
    color: #475569;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Inputs - iPhone Optimized */
#mec-ticket-modal .mec-input {
    height: 58px;
    /* High-touch target for iPhone */
    border-radius: 16px;
    padding: 0 20px;
    font-size: 16px;
    /* CRITICAL: Prevents iOS Safari from auto-zooming */
    border: 2px solid #e2e8f0;
    background: #ffffff;
    color: #1e293b;
    width: 100%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

#mec-ticket-modal .mec-input:focus {
    border-color: #6366f1;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1), 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    outline: none;
}

#mec-ticket-modal textarea.mec-input {
    height: auto;
    padding: 16px 20px;
    line-height: 1.6;
}

/* Grid Layout Improvements */
.mec-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 0;
}

/* Checkbox Groups - Modern Card Look */
#mec-ticket-modal .mec-checkbox-group {
    padding: 20px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    border: 2px solid transparent;
    transition: all 0.2s;
    cursor: pointer;
}

#mec-ticket-modal .mec-checkbox-group input[type="checkbox"] {
    width: 24px;
    height: 24px;
    accent-color: #6366f1;
    flex-shrink: 0;
}

#mec-ticket-modal .mec-checkbox-group label {
    margin: 0 !important;
    text-transform: none;
    letter-spacing: normal;
    font-size: 16px;
    color: inherit;
}

/* Advanced Options - Safari Clean Look */
.mec-advanced-options {
    margin-top: 10px;
    border-top: 1px solid #e2e8f0;
}

.mec-advanced-options summary {
    padding: 24px 0;
    color: #6366f1;
    font-size: 15px;
    font-weight: 800;
}

/* Fixed Thumb-Friendly Footer (Safari Optimized) */
#mec-ticket-modal .mec-modal-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    padding: 20px 20px calc(24px + env(safe-area-inset-bottom));
    /* Account for iPhone safe area + bottom bar */
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 12px;
    z-index: 100;
}

#mec-ticket-modal .mec-modal-footer .mec-btn {
    flex: 1;
    height: 60px;
    /* Large thumb target */
    border-radius: 20px;
    font-size: 16px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s;
}

#mec-ticket-modal .mec-btn-primary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.3);
    color: white !important;
    border: none;
}

#mec-ticket-modal .mec-btn-outline {
    background: #ffffff !important;
    color: #64748b !important;
    border: 2px solid #e2e8f0 !important;
}

/* Desktop Fixes */
@media (min-width: 769px) {
    #mec-ticket-modal {
        align-items: center;
        padding: 40px;
    }

    #mec-ticket-modal .mec-modal-content {
        height: auto;
        max-height: 85vh;
        border-radius: 24px;
        margin: auto;
    }

    #mec-ticket-modal .mec-modal-body {
        padding-bottom: 24px;
    }

    #mec-ticket-modal .mec-modal-footer {
        position: static;
        padding: 24px;
    }
}

/* iPhone Specific Safari Fixes */
@supports (-webkit-touch-callout: none) {
    #mec-ticket-modal .mec-modal-content {
        height: -webkit-fill-available;
        max-height: 94dvh;
    }
}