/**
 * Group Planner Modal Styles
 * Dark theme modal for embedding the planner on event pages
 */

/* Modal Container */
.coco-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: auto; /* Prevent auto-scroll to middle */
}

/* Ensure modal content starts at top when opened */
.coco-modal-content {
    margin-top: 0 !important; /* Override any margin that causes centering */
}

/* Modal Overlay */
.coco-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Modal Content */
.coco-modal-content {
    position: relative;
    width: 100%;
    max-width: 600px;
    max-height: calc(100vh - 40px);
    background: linear-gradient(145deg, #1a1a1a 0%, #0d0d0d 100%);
    border-radius: 20px;
    border: 1px solid rgba(212, 175, 55, 0.3);
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin: 20px auto;
}

/* Modal Close Button */
.coco-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.coco-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Modal Root - where React mounts */
#coco-planner-modal-root {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    padding-bottom: 40px; /* Ensure space at bottom for buttons */
    min-height: 0; /* Allow flex shrinking */
}

/* Scrollbar Styling */
#coco-planner-modal-root::-webkit-scrollbar {
    width: 8px;
}

#coco-planner-modal-root::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

#coco-planner-modal-root::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.3);
    border-radius: 4px;
}

#coco-planner-modal-root::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 175, 55, 0.5);
}

/* Body class when modal is open */
body.coco-modal-open {
    overflow: hidden;
}

/* ================================
   Modal Mode App Styles
   ================================ */

/* App wrapper in modal mode - CRITICAL: Override main styles */
.coco-planner-app--modal {
    padding: 0 !important;
    min-height: auto !important;
    background: transparent !important;
}

/* Ensure modal root inherits proper styling */
#coco-planner-modal-root .coco-planner-app {
    background: transparent !important;
    min-height: auto !important;
    padding: 0 !important;
}

/* Step indicator in modal */
#coco-planner-modal-root .step-indicator {
    padding: 16px 20px;
    background: rgba(0, 0, 0, 0.3);
    margin-bottom: 0;
}

/* Group builder in modal */
#coco-planner-modal-root .group-builder {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    margin: 16px;
}

#coco-planner-modal-root .group-builder-title {
    font-size: 18px;
    margin-bottom: 20px;
}

/* Gender split in modal */
#coco-planner-modal-root .gender-split {
    gap: 12px;
}

#coco-planner-modal-root .gender-input {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 16px;
}

#coco-planner-modal-root .gender-btn {
    width: 36px;
    height: 36px;
    font-size: 18px;
}

/* Arrival intent in modal */
#coco-planner-modal-root .arrival-intent {
    padding: 0 16px 16px;
}

#coco-planner-modal-root .arrival-options {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

#coco-planner-modal-root .arrival-option {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 12px;
    font-size: 13px;
}

/* Event selector in modal */
#coco-planner-modal-root .event-card {
    margin: 8px 16px;
}

#coco-planner-modal-root .event-card-image {
    height: 120px;
}

#coco-planner-modal-root .event-card-content {
    padding: 12px 16px;
}

/* Option cards in modal */
#coco-planner-modal-root .options-container {
    padding: 16px;
    gap: 12px;
}

#coco-planner-modal-root .option-card {
    padding: 16px;
}

/* Buttons in modal */
#coco-planner-modal-root .coco-btn {
    padding: 14px 24px;
}

#coco-planner-modal-root .coco-btn-full {
    margin: 16px;
    width: calc(100% - 32px);
}

/* Forms in modal */
#coco-planner-modal-root .form-group {
    padding: 0 16px;
    margin-bottom: 16px;
}

#coco-planner-modal-root .form-input {
    background: var(--coco-gray, #2a2a2a);
}

/* Section headers in modal */
#coco-planner-modal-root h2 {
    font-size: 18px;
    padding: 16px 16px 8px;
    margin: 0;
}

#coco-planner-modal-root .invite-subtitle,
#coco-planner-modal-root .event-subtitle {
    padding: 0 16px;
    color: #888;
}

/* Event name in modal header */
#coco-planner-modal-root .planning-for {
    padding: 12px 16px;
    background: rgba(212, 175, 55, 0.1);
    margin: 0;
    text-align: center;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}

#coco-planner-modal-root .planning-for-label {
    color: #888;
    font-size: 13px;
}

#coco-planner-modal-root .planning-for-event {
    color: var(--coco-gold, #d4af37);
    font-weight: 600;
}

/* Modal Header */
.coco-planner-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 60px 20px 24px;
    background: linear-gradient(180deg, rgba(212, 175, 55, 0.15) 0%, transparent 100%);
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}

.coco-planner-modal-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}

.coco-planner-modal-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 24px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.coco-planner-modal-close-btn:hover {
    background: rgba(255, 100, 100, 0.3);
    color: #ff6b6b;
}

/* Adjust step indicator in modal */
.coco-planner-app--modal .step-indicator {
    padding: 16px 24px;
    background: rgba(0, 0, 0, 0.3);
}

/* Adjust content padding in modal */
.coco-planner-app--modal .coco-btn,
.coco-planner-app--modal .form-input,
.coco-planner-app--modal .form-group {
    /* Ensure buttons and inputs work well in modal context */
}

/* ================================
   Mobile Responsive
   ================================ */

@media (max-width: 768px) {
    .coco-modal {
        padding: 0;
    }

    .coco-modal-content {
        max-width: 100%;
        max-height: 100%;
        height: 100%;
        border-radius: 0;
        border: none;
    }

    .coco-modal-close {
        top: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
        font-size: 24px;
    }

    .coco-planner-modal-header {
        padding: 16px 50px 16px 16px;
    }

    .coco-planner-modal-title {
        font-size: 18px;
    }
    
    #coco-planner-modal-root {
        padding-bottom: 60px !important; /* More space on mobile for buttons */
    }
}

