/* ===== DM Automation Preview : Phone Modal Simulator ===== */

/* ── Modal & Phone frame ── */
#rp-sim-modal {
    z-index: 1060;
}

#rp-sim-modal + .modal-backdrop {
    z-index: 1059;
}

.rp-sim-modal-dialog {
    max-width: 325px;
    margin: 1.75rem auto;
}

.rp-sim-phone {
    border-radius: 40px !important;
    overflow: hidden;
    border: 8px solid #1a1a1a !important;
    box-shadow: 0 0 0 2px #333, 0 20px 60px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    height: 80vh;
    max-height: 720px;
    background: #fff;
}

/* Phone notch */
.rp-sim-phone-notch {
    width: 120px;
    height: 28px;
    background: #1a1a1a;
    border-radius: 0 0 18px 18px;
    margin: 0 auto;
    flex-shrink: 0;
}

/* Phone home indicator */
.rp-sim-phone-home {
    width: 130px;
    height: 5px;
    background: #1a1a1a;
    border-radius: 3px;
    margin: 8px auto 6px;
    flex-shrink: 0;
}

/* ── Tab bar ── */
.rp-sim-tabs {
    display: flex;
    background: #fff;
    border-bottom: 1px solid #dbdbdb;
    flex-shrink: 0;
}

.rp-sim-tab {
    flex: 1;
    text-align: center;
    padding: 11px 0;
    font-size: 13px;
    font-weight: 600;
    color: #8e8e8e;
    cursor: pointer;
    border: none;
    border-bottom: 1px solid transparent;
    background: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: color 0.15s;
    margin-bottom: -1px;
}

.rp-sim-tab:hover {
    color: #262626;
}

.rp-sim-tab.active {
    color: #262626;
    border-bottom-color: #262626;
}

.rp-sim-badge {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fe004b;
    display: none;
}

.rp-sim-badge.show {
    display: inline-block;
}

/* ── Screens ── */
.rp-sim-screens {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    background: #fff;
}

.rp-sim-screen {
    display: none;
}

.rp-sim-screen.active {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

/* ============================================
   POST SCREEN
   ============================================ */

.rp-sim-post {
    background: #fff;
}

/* Header: avatar · username · ··· */
.rp-sim-post-header {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    gap: 10px;
}

/* Avatar with story ring */
.rp-sim-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rp-sim-avatar::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    z-index: 0;
}

.rp-sim-avatar::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: #fff;
    z-index: 1;
}

.rp-sim-avatar-letter {
    position: relative;
    z-index: 2;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #c7c7c7;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
}

.rp-sim-post-username {
    font-size: 13px;
    font-weight: 600;
    color: #262626;
    flex: 1;
}

.rp-sim-post-more {
    color: #262626;
    font-size: 16px;
    cursor: default;
}

.rp-sim-post-type {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 2px 8px;
    border-radius: 4px;
    background: #f0f0f0;
    color: #666;
}

.rp-sim-post-type:empty {
    display: none;
}

/* Post image */
.rp-sim-post-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #efefef;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.rp-sim-post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rp-sim-post-image-placeholder {
    color: #c7c7c7;
    text-align: center;
    font-size: 13px;
}

.rp-sim-post-image-placeholder i {
    font-size: 40px;
    display: block;
    margin-bottom: 6px;
}

/* Actions row */
.rp-sim-actions {
    display: flex;
    align-items: center;
    padding: 6px 12px 2px;
    gap: 16px;
    color: #262626;
}

.rp-sim-actions i {
    font-size: 24px;
    cursor: default;
}

.rp-sim-actions .rp-sim-action-save {
    margin-left: auto;
}

/* Likes */
.rp-sim-likes {
    padding: 0 12px 4px;
    font-size: 13px;
    font-weight: 600;
    color: #262626;
}

/* ── Comments ── */
.rp-sim-comments {
    padding: 4px 0;
    background: #fff;
}

.rp-sim-comment {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 12px;
    animation: rp-sim-fadeIn 0.3s ease-out;
}

/* Reply (indented) */
.rp-sim-comment.rp-sim-comment-reply {
    padding-left: 56px;
}

.rp-sim-comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #c7c7c7;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
}

.rp-sim-comment-reply .rp-sim-comment-avatar {
    width: 24px;
    height: 24px;
    font-size: 11px;
}

.rp-sim-comment-body {
    flex: 1;
    min-width: 0;
}

