#ai-edit-app {
    display: flex;
    gap: 18px;
    width: 85%;
    align-items: stretch;
    max-width: 1600px;
    margin: 30px auto;
    min-height: 540px;
}
.section-title {
    font-size: 1.1em;
    font-weight: bold;
    margin-bottom: 12px;
}
.editor-textarea {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 0;
}
#ai-post-id-display {
    font-size: 0.6em;
    color: #888;
    font-weight: normal;
    font-style: italic;
}

/* Panels */
#ai-edit-guidance,
#ai-edit-editor {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fff;
    border-radius: 12px;
}
#ai-edit-guidance {
    flex: 1.3 1 0%;
    max-width: 800px;
    min-width: 350px;
    border: 1px solid #ddd;
    padding: 15px;
}
#ai-edit-editor {
    flex: 2 1 0%;
    width: 100%;
    max-width: 920px;
    min-width: 350px;
    box-shadow: 0 2px 12px #eee;
    padding: 18px 16px;
}

/* Chat */
#ai-chat-history {
    min-height: 80px;
    max-height: none;
    height: auto;
    overflow: visible;
    background: #f9f9f9;
    margin-bottom: 10px;
    padding: 14px 8px;
    border-radius: 8px;
    border: 1px solid #f1f1f1;
    font-size: 1rem;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
#ai-chat-history .msg { display: flex; flex-direction: column; align-items: flex-start; margin-bottom: 4px; }
#ai-chat-history .msg.user { align-items: flex-end; }
#ai-chat-history .msg-body {
    padding: 10px 16px;
    border-radius: 18px 18px 4px 18px;
    background: #e6f9e6;
    color: #226622;
    max-width: 90%;
    margin-top: 2px;
    font-size: 1em;
    word-break: break-word;
}
#ai-chat-history .msg.user .msg-body {
    background: #e6f9e6;
    color: #226622;
    border-radius: 18px 18px 18px 4px;
    align-self: flex-end;
}
#ai-chat-history .msg.assistant { align-items: flex-start; }
#ai-chat-history .msg.assistant .msg-body {
    background: #e6ecfa;
    color: #2d437b;
    border-radius: 18px 18px 4px 18px;
    align-self: flex-start;
}
#ai-chat-message {
    width: 100%;
    min-height: 54px;
    max-height: 140px;
    padding: 8px;
    font-size: 1.05em;
    line-height: 1.5;
    border-radius: 7px;
    border: 1px solid #bbb;
    resize: vertical;
    background: #fcfcfc;
    margin-bottom: 6px;
}
#ai-guide-questions { margin: 8px 0; }

/* Editor */
#ai-edit-title {
    width: 100%;
    font-size: 1.18em;
    margin-bottom: 10px;
    padding: 7px 10px;
    border-radius: 6px;
    border: 1px solid #d2d2e0;
}
#ai-edit-content {
    width: 100%;
    min-height: 120px;
    height: auto;
    box-sizing: border-box;
    font-size: 1.08em;
    padding: 12px 11px;
    border-radius: 6px;
    border: 1px solid #ddd;
    overflow: hidden;
    resize: none;
    margin-bottom: 6px;
}
.tox-tinymce {
    margin-bottom: 6px;
}

/* Toggle Row */
.toggle-row {
    margin-bottom: 10px;
    display: flex;
    gap: 5px;
}

#toggle-visual,
#toggle-text {
    padding: 2px 7px;
    margin-right: 3px;
    border-radius: 3px;
    border: none;
    background: #f2f2f7;
    color: #222;
    font-size: 0.80em;
    min-height: 22px;
    cursor: pointer;
    transition: background 0.18s;
}
#toggle-visual.active,
#toggle-text.active {
    background: #467fd0;
    color: #fff;
}

/* Button Row */
.button-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    justify-content: space-between;
    padding-top: 10px;       /* Adds a little space above the button row */
    border-top: 1px solid #eee;  /* Optional: subtle separator */
}
.button-row .button-row-left {
    display: flex;
    gap: 8px;
    justify-content: flex-start;  /* Left-aligns children */
}
.button-row .button-row-right {
    display: flex;
    gap: 8px;
    justify-content: flex-end;    /* Right-aligns children */
}

.button-row button,
.toggle-row button {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25em;
    padding: 2px 7px;
    margin: 0 1px;
    border-radius: 4px;
    transition: background 0.15s;
    min-width: 36px;
    min-height: 22px;
}

