/**
 * Organizer Dashboard - Design Fixes
 * Fixes for select text overflow and modal button visibility
 * @version 1.0.0
 */

/* ========================================
   SELECT ELEMENT FIX - TEXT OVERFLOW
======================================== */
.mec-organizer-dashboard select,
.mec-organizer-dashboard .mec-input-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%234b5563%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 12px;
    padding: 14px 45px 14px 16px !important;
    cursor: pointer;
    min-height: 50px;
    width: 100%;
    box-sizing: border-box;
    line-height: 1.4;
    font-size: 15px;
}

.mec-organizer-dashboard select option {
    padding: 14px 16px;
    white-space: normal;
    background: white;
    color: #1f2937;
    line-height: 1.5;
    font-size: 15px;
}

/* Specific fix for event selector - ensure minimum width */
#mec-ticket-manager-event-select,
#mec-booth-event-select,
#mec_bo_event_id {
    min-width: 250px;
    max-width: 100%;
}

/* Mobile adjustments */
@media (max-width: 768px) {

    .mec-organizer-dashboard select,
    .mec-organizer-dashboard .mec-input-select {
        min-height: 52px;
        font-size: 16px;
        padding: 16px 50px 16px 18px !important;
    }
}

/* ========================================
   MODAL BUTTON IMPROVEMENTS - MOBILE
======================================== */
@media (max-width: 768px) {
    .mec-modal-footer {
        flex-direction: column-reverse;
        gap: 12px;
    }

    .mec-modal-footer .mec-btn {
        width: 100%;
        min-height: 48px;
        font-size: 15px;
    }

    .mec-modal-body {
        max-height: calc(85vh - 200px);
        max-height: calc(85dvh - 200px);
    }
}

/* Ensure buttons in modal are always visible */
.mec-modal-footer .mec-btn-outline {
    order: 2;
}

.mec-modal-footer .mec-btn-primary {
    order: 1;
}

@media (max-width: 480px) {
    .mec-modal-content {
        max-width: calc(100vw - 20px);
        max-height: 92vh;
        max-height: 92dvh;
    }

    .mec-modal-footer {
        padding: 16px;
    }
}

#mec-booth-reserve-modal.mec-modal-overlay {
    backdrop-filter: blur(8px);
    background: rgba(17, 24, 39, 0.75);
    animation: fadeIn 0.2s ease-out;
}

#mec-booth-reserve-modal.mec-modal-overlay.active {
    display: flex;
}

#mec-booth-reserve-modal .mec-modal-content {
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
}

#mec-booth-reserve-modal .mec-modal-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border-radius: 20px 20px 0 0;
}

/* Booth Summary Card */
.mec-booth-summary-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.mec-booth-summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-color: #cbd5e1;
}

.mec-summary-icon {
    width: 48px;
    height: 48px;
    background: #eff6ff;
    color: #3b82f6;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.mec-summary-info {
    flex: 1;
}

.mec-summary-info h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    color: #1e293b;
    letter-spacing: -0.025em;
}

.mec-summary-info p {
    margin: 2px 0 0 0;
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}

.mec-summary-price {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* Checkbox Group Improvements */
#mec-booth-reserve-modal .mec-checkbox-group {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 14px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#mec-booth-reserve-modal .mec-checkbox-group:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

#mec-booth-reserve-modal .mec-checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #10b981;
    margin: 0;
}

#mec-booth-reserve-modal .mec-checkbox-group label {
    margin: 0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #475569;
}

/* ========================================
   CREATE TICKET MODAL - MODERN REDESIGN
   ======================================== */

/* Enhanced Modal Overlay */
#mec-ticket-modal.mec-modal-overlay {
    backdrop-filter: blur(8px);
    background: rgba(17, 24, 39, 0.75);
    animation: fadeIn 0.2s ease-out;
}

/* Modern Modal Container */
#mec-ticket-modal .mec-modal-content {
    max-width: min(680px, calc(100vw - 32px));
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
    overflow: visible;
}