.rp-sim-comment-text {
    font-size: 13px;
    color: #262626;
    line-height: 1.45;
    word-break: break-word;
}

.rp-sim-comment-username {
    font-weight: 600;
    color: #262626;
    margin-right: 4px;
    font-size: 13px;
}

.rp-sim-comment-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
    font-size: 11px;
    color: #8e8e8e;
}

.rp-sim-comment-meta span {
    font-weight: 600;
    cursor: default;
}

.rp-sim-comment-heart {
    flex-shrink: 0;
    color: #8e8e8e;
    font-size: 12px;
    padding-top: 4px;
    cursor: default;
}

/* Comment input bar */
.rp-sim-comment-input-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #fff;
    border-top: 1px solid #efefef;
    margin-top: auto;
}

.rp-sim-comment-input-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #c7c7c7;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
}

.rp-sim-comment-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 13px;
    color: #262626;
    background: transparent;
    padding: 0;
}

.rp-sim-comment-input::placeholder {
    color: #8e8e8e;
}

.rp-sim-comment-post-btn {
    font-size: 13px;
    font-weight: 600;
    color: #0095f6;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: opacity 0.15s;
}

.rp-sim-comment-post-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

/* ============================================
   DM SCREEN
   ============================================ */

.rp-sim-dm {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    background: #fff;
}

/* DM header */
.rp-sim-dm-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #fff;
    border-bottom: 1px solid #efefef;
    flex-shrink: 0;
}

.rp-sim-dm-back {
    color: #262626;
    font-size: 22px;
    cursor: default;
    flex-shrink: 0;
}

.rp-sim-dm-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #c7c7c7;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}

.rp-sim-dm-info {
    flex: 1;
    min-width: 0;
}

.rp-sim-dm-name {
    font-size: 14px;
    font-weight: 600;
    color: #262626;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rp-sim-dm-header-actions {
    display: flex;
    gap: 16px;
    color: #262626;
    font-size: 22px;
    flex-shrink: 0;
}

/* Profile card at top of DM conversation */
.rp-sim-profile-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 16px 16px;
    background: #fff;
}

.rp-sim-profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #c7c7c7;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
}

.rp-sim-profile-name {
    font-size: 14px;
    font-weight: 600;
    color: #262626;
}

.rp-sim-profile-sub {
    font-size: 12px;
    color: #8e8e8e;
    margin-top: 2px;
}

.rp-sim-profile-btn {
    margin-top: 10px;
    padding: 6px 16px;
    border-radius: 8px;
    border: 1px solid #dbdbdb;
    background: #fff;
    font-size: 12px;
    font-weight: 600;
    color: #262626;
    cursor: default;
}

/* Context message (e.g. "messaged you about a comment") */
.rp-sim-context {
    text-align: center;
    padding: 12px 20px;
    font-size: 12px;
    color: #8e8e8e;
    line-height: 1.5;
    animation: rp-sim-fadeIn 0.3s ease-out;
}

.rp-sim-context-link {
    color: #00376b;
    font-weight: 600;
}

/* DM messages */
.rp-sim-dm-messages {
    flex: 1;
    padding: 0 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: #fff;
    overflow-y: auto;
}

/* Empty state */
.rp-sim-dm-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #8e8e8e;
    font-size: 13px;
    padding: 40px 20px;
}

.rp-sim-dm-empty i {
    font-size: 44px;
    color: #dbdbdb;
    margin-bottom: 12px;
}

/* Message row with optional avatar */
.rp-sim-msg {
    max-width: 80%;
    animation: rp-sim-fadeIn 0.3s ease-out;
    margin-bottom: 2px;
}

.rp-sim-msg-received {
    align-self: flex-start;
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.rp-sim-msg-sent {
    align-self: flex-end;
}

/* Small avatar next to received messages */
.rp-sim-msg-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #c7c7c7;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 9px;
    font-weight: 600;
    flex-shrink: 0;
}

/* Hide avatar placeholder (keeps spacing) */
.rp-sim-msg-avatar.hidden {
    visibility: hidden;
}

.rp-sim-msg-content {
    flex: 1;
    min-width: 0;
}

/* Message bubble */
.rp-sim-msg-bubble {
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.45;
    word-break: break-word;
}

.rp-sim-msg-received .rp-sim-msg-bubble {
    background: #efefef;
    color: #000;
    border-radius: 18px 18px 18px 4px;
}