.button-row button:hover,
.toggle-row button:hover,
.button-row button:focus,
.toggle-row button:focus {
    background: #eef;
}

/* Status Row */
.status-row {
    font-size: 0.78em;
    color: #888;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 12px;
}



/* Tooltip */
.icon-tooltip {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    left: 50%;
    bottom: 120%;
    transform: translateX(-50%);
    background: #23272f;
    color: #fff;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.85em;
    white-space: nowrap;
    pointer-events: none;
    transition: opacity 0.15s;
    z-index: 30;
    box-shadow: 0 3px 10px rgba(24,30,60,0.13);
}
.button-row button:hover .icon-tooltip,
.toggle-row button:hover .icon-tooltip,
.button-row button:focus .icon-tooltip,
.toggle-row button:focus .icon-tooltip {
    visibility: visible;
    opacity: 1;
}
.icon-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -7px;
    border-width: 7px;
    border-style: solid;
    border-color: #23272f transparent transparent transparent;
}

/* Split Publish Button */
.publish-dropdown {
    position: relative;
    display: inline-flex;
    vertical-align: middle;
    border-radius: 4px;
    overflow: visible;
    border: 1px solid #467fd0;
    background: #467fd0;
    min-height: 34px;
}
.publish-dropdown > button {
    margin: 0;
    border: none;
    background: none;
    color: #fff;
    font-size: 1.18em;
    cursor: pointer;
    transition: background 0.13s, color 0.13s;
    outline: none;
    border-radius: 0;
    font-weight: 500;
    box-shadow: none;
    padding: 2px 10px;
    min-width: 38px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
}
#ai-publish-draft {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #467fd0;
    font-size: 1.25em;
    padding: 2px 7px;
    height: 28px;
    min-width: 36px;
    border-radius: 0 4px 4px 0;
    border: none;
    color: #fff;
    transition: background 0.15s;
    box-sizing: border-box;
}
#ai-publish-draft:hover,
#ai-publish-draft:focus {
    background: #325ea8;
}
#ai-publish-draft .emoji-icon {
    font-size: 0.9em;  /* Or 0.8em for smaller */
    line-height: 1;
    display: inline-block;
    transform: translateY(2px); /* Optional: tweak vertical alignment */
}
#ai-publish-dropdown-toggle {
    background: #467fd0;
    font-size: 1em;
    border-radius: 0 4px 4px 0;
    border-left: 1px solid #2d437b;
    color: #fff;
    min-width: 18px;
    width: 18px;
    justify-content: center;
}
#ai-publish-dropdown-toggle:hover,
#ai-publish-dropdown-toggle:focus {
    background: #325ea8;
}
.tiny-arrow {
    font-size: 0.5em;
    vertical-align: middle;
    display: inline-block;
    line-height: 1;
}

/* Dropdown Menu */
.dropdown-menu {
    /* Sizing */
    min-width: 220px;
    width: 220px;
    font-size: 0.8em;

    /* Positioning */
    position: absolute;
    right: 0;
    left: auto;
    top: 100%;
    z-index: 9999;

    /* Appearance */
    background: #fff;
    border: 1px solid #ccc;           /* Updated from #bbb for consistency with inline style */
    box-shadow: 0 4px 18px rgba(20,40,80,0.10);
    padding: 0;
    margin: 2px 0 0 0;                /* margin-top: 2px per inline style, rest 0 */
    list-style: none;
    border-radius: 4px;

    /* Show/hide logic: hidden by default */
    display: none;
}

/* Optional: When menu should be visible, add a .show class from React */
.dropdown-menu.show {
    display: block;
}

.dropdown-menu li { margin: 0; padding: 0; }
.dropdown-menu button {
    width: 100%;
    text-align: left;
    padding: 0.55em 1.1em;
    border: none;
    background: none;
    color: #2d437b;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.13s, color 0.13s;
    border-radius: 0;
}
.dropdown-menu button:hover,
.dropdown-menu button:focus {
    background: #f0f4fb;
    color: #1a2950;
}

/* Responsive */
@media (max-width: 900px) {
    #ai-edit-app { flex-direction: column; gap: 14px; min-height: unset; }
    #ai-edit-guidance, #ai-edit-editor { max-width: 100%; }
}
@media (max-width: 600px) {
    #ai-edit-guidance { padding: 7px; }
    #ai-chat-history { padding: 8px 2px; font-size: 0.95em; }
    #ai-chat-history .msg-body { max-width: 95%; font-size: 0.97em; }
}