/* Stunning Modal Header */
#mec-ticket-modal .mec-modal-header,
#mec-ticket-modal-title {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: clamp(20px, 4vw, 28px) clamp(24px, 4.5vw, 32px);
    border-radius: 20px 20px 0 0;
    position: relative;
    overflow: hidden;
}

#mec-ticket-modal .mec-modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
    pointer-events: none;
}

#mec-ticket-modal-title {
    margin: 0;
    font-size: clamp(20px, 4vw, 24px);
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#mec-ticket-modal-title i {
    font-size: clamp(24px, 5vw, 28px);
    color: rgba(255, 255, 255, 0.95);
}

/* Enhanced Close Button */
#mec-ticket-modal .mec-modal-close {
    position: absolute;
    top: clamp(16px, 3vw, 24px);
    right: clamp(16px, 3vw, 24px);
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

#mec-ticket-modal .mec-modal-close:hover {
    background: rgba(239, 68, 68, 0.95);
    border-color: rgba(220, 38, 38, 0.8);
    transform: rotate(90deg) scale(1.05);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

/* Beautified Modal Body */
#mec-ticket-modal .mec-modal-body {
    padding: clamp(24px, 4vw, 32px);
    max-height: calc(80vh - 180px);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Custom Scrollbar for Modal */
#mec-ticket-modal .mec-modal-body::-webkit-scrollbar {
    width: 8px;
}

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

#mec-ticket-modal .mec-modal-body::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
}

#mec-ticket-modal .mec-modal-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #764ba2 0%, #667eea 100%);
}

/* Form Grid Layout */
#mec-ticket-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: clamp(18px, 3vw, 24px);
}

/* Modern Form Labels */
#mec-ticket-form label {
    display: block;
    font-weight: 700;
    font-size: clamp(13px, 2.2vw, 14px);
    color: #1f2937;
    margin-bottom: 8px;
    letter-spacing: 0.025em;
    text-transform: uppercase;
    font-size: 11px;
    color: #6b7280;
}

/* Enhanced Input Fields */
#mec-ticket-form input[type="text"],
#mec-ticket-form input[type="number"],
#mec-ticket-form input[type="date"],
#mec-ticket-form input[type="datetime-local"],
#mec-ticket-form textarea,
#mec-ticket-form select {
    width: 100%;
    padding: clamp(12px, 2.2vw, 14px) clamp(14px, 2.5vw, 16px);
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: clamp(14px, 2.5vw, 16px);
    color: #111827;
    background: white;
    transition: all 0.3s ease;
    font-family: inherit;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

#mec-ticket-form input:focus,
#mec-ticket-form textarea:focus,
#mec-ticket-form select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1),
        0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

#mec-ticket-form textarea {
    min-height: 100px;
    resize: vertical;
    line-height: 1.6;
}

/* Two Column Layout for Related Fields */
.mec-form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(200px, 40vw, 280px), 1fr));
    gap: clamp(12px, 2vw, 16px);
}

/* Checkbox Styling */
#mec-ticket-form input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #667eea;
    cursor: pointer;
    border: 2px solid #d1d5db;
    border-radius: 6px;
}

