/* ============================================================
 * Diary Share Modal
 * 다이어리 → 커뮤니티 공유 모달
 * ============================================================ */

/* --- Overlay --- */
.dsm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 16px;
    animation: dsm-fade-in .2s ease;
}
@keyframes dsm-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- Modal Card --- */
.dsm-modal {
    background: #fff;
    border-radius: 20px;
    width: 100%;
    max-width: 520px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 16px 48px rgba(0, 0, 0, .18);
    animation: dsm-slide-up .25s cubic-bezier(.4, 0, .2, 1);
    overflow-y: auto;
    overflow-x: hidden;
}
@keyframes dsm-slide-up {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Header --- */
.dsm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
    flex-shrink: 0;
}
.dsm-title {
    font-size: 18px;
    font-weight: 700;
    color: #2E2E2E;
}
.dsm-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    padding: 4px;
    border-radius: 8px;
    transition: background .2s;
}
.dsm-close:hover { background: #f0f0f0; }

/* --- Hint --- */
.dsm-hint {
    padding: 12px 24px 0;
    font-size: 13px;
    color: #999;
    line-height: 1.5;
}

.dsm-quest-round {
    margin: 12px 24px 0;
    padding: 12px 14px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(91, 140, 107, 0.1), rgba(129, 199, 132, 0.06));
    border: 1px solid rgba(91, 140, 107, 0.22);
}
.dsm-quest-round__kicker {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #5B8C6B;
    margin-bottom: 6px;
}
.dsm-quest-round__challenge {
    font-size: 13px;
    font-weight: 700;
    color: #2E2E2E;
    margin-bottom: 4px;
}
.dsm-quest-round__title {
    font-size: 12px;
    font-weight: 600;
    color: #3E6B4E;
    margin-bottom: 0;
}
.dsm-quest-round__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}
.dsm-quest-round__toggle {
    border: 1px solid rgba(91, 140, 107, 0.35);
    background: rgba(255, 255, 255, 0.72);
    color: #3E6B4E;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 8px;
    cursor: pointer;
    flex-shrink: 0;
}
.dsm-quest-round__prompt {
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    white-space: pre-wrap;
    word-break: keep-all;
}
.dsm-quest-round__details {
    display: none;
    margin-top: 8px;
    max-height: min(28vh, 210px);
    overflow-y: auto;
    padding-right: 4px;
}
.dsm-quest-round__details.is-open {
    display: block;
}
.dsm-quest-round__context {
    font-size: 13px;
    line-height: 1.55;
    color: #555;
    white-space: pre-wrap;
    word-break: keep-all;
}
.dsm-quest-round__questions {
    margin: 8px 0 0;
    padding-left: 18px;
    font-size: 13px;
    line-height: 1.5;
    color: #333;
}

/* --- Textarea --- */
.dsm-textarea {
    margin: 12px 24px;
    padding: 14px 16px;
    border: 1.5px solid #e8e8e8;
    border-radius: 12px;
    font-size: 15px;
    font-family: inherit;
    line-height: 1.65;
    color: #2E2E2E;
    resize: vertical;
    min-height: 180px;
    max-height: 40vh;
    transition: border-color .2s;
    flex-shrink: 0;
}
.dsm-textarea:focus {
    outline: none;
    border-color: #5B8C6B;
}
.dsm-textarea::placeholder {
    color: #ccc;
}

/* --- Visibility Area (diary-visibility.css 스타일 재활용) --- */
.dsm-modal #shareVisibilityRoot {
    padding: 0 24px;
}

/* --- Footer --- */
.dsm-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px 20px;
    flex-shrink: 0;
}

/* --- Buttons --- */
.dsm-btn {
    padding: 10px 22px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all .2s ease;
}
.dsm-btn--ghost {
    background: transparent;
    color: #999;
}
.dsm-btn--ghost:hover {
    background: #f4f4f4;
    color: #666;
}
.dsm-btn--primary {
    background: #5B8C6B;
    color: #fff;
    box-shadow: 0 2px 8px rgba(91, 140, 107, .25);
}
.dsm-btn--primary:hover {
    background: #3E6B4E;
}
.dsm-btn--primary:disabled {
    opacity: .6;
    cursor: not-allowed;
}

/* ===== Mobile ===== */
@media (max-width: 600px) {
    .dsm-overlay {
        align-items: flex-end;
        padding: 0;
    }
    .dsm-modal {
        max-width: 100%;
        max-height: 92vh;
        border-radius: 20px 20px 0 0;
        animation-name: dsm-slide-up-mobile;
    }
    @keyframes dsm-slide-up-mobile {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }
    .dsm-textarea {
        min-height: 140px;
    }
}

/* ===== Small Mobile ===== */
@media (max-width: 380px) {
    .dsm-header { padding: 16px 16px 0; }
    .dsm-hint { padding: 10px 16px 0; font-size: 12px; }
    .dsm-textarea { margin: 10px 16px; font-size: 14px; }
    .dsm-modal #shareVisibilityRoot { padding: 0 16px; }
    .dsm-footer { padding: 12px 16px 16px; }
}
