/**
 * AI Story Maker Standalone Editor Styles
 */

.aistma-editor-container {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

/* Left sidebar removed - main content now takes full width */

.aistma-editor-main {
    flex: 1;
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 20px;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
    margin-right: 20px; /* Add margin to separate from right sidebar */
}

.aistma-editor-right-sidebar {
    width: 300px;
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 20px;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
}

.aistma-editor-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.aistma-editor-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.aistma-editor-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #23282d;
    font-size: 16px;
}

.aistma-instruction-text {
    font-weight: normal;
    font-size: 14px;
    color: #666;
    margin-left: 10px;
}

.aistma-improvement-panel textarea,
.aistma-tags-panel textarea,
.aistma-seo-panel textarea {
    width: 100%;
    margin-bottom: 10px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    resize: vertical;
    overflow-y: auto;
    min-height: 60px;
}

.aistma-improvement-panel textarea:focus,
.aistma-tags-panel textarea:focus,
.aistma-seo-panel textarea:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
    outline: none;
}

/* Operation type selection removed - now defaults to text_improve */

/* Images panel styles removed - Post Images section removed */

.aistma-editor-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    text-align: right;
}

.aistma-editor-actions .button {
    margin-left: 10px;
}

.aistma-result-panel {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
}

.aistma-result-panel h3 {
    margin-top: 0;
    color: #23282d;
}

#aistma-result-content {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 15px;
    min-height: 100px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* Preview styles */
.preview-h1 {
    font-size: 2em;
    font-weight: bold;
    margin: 0.67em 0;
    color: #23282d;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 0.2em;
}

.preview-h2 {
    font-size: 1.5em;
    font-weight: bold;
    margin: 0.83em 0;
    color: #23282d;
    border-bottom: 1px solid #ddd;
    padding-bottom: 0.1em;
}

.preview-h3 {
    font-size: 1.17em;
    font-weight: bold;
    margin: 1em 0;
    color: #23282d;
}

.preview-h4 {
    font-size: 1em;
    font-weight: bold;
    margin: 1.33em 0;
    color: #23282d;
}

.preview-h5 {
    font-size: 0.83em;
    font-weight: bold;
    margin: 1.67em 0;
    color: #23282d;
}

.preview-h6 {
    font-size: 0.67em;
    font-weight: bold;
    margin: 2.33em 0;
    color: #23282d;
}

.preview-p {
    margin: 1em 0;
    text-align: justify;
}

.preview-strong {
    font-weight: bold;
    color: #23282d;
}

.preview-em {
    font-style: italic;
    color: #666;
}

.preview-ul {
    margin: 1em 0;
    padding-left: 0;
}

.preview-ol {
    margin: 1em 0;
    padding-left: 0;
}

.preview-li {
    margin: 0.5em 0;
    padding-left: 1em;
    text-indent: -1em;
}

.preview-blockquote {
    margin: 1em 0;
    padding: 0.5em 1em;
    border-left: 4px solid #0073aa;
    background: #f0f8ff;
    font-style: italic;
    color: #555;
}

.preview-link {
    color: #0073aa;
    text-decoration: underline;
}

.preview-link small {
    color: #666;
    font-size: 0.8em;
    display: block;
    margin-top: 0.2em;
}

.preview-image {
    margin: 1em 0;
    padding: 1em;
    background: #f0f0f0;
    border: 2px dashed #ccc;
    border-radius: 4px;
    text-align: center;
    color: #666;
    font-style: italic;
}

.preview-image small {
    display: block;
    margin-top: 0.5em;
    font-size: 0.8em;
    color: #999;
}

.aistma-result-actions {
    text-align: right;
}

.aistma-result-actions .button {
    margin-left: 10px;
}

/* Loading states */
.aistma-loading {
    opacity: 0.6;
    pointer-events: none;
}

.aistma-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: aistma-spin 1s linear infinite;
}

@keyframes aistma-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Success/Error messages */
.aistma-message {
    padding: 10px 15px;
    margin: 10px 0;
    border-radius: 4px;
    border-left: 4px solid;
}

.aistma-message.success {
    background: #d4edda;
    border-left-color: #28a745;
    color: #155724;
}

.aistma-message.error {
    background: #f8d7da;
    border-left-color: #dc3545;
    color: #721c24;
}