/* Enhanced Checkbox Container */
.mec-checkbox-group {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: clamp(14px, 2.5vw, 16px);
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid #fbbf24;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mec-checkbox-group:hover {
    background: linear-gradient(135deg, #fde68a 0%, #fcd34d 100%);
    border-color: #f59e0b;
    transform: translateX(2px);
}

.mec-checkbox-group label {
    margin: 0;
    cursor: pointer;
    font-size: clamp(13px, 2.3vw, 15px);
    font-weight: 600;
    color: #92400e;
    text-transform: none;
}

/* Advanced Options Accordion */
.mec-advanced-options {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 2px solid #bae6fd;
    border-radius: 16px;
    padding: clamp(16px, 3vw, 20px);
    margin-top: 8px;
}

.mec-advanced-options summary {
    cursor: pointer;
    font-weight: 700;
    font-size: clamp(13px, 2.3vw, 15px);
    color: #0c4a6e;
    display: flex;
    align-items: center;
    gap: 10px;
    list-style: none;
    user-select: none;
}

.mec-advanced-options summary::-webkit-details-marker {
    display: none;
}

.mec-advanced-options summary i {
    font-size: 16px;
    color: #38bdf8;
    transition: transform 0.3s ease;
}

.mec-advanced-options[open] summary i {
    transform: rotate(90deg);
}

.mec-advanced-content {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #bae6fd;
}

/* Modern Modal Footer */
#mec-ticket-modal .mec-modal-footer {
    padding: clamp(18px, 3.5vw, 24px) clamp(24px, 4.5vw, 32px);
    background: linear-gradient(to bottom, #ffffff, #f9fafb);
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: clamp(10px, 2vw, 14px);
    justify-content: flex-end;
    align-items: center;
    border-radius: 0 0 20px 20px;
    min-height: 80px;
}

/* Premium Buttons */
#mec-ticket-modal .mec-btn {
    padding: clamp(12px, 2.2vw, 14px) clamp(20px, 3.5vw, 28px);
    font-size: clamp(14px, 2.3vw, 15px);
    font-weight: 700;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    position: relative;
    overflow: hidden;
}

#mec-ticket-modal .mec-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
}

#mec-ticket-modal .mec-btn:hover::before {
    width: 300px;
    height: 300px;
}

#mec-ticket-modal .mec-btn-primary,
#mec-ticket-modal .mec-btn:not(.mec-btn-outline) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(102, 126, 234, 0.3),
        0 2px 4px -1px rgba(102, 126, 234, 0.2);
}

#mec-ticket-modal .mec-btn-primary:hover,
#mec-ticket-modal .mec-btn:not(.mec-btn-outline):hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(102, 126, 234, 0.4),
        0 4px 6px -2px rgba(102, 126, 234, 0.3);
}

#mec-ticket-modal .mec-btn-outline {
    background: white;
    color: #4b5563;
    border: 2px solid #e5e7eb;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

#mec-ticket-modal .mec-btn-outline:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    color: #1f2937;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* ========================================
   MOBILE RESPONSIVE - TICKET MODAL
======================================== */

@media (max-width: 768px) {
    #mec-ticket-modal .mec-modal-content {
        max-width: calc(100vw - 16px);
        max-height: 95vh;
        max-height: 95dvh;
        border-radius: 16px;
    }

    #mec-ticket-modal .mec-modal-header {
        border-radius: 16px 16px 0 0;
        padding: 20px;
    }

    #mec-ticket-modal-title {
        font-size: 20px;
        padding-right: 50px;
    }

    #mec-ticket-modal .mec-modal-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 16px;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
        z-index: 1001;
        flex-direction: row !important;
        gap: 12px;
    }

    #mec-ticket-modal .mec-modal-footer .mec-btn {
        flex: 1;
        width: auto !important;
        min-height: 56px;
        font-size: 17px;
        font-weight: 600;
    }

    #mec-ticket-modal .mec-modal-body {
        padding: 20px;
        max-height: calc(95vh - 240px);
        max-height: calc(95dvh - 240px);
        overflow-y: auto;
        padding-bottom: 80px;
    }

    #mec-ticket-form {
        gap: 20px;
    }

    .mec-form-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

@media (max-width: 480px) {
    #mec-ticket-modal .mec-modal-content {
        max-width: 100vw;
        max-height: 100vh;
        max-height: 100dvh;
        border-radius: 0;
    }

    #mec-ticket-modal .mec-modal-header {
        border-radius: 0;
        padding: 16px;
    }

    #mec-ticket-modal .mec-modal-body {
        padding: 16px;
        max-height: calc(100vh - 220px);
        max-height: calc(100dvh - 220px);
        overflow-y: auto;
        padding-bottom: 100px;
    }

    #mec-ticket-modal .mec-modal-footer {
        padding: 16px;
        border-radius: 0;
    }
}