.rp-sim-msg-sent .rp-sim-msg-bubble {
    background: #833ab4;
    background: linear-gradient(135deg, #833ab4, #c13584);
    color: #fff;
    border-radius: 18px 18px 4px 18px;
}

/* Buttons INSIDE bubble */
.rp-sim-dm-btn {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: background 0.15s;
    border: 1px solid #dbdbdb;
    background: #fff;
    color: #262626;
}

.rp-sim-dm-btn:hover {
    background: #f5f5f5;
}

.rp-sim-dm-btn:disabled,
.rp-sim-dm-btn.disabled {
    opacity: 0.5;
    cursor: default;
    pointer-events: none;
}

/* Timestamp */
.rp-sim-msg-time {
    font-size: 10px;
    color: #8e8e8e;
    margin-top: 4px;
    padding: 0 4px;
}

.rp-sim-msg-received .rp-sim-msg-time { text-align: left; padding-left: 28px; }
.rp-sim-msg-sent .rp-sim-msg-time { text-align: right; }

/* System message */
.rp-sim-msg-system {
    align-self: center;
    max-width: 90%;
    margin: 8px 0;
}

.rp-sim-msg-system .rp-sim-msg-bubble {
    background: transparent;
    color: #8e8e8e;
    font-size: 12px;
    text-align: center;
    padding: 4px 8px;
    border-radius: 0;
}

/* Typing indicator */
.rp-sim-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: #efefef;
    border-radius: 18px 18px 18px 4px;
    width: fit-content;
    animation: rp-sim-fadeIn 0.2s ease-out;
}

.rp-sim-typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #8e8e8e;
    animation: rp-sim-typingBounce 1.4s infinite;
}

.rp-sim-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.rp-sim-typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* DM input bar (decorative) */
.rp-sim-dm-input-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: #fff;
    border-top: 1px solid #efefef;
    flex-shrink: 0;
}

.rp-sim-dm-input-icon {
    font-size: 22px;
    color: #262626;
}

.rp-sim-dm-input-field {
    flex: 1;
    border: 1px solid #dbdbdb;
    border-radius: 22px;
    padding: 8px 16px;
    font-size: 13px;
    color: #8e8e8e;
    background: #fff;
}

.rp-sim-dm-input-icons {
    display: flex;
    gap: 12px;
    color: #262626;
    font-size: 22px;
}

/* ── Follower choice ── */
.rp-sim-choice {
    padding: 14px;
    background: #fafafa;
    border-top: 1px solid #efefef;
}

.rp-sim-choice-title {
    font-size: 13px;
    font-weight: 600;
    color: #262626;
    text-align: center;
    margin-bottom: 10px;
}

.rp-sim-choice-btns {
    display: flex;
    gap: 10px;
}

.rp-sim-choice-btn {
    flex: 1;
    padding: 12px 8px;
    border-radius: 12px;
    border: 1px solid #dbdbdb;
    background: #fff;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
}

.rp-sim-choice-btn:hover {
    background: #fafafa;
    border-color: #8e8e8e;
}

.rp-sim-choice-btn.selected {
    border-color: #0095f6;
    background: #e8f4fd;
}

.rp-sim-choice-btn i {
    font-size: 22px;
    display: block;
    margin-bottom: 4px;
}

.rp-sim-choice-btn-label {
    font-size: 12px;
    font-weight: 600;
    color: #262626;
}

.rp-sim-choice-btn-follower i { color: #2ecc71; }
.rp-sim-choice-btn-nonfollower i { color: #ed4956; }

/* ── Controls ── */
.rp-sim-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #fff;
    border-top: 1px solid #dbdbdb;
    flex-shrink: 0;
}

.rp-sim-play-btn {
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: opacity 0.15s;
}

.rp-sim-play-btn-start {
    flex: 1;
    background: #0095f6;
    color: #fff;
}

.rp-sim-play-btn-start:hover {
    background: #1877f2;
}

.rp-sim-play-btn-reset {
    background: #efefef;
    color: #262626;
    flex: 0;
    padding: 8px 12px;
}

.rp-sim-play-btn-reset:hover {
    background: #dbdbdb;
}

.rp-sim-play-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

/* Status */
.rp-sim-status {
    font-size: 11px;
    color: #8e8e8e;
    text-align: center;
    padding: 4px 14px 2px;
    flex-shrink: 0;
}

/* ── Animations ── */
@keyframes rp-sim-fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes rp-sim-typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30%           { transform: translateY(-4px); }
}
