/* MiaMia Explainer Modals CSS */

/* Explainer links in content */
.miamia-explainer-link {
    color: #128C7E;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px dashed #128C7E;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}

.miamia-explainer-link:hover {
    color: #0d6b5f;
    border-bottom-color: #0d6b5f;
}

/* Hide original explainer sections */
.miamia-explainer-content {
    display: none !important;
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Hide theme TOC markers inside modals */
.miamia-modal-wrap .index-title {
    display: none !important;
}

/* Overlay */
.miamia-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out;
    z-index: 999998;
}

.miamia-overlay.miamia-active {
    opacity: 1;
    pointer-events: auto;
}

/* Modal wrapper - higher z-index than overlay */
.miamia-modal-wrap {
    position: fixed;
    bottom: -100%;
    left: 0;
    width: 100%;
    max-height: 75%;
    background: #ffffff;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
    transition: bottom 0.3s ease-in-out, transform 0.3s ease-in-out;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    isolation: isolate;
}

.miamia-modal-wrap.miamia-active {
    bottom: 0px;
}

/* Drag area */
.miamia-drag-area {
    touch-action: none;
    flex-shrink: 0;
}

/* Handle bar */
.miamia-handle {
    width: 40px;
    height: 4px;
    background: #ccc;
    border-radius: 3px;
    margin: 20px auto 10px;
}

/* Modal header */
.miamia-modal-head {
    border-bottom: 1px solid #eee;
    padding: 0 0 15px;
    margin: 0 20px 15px;
}

.miamia-modal-head h2 {
    margin: 0;
    font-size: 20px;
    text-align: center;
    font-weight: 600;
    color: #1a1a1a;
}

/* Modal content area */
.miamia-modal-main {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px 20px;
    -webkit-overflow-scrolling: touch;
}

.miamia-modal-content {
    font-size: 18px;
    color: #333;
    line-height: 1.7;
}

.miamia-modal-content p {
    margin-bottom: 16px;
}

.miamia-modal-content p:last-child {
    margin-bottom: 0;
}

.miamia-modal-content h1,
.miamia-modal-content h2,
.miamia-modal-content h3,
.miamia-modal-content h4,
.miamia-modal-content h5,
.miamia-modal-content h6 {
    margin-top: 0;
    margin-bottom: 12px;
    color: #1a1a1a;
}

.miamia-modal-content ul,
.miamia-modal-content ol {
    margin-bottom: 10px;
    padding-left: 20px;
}

.miamia-modal-content li {
    margin-bottom: 8px;
    list-style-type: square;
}

/* Prevent body scroll when modal is open */
body.miamia-modal-open {
    overflow: hidden;
}

/* Mobile optimization */
@media (max-width: 768px) {
    .miamia-modal-wrap {
        max-height: 85%;
    }
    
    .miamia-modal-head h2 {
        font-size: 20px;
    }
    
    .miamia-modal-content {
        font-size: 18px;
    }
}

/* Desktop optimization */
@media (min-width: 769px) {
    .miamia-modal-wrap {
        left: 50%;
        transform: translateX(-50%);
        max-width: 600px;
        border-radius: 20px 20px 0 0;
    }
    
    .miamia-modal-wrap.miamia-active {
        /*bottom: 50%;
        transform: translateX(-50%) translateY(50%); */
    }
}

/* Smooth scrolling for modal content */
.miamia-modal-main::-webkit-scrollbar {
    width: 6px;
}

.miamia-modal-main::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.miamia-modal-main::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.miamia-modal-main::-webkit-scrollbar-thumb:hover {
    background: #999;
}