/* Content preview container */
.aistma-content-preview-container {
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.aistma-content-preview {
    padding: 20px;
    min-height: 500px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #fff;
    user-select: text;
    cursor: text;
    position: relative;
}

.aistma-content-preview::selection {
    background: #0073aa;
    color: white;
}

.aistma-content-preview::-moz-selection {
    background: #0073aa;
    color: white;
}

.aistma-content-preview h1,
.aistma-content-preview h2,
.aistma-content-preview h3,
.aistma-content-preview h4,
.aistma-content-preview h5,
.aistma-content-preview h6 {
    margin: 1.5em 0 0.5em 0;
    color: #23282d;
    font-weight: 600;
}

.aistma-content-preview h1 {
    font-size: 2em;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 0.3em;
}

.aistma-content-preview h2 {
    font-size: 1.5em;
    border-bottom: 1px solid #ddd;
    padding-bottom: 0.2em;
}

.aistma-content-preview h3 {
    font-size: 1.25em;
}

.aistma-content-preview h4 {
    font-size: 1.1em;
}

.aistma-content-preview h5 {
    font-size: 1em;
}

.aistma-content-preview h6 {
    font-size: 0.9em;
}

.aistma-content-preview p {
    margin: 1em 0;
    text-align: justify;
}

.aistma-content-preview ul,
.aistma-content-preview ol {
    margin: 1em 0;
    padding-left: 2em;
}

.aistma-content-preview li {
    margin: 0.5em 0;
}

.aistma-content-preview blockquote {
    margin: 1.5em 0;
    padding: 1em 1.5em;
    border-left: 4px solid #0073aa;
    background: #f8f9fa;
    font-style: italic;
    color: #555;
}

.aistma-content-preview a {
    color: #0073aa;
    text-decoration: underline;
}

.aistma-content-preview a:hover {
    color: #005177;
}

.aistma-content-preview img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin: 1em 0;
}

.aistma-content-preview strong,
.aistma-content-preview b {
    font-weight: 600;
    color: #23282d;
}

.aistma-content-preview em,
.aistma-content-preview i {
    font-style: italic;
    color: #666;
}

.aistma-content-preview code {
    background: #f1f1f1;
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.aistma-content-preview pre {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 1em;
    overflow-x: auto;
    margin: 1em 0;
}

.aistma-content-preview pre code {
    background: none;
    padding: 0;
}

/* Responsive design */
@media (max-width: 768px) {
    .aistma-editor-container {
        flex-direction: column;
    }
    
    .aistma-editor-sidebar {
        width: 100%;
    }
    
    .aistma-tab-btn {
        padding: 10px 15px;
        font-size: 13px;
    }
    
    .aistma-content-preview {
        padding: 15px;
        min-height: 300px;
    }
}

/* Popup overlay */
.aistma-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aistma-popup-content {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.aistma-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px 0 20px;
    border-bottom: 1px solid #eee;
    margin-bottom: 20px;
}

.aistma-popup-header h3 {
    margin: 0;
    color: #23282d;
}

.aistma-popup-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.aistma-popup-close:hover {
    background: #f0f0f0;
    color: #333;
}

.aistma-popup-body {
    padding: 0 20px;
}

.selected-text-display {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
}

.selected-text-display h4 {
    margin: 0 0 10px 0;
    color: #23282d;
    font-size: 14px;
}

#popup-selected-text {
    font-style: italic;
    color: #666;
    line-height: 1.5;
    max-height: 100px;
    overflow-y: auto;
}

.improvement-prompt {
    margin-bottom: 20px;
}

.improvement-prompt label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #23282d;
}

.improvement-prompt textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    resize: vertical;
}

.improvement-prompt textarea:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
    outline: none;
}

/* Operation type selection removed - now defaults to text_improve */

.aistma-popup-footer {
    padding: 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.aistma-instructions {
    text-align: center;
    padding: 20px;
}

.aistma-instructions p {
    margin: 0;
    color: #666;
    font-style: italic;
}

.aistma-selection-info {
    margin-top: 15px;
    padding: 15px;
    background: #f0f8ff;
    border: 1px solid #0073aa;
    border-radius: 4px;
}

.aistma-selection-info h4 {
    margin: 0 0 10px 0;
    color: #0073aa;
    font-size: 14px;
}

#selected-text-preview {
    font-style: italic;
    color: #555;
    line-height: 1.4;
    max-height: 80px;
    overflow-y: auto;
}

/* Inline edit links in posts list */
.aistma-edit a {
    color: #0073aa;
    text-decoration: none;
}

.aistma-edit a:hover {
    color: #005177;
    text-decoration: underline;
}

/* Enhancement Status Widget */
.aistma-enhancement-status {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
}

.enhancement-summary {
    margin-bottom: 15px;
}

.enhancement-counter {
    font-size: 16px;
    margin-bottom: 8px;
}

.enhancement-remaining {
    color: #28a745;
    font-weight: 500;
}

.enhancement-limit-reached {
    color: #dc3545;
    font-weight: 500;
}

.enhancement-history-toggle {
    width: 100%;
    margin-bottom: 10px;
}

.enhancement-history-details {
    margin-top: 10px;
}

.enhancement-history-details table {
    font-size: 12px;
}

.enhancement-type-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
}

.enhancement-type-text_improve {
    background: #007cba;
    color: white;
}

.enhancement-type-image_insert,
.enhancement-type-image_replace {
    background: #00a32a;
    color: white;
}

/* Disabled button state */
.button:disabled,
.button.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