/* Accessibility Enhancements */
@media (prefers-reduced-motion: reduce) {
    #mec-ticket-modal * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========================================
   NOTIFICATION TOASTS (Phase 5)
======================================== */
#mec-toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.mec-toast {
    background: white;
    width: 320px;
    max-width: 90vw;
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    pointer-events: auto;
    border-left: 4px solid #6366f1;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mec-toast.animate-slide-in {
    transform: translateX(0);
    opacity: 1;
}

.mec-toast.fade-out {
    transform: translateX(100%);
    opacity: 0;
}

.mec-toast-icon {
    font-size: 24px;
}

.mec-toast-content {
    flex: 1;
}

.mec-toast-title {
    font-weight: 700;
    color: #111827;
    margin-bottom: 2px;
    font-size: 14px;
}

.mec-toast-message {
    color: #6b7280;
    font-size: 13px;
    line-height: 1.4;
}

.mec-toast-close {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    margin-left: 4px;
    line-height: 1;
}

.mec-toast-close:hover {
    color: #4b5563;
}

/* Toast Types */
.mec-toast-sale {
    border-left-color: #10b981;
}

.mec-toast-checkin {
    border-left-color: #3b82f6;
}

.mec-toast-system {
    border-left-color: #6366f1;
}

/* ========================================
   COUPON SYSTEM (v4.1)
   ======================================== */

/* Link Preview Panel */
#mec-coupon-link-preview {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border: 1px solid #86efac;
    border-radius: 16px;
    padding: 20px;
    margin-top: 24px;
    animation: mec-fade-in 0.4s ease;
}

@keyframes mec-fade-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

#mec-coupon-link-preview .mec-link-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

#mec-coupon-link-preview input[type="text"] {
    flex: 1;
    background: white;
    border: 1px solid #86efac;
    border-radius: 10px;
    padding: 10px 14px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #166534;
    font-weight: 600;
    min-width: 0;
}

#mec-coupon-link-preview .mec-copy-btn {
    background: #10b981;
    color: white;
    border: none;
    border-radius: 10px;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

#mec-coupon-link-preview .mec-copy-btn:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* Coupon Ticket Filter Container */
#mec-coupon-ticket-container {
    background: #fafafa;
    border: 1px dashed #d1d5db;
    border-radius: 14px;
    padding: 20px;
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.3s;
}

#mec-coupon-ticket-container:has(.mec-ticket-check-label) {
    justify-content: flex-start;
    flex-wrap: wrap;
}

/* Ticket label hover */
.mec-ticket-check-label:hover {
    border-color: #6366f1 !important;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
}

/* Coupon List Table */
#mec-coupons-list-container .mec-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

#mec-coupons-list-container .mec-table thead {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
}

#mec-coupons-list-container .mec-table thead th {
    padding: 14px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

#mec-coupons-list-container .mec-table tbody tr:hover {
    background: #f5f3ff;
}

#mec-coupons-list-container .mec-table tbody tr:last-child {
    border-bottom: none !important;
}

/* Coupon code badge */
.mec-coupon-code-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    padding: 5px 12px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 13px;
    font-family: monospace;
    letter-spacing: 1.5px;
}

/* Promoter assign panel */
#mec-coupon-promoter-section {
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    border: 1px solid #93c5fd;
    border-radius: 14px;
    padding: 18px 20px;
    margin-top: 8px;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    #mec-coupons-list-container .mec-table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    #mec-coupons-list-container .mec-table {
        min-width: 600px;
    }

    #mec-coupon-link-preview .mec-link-row {
        flex-direction: column;
    }

    #mec-coupon-link-preview .mec-copy-btn {
        width: 100%;
        justify-content: center;
    }
}