/**
 * Styles for Micromodal implementation
 */

.nerdy-posts-modal__overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999999;
    overflow: hidden;
}

.nerdy-posts-modal__container {
    background-color: #fff;
    padding: 0;
    max-width: 700px;
    max-height: 90vh;
    width: 90vw;
    /* height: 80vh; */
    height: auto;
    border-radius: 4px;
    overflow: hidden;
    box-sizing: border-box;
    position: relative;
    display: flex;
    flex-direction: column;
}

.nerdy-posts-modal__header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 20px 20px 0 20px;
}

.nerdy-posts-modal__content {
    flex: 1;
    padding: 0 20px 20px 20px;
    overflow-y: auto;
    line-height: 1.5;
    color: rgba(0, 0, 0, 0.8);
    height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.nerdy-posts-modal__content iframe {
    width: 100%;
    height: 100%;
    border: 0;
    flex: 1;
    min-height: 400px;
    display: block;
}

.nerdy-posts-modal__close {
    background: transparent;
    border: 0;
    font-size: 24px;
    line-heiht: 1;
    cursor: pointer;
    outline: none;
    padding: 0;
    color: #999;
    transition: color 0.2s ease;
}

.nerdy-posts-modal__close:hover {
    color: #333;
}

/* Animations */
.nerdy-posts-micromodal-slide {
    display: none;
}

.nerdy-posts-micromodal-slide.is-open {
    display: block;
}

/* Prevent page shift when modal opens */
html.nerdy-posts-has-modal-open {
    overflow: hidden;
}

html.nerdy-posts-has-modal-open body {
    padding-right: var(--scrollbar-width, 0px);
}

.nerdy-posts-micromodal-slide[aria-hidden="false"] .nerdy-posts-modal__overlay {
    animation: nerdy-posts-mmfadeIn 0.3s cubic-bezier(0, 0, 0.2, 1);
}

.nerdy-posts-micromodal-slide[aria-hidden="false"]
    .nerdy-posts-modal__container {
    animation: nerdy-posts-mmslideIn 0.3s cubic-bezier(0, 0, 0.2, 1);
}

.nerdy-posts-micromodal-slide[aria-hidden="true"] .nerdy-posts-modal__overlay {
    animation: nerdy-posts-mmfadeOut 0.3s cubic-bezier(0, 0, 0.2, 1);
    animation-fill-mode: forwards;
}

.nerdy-posts-micromodal-slide[aria-hidden="true"]
    .nerdy-posts-modal__container {
    animation: nerdy-posts-mmslideOut 0.3s cubic-bezier(0, 0, 0.2, 1);
    animation-fill-mode: forwards;
}

.nerdy-posts-micromodal-slide .nerdy-posts-modal__container,
.nerdy-posts-micromodal-slide .nerdy-posts-modal__overlay {
    will-change: transform, opacity;
}

@keyframes nerdy-posts-mmfadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes nerdy-posts-mmfadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes nerdy-posts-mmslideIn {
    from {
        transform: translateY(15%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes nerdy-posts-mmslideOut {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(-10%);
        opacity: 0;
    }
}

/* --- Summary Card/Banner Style --- */
.nerdy-posts-summary-content {
    background: #f0f6ff;
    border-radius: 6px;
    box-shadow: 0 2px 8px 0 rgba(60, 100, 180, 0.06);
    padding: 20px 24px 20px 20px;
    margin-bottom: 28px;
    margin-top: 28px;
    position: relative;
    font-size: 0.9em;
    color: #1f1f2e;
}

.nerdy-posts-summary-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60px;
}

.nerdy-posts-summary-spinner:after {
    content: " ";
    display: block;
    width: 22px;
    height: 22px;
    margin: 3px;
    border-radius: 50%;
    border: 3px solid #3b82f6;
    border-color: #3b82f6 transparent #3b82f6 transparent;
    animation: nerdy-posts-spin 1.1s linear infinite;
}

.nerdy-posts-summary-content p:first-child {
    margin-top: 0;
}

.nerdy-posts-summary-content p:last-child {
    margin-bottom: 0;
}

/* --- Chat Modal Basic Styles --- */

/* Spinner for AI loading */
.nerdy-posts-chat-spinner {
    display: inline-block;
    width: 28px;
    height: 28px;
    vertical-align: middle;
}
.nerdy-posts-chat-spinner:after {
    content: " ";
    display: block;
    width: 22px;
    height: 22px;
    margin: 3px;
    border-radius: 50%;
    border: 3px solid #3b82f6;
    border-color: #3b82f6 transparent #3b82f6 transparent;
    animation: nerdy-posts-spin 1.1s linear infinite;
}
@keyframes nerdy-posts-spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

#nerdy-posts-chat {
    background: #f7f7fa;
    border: 1px solid #ececec;
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 12px;
    overflow-y: auto;
    height: 220px;
    font-size: 15px;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#nerdy-posts-chat-input {
    width: 100%;
    min-height: 48px;
    max-height: 120px;
    resize: vertical;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 10px;
    font-size: 15px;
    margin-bottom: 10px;
    box-sizing: border-box;
    background: #fff;
}

/* --- Chat message bubbles --- */
.nerdy-posts-chat-user,
.nerdy-posts-chat-ai {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 18px;
    word-break: break-word;
    margin-bottom: 0;
    display: inline-block;
    font-size: 15px;
}

.nerdy-posts-chat-user {
    align-self: flex-end;
    background: #3b82f6;
    color: #fff;
    border-radius: 18px 18px 4px 18px;
    text-align: right;
}

.nerdy-posts-chat-ai {
    align-self: flex-start;
    background: #e5e7eb;
    color: #222;
    border-radius: 18px 18px 18px 4px;
    text-align: left;
}

.nerdy-posts-chat-error {
    align-self: flex-start;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 18px 18px 18px 4px;
    padding: 10px 14px;
    font-size: 15px;
    max-width: 75%;
    word-break: break-word;
}

/* --- AI Control Buttons --- */
.nerdy-posts-ai-controls {
    display: inline-block;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 8px 18px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.18s ease;
    margin: 0;
    line-height: 1.5;
    text-decoration: none;
    outline: none;
}

.nerdy-posts-ai-controls:hover,
.nerdy-posts-ai-controls:focus {
    background: #2563eb;
    color: #fff;
}

.nerdy-posts-ai-controls:active {
    background: #1d4ed8;
    transform: translateY(1px);
}

.nerdy-posts-ai-controls:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    opacity: 0.6;
}