@media (max-width: 480px) {
    .coco-planner-modal-title {
        font-size: 16px;
    }
    
    #coco-planner-modal-root {
        padding-bottom: 80px !important; /* Even more space on small mobile */
    }
}

/* Ensure buttons at bottom are accessible */
#coco-planner-modal-root .invite-manager,
#coco-planner-modal-root .invite-page {
    padding-bottom: 60px !important; /* Extra space for bottom buttons */
}

#coco-planner-modal-root button[class*="deposit"],
#coco-planner-modal-root button[class*="chip"],
#coco-planner-modal-root .coco-btn-primary:last-child {
    margin-bottom: 20px !important;
    position: relative;
    z-index: 1;
}

/* ================================
   Animation
   ================================ */

/* Fade in animation */
.coco-modal {
    animation: cocoModalFadeIn 0.2s ease-out;
}

@keyframes cocoModalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.coco-modal-content {
    animation: cocoModalSlideUp 0.3s ease-out;
}

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

/* ================================
   Content Containment
   ================================ */

/* Ensure all content stays in the modal */
#coco-planner-modal-root > * {
    max-width: 100%;
    box-sizing: border-box;
}

/* Force planner app to fit in modal */
#coco-planner-modal-root .coco-planner-app,
#coco-planner-modal-root .coco-planner-app--modal {
    padding: 0;
    min-height: auto;
    max-width: 100%;
    overflow: hidden;
}

/* Sections inside the planner */
#coco-planner-modal-root .planner-section,
#coco-planner-modal-root .form-section,
#coco-planner-modal-root .step-container {
    padding: 16px 20px;
    max-width: 100%;
    box-sizing: border-box;
}

/* Option cards and form groups */
#coco-planner-modal-root .option-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
}

#coco-planner-modal-root .option-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(212, 175, 55, 0.3);
}

#coco-planner-modal-root .option-card.selected {
    background: rgba(212, 175, 55, 0.15);
    border-color: rgba(212, 175, 55, 0.5);
}

/* Arrival time options */
#coco-planner-modal-root .arrival-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 20px;
}

#coco-planner-modal-root .arrival-option {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #fff;
}

#coco-planner-modal-root .arrival-option:hover {
    background: rgba(255, 255, 255, 0.08);
}

#coco-planner-modal-root .arrival-option.selected {
    background: rgba(212, 175, 55, 0.15);
    border-color: rgba(212, 175, 55, 0.5);
}

/* Form inputs in modal */
#coco-planner-modal-root input[type="text"],
#coco-planner-modal-root input[type="email"],
#coco-planner-modal-root input[type="tel"],
#coco-planner-modal-root input[type="number"],
#coco-planner-modal-root select,
#coco-planner-modal-root textarea {
    width: 100%;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #fff;
    font-size: 15px;
    box-sizing: border-box;
}

#coco-planner-modal-root input:focus,
#coco-planner-modal-root select:focus,
#coco-planner-modal-root textarea:focus {
    outline: none;
    border-color: #d4af37;
    background: rgba(255, 255, 255, 0.1);
}

#coco-planner-modal-root input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* Labels */
#coco-planner-modal-root label {
    display: block;
    margin-bottom: 6px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

/* Form groups */
#coco-planner-modal-root .form-group {
    margin-bottom: 16px;
}

/* Section headers */
#coco-planner-modal-root h2,
#coco-planner-modal-root h3,
#coco-planner-modal-root .section-title {
    color: #fff;
    margin: 0 0 12px 0;
    font-weight: 600;
}

#coco-planner-modal-root h2 {
    font-size: 20px;
    padding: 16px 20px 0;
}

#coco-planner-modal-root h3,
#coco-planner-modal-root .section-title {
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Submit/Continue buttons */
#coco-planner-modal-root .submit-btn,
#coco-planner-modal-root .continue-btn,
#coco-planner-modal-root button[type="submit"],
#coco-planner-modal-root .coco-btn-full {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #d4af37 0%, #b8960c 100%);
    color: #000;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 20px;
    margin-bottom: 20px; /* Add bottom margin for scrollability */
}

#coco-planner-modal-root .submit-btn:hover,
#coco-planner-modal-root .continue-btn:hover,
#coco-planner-modal-root button[type="submit"]:hover {
    background: linear-gradient(135deg, #e8c547 0%, #d4af37 100%);
    transform: translateY(-1px);
}

/* Group slider section */
#coco-planner-modal-root .group-slider-container {
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    margin: 16px 20px;
}

/* Counter buttons for guys/girls */
#coco-planner-modal-root .counter-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

#coco-planner-modal-root .counter-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ================================
   Button styling for event page
   ================================ */

/* Style the "Plan Group Night Out" button to match other CTAs */
#coco-open-planner-modal.coco-planner-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #d4af37 0%, #b8960c 100%);
    color: #000;
    font-weight: 700;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    transition: all 0.2s ease;
    text-decoration: none;
}

#coco-open-planner-modal.coco-planner-button:hover {
    background: linear-gradient(135deg, #e8c547 0%, #d4af37 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(212, 175, 55, 0.3);
}

/* Match event hero CTA styling */
.coco-event-hero__cta#coco-open-planner-modal {
    background: linear-gradient(135deg, #d4af37 0%, #b8960c 100%);
    color: #000;
}

.coco-event-hero__cta#coco-open-planner-modal:hover {
    background: linear-gradient(135deg, #e8c547 0%, #d4af37 100%);
}

