/* Styles from original fbpost.php */

.ai-post-generator-container {
    margin: 20px;
}

.div-input {
    background-color: #fff;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 10;
}

.input {
    width: 90%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-bottom: 10px;
    text-align: right;
}

#submit-button,
#select-all-button,
#copy-button,
#stop-button {
    background-color: #007bff;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 10px 15px;
    cursor: pointer;
    font-weight: bold;
    margin: 0 5px;
    transition: background-color 0.3s;
}

#select-all-button {
    background-color: #28a745;
}

#select-all-button:hover {
    background-color: #218838;
}

#copy-button {
    background-color: #17a2b8;
}

#copy-button:hover {
    background-color: #138496;
}

#stop-button {
    background-color: #dc3545;
}

#stop-button:hover {
    background-color: #c82333;
}

#submit-button:hover,
#select-all-button:hover,
#copy-button:hover,
#stop-button:hover {
    opacity: 0.9;
}

#submit-button:disabled,
#copy-button:disabled,
#stop-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.button-container {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    position: relative;
    z-index: 100;
}

.ai-limit-message {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 15px;
    margin: 20px 0;
    border-radius: 4px;
    position: relative;
    z-index: 1;
    clear: both;
}

.div-chat {
    background-color: #ffffff;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    min-height: 200px;
    line-height: 1.5;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    direction: rtl;
    text-align: right;
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    color: #2c3e50;
    font-size: 18px;
    font-weight: 400;
    display: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.div-chat.ai-chat-visible {
    display: block;
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.div-chat:not(:empty) {
    color: #2c3e50;
    font-style: normal;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
}

.div-chat:hover {
    border-color: #4299e1;
    box-shadow: 0 8px 16px rgba(66, 153, 225, 0.2);
    transform: translateY(-2px);
    transition: all 0.3s ease;
}

.div-chat:active {
    border-color: #3182ce;
    box-shadow: 0 4px 12px rgba(49, 130, 206, 0.3);
    transform: translateY(0);
}

/* Notification styles */
.ai-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    color: white;
    font-weight: bold;
    z-index: 10000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    font-size: 14px;
    animation: slideIn 0.3s ease-out;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    max-width: 300px;
    word-wrap: break-word;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.ai-notification-success {
    background-color: #27ae60;
}

.ai-notification-error {
    background-color: #e74c3c;
}

.ai-notification-info {
    background-color: #3498db;
}

.div-responseBox {
    border: 1px solid #ccc;
    padding: 10px;
    margin-top: 20px;
    width: 100%;
    font-weight: bold;
    font-size: 16px;
    border-radius: 4px;
}

.progress {
    position: relative;
    width: 100%;
    height: 20px;
    background-color: #f3f3f3;
    border-radius: 10px;
    overflow: hidden;
    display: none; /* Hidden by default */
}

.progress-bar {
    position: absolute;
    width: 0;
    height: 100%;
    background-color: #4caf50;
    border-radius: 10px;
    transition: width 0.9s ease;
}

.progress-indicator {
    display: none;
}

.question-type-container,
.lang-type-container,
.api-provider-container,
.socials-type-container,
.custom-field-container {
    display: inline-block;
    vertical-align: top;
    margin-right: 10px;
}

.question-type-label,
.lang-type-label,
.socials-label,
.api-provider-label,
.custom-field-label {
    display: block;
    margin-bottom: 5px;
}

.question-type-dropdown,
.lang-type-dropdown,
.socials-dropdown,
.api-provider-dropdown,
.ai-custom-field {
    width: 150px;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-align: right;
}

.div-chat, .div-responseBox {
    background-color: #fff;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    direction: rtl;
}

/* Style the progress bar container */
.progress-container {
    width: 100%;
    background-color: #f3f3f3;
}

/* Style the progress bar */
.progress-bar {
    width: 0%;
    height: 10px;
    background-color: #4caf50;
    text-align: center;
    line-height: 10px;
    color: white;
    animation: progress-animation 15s ease-out forwards; /* Animation duration is 4 seconds */
}

/* Keyframe animation for the progress bar */
@keyframes progress-animation {
    0% { width: 0%; } /* Start with 0% width */
    100% { width: 75%; } /* End with 100% width */
}

.download-buttons {
    margin-top: 15px;
    text-align: center;
    padding: 10px;
}
.download-buttons button {
    margin: 5px;
    padding: 8px 15px;
}
.download-buttons i {
    margin-right: 5px;
}

.message-box table {
    direction: rtl;
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

.message-box th, .message-box td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: right;
}

.message-box th {
    background-color: #f5f5f5;
    font-weight: bold;
}

.message-box tr:nth-child(even) {
    background-color: #f9f9f9;
}

.message-box tr:hover {
    background-color: #f0f0f0;
}

.markdown-body {
    direction: rtl;
    text-align: right;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    font-size: 18px;
    line-height: 1.5;
    word-wrap: break-word;
    padding: 20px;
    height: auto;
    overflow-y: visible;
    color: #2c3e50;
    font-weight: 400;
}

#chat {
    height: 250px !important;
    overflow-y: auto !important;
    position: relative;
    scroll-behavior: smooth;
}

#chat::-webkit-scrollbar {
    width: 8px;
}

#chat::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#chat::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

#chat::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.markdown-body::-webkit-scrollbar {
    width: 0 !important;
    display: none;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    margin-top: 16px;
    margin-bottom: 12px;
    font-weight: 700;
    line-height: 1.3;
    color: #1a252f;
}

.markdown-body table {
    direction: rtl;
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    overflow: auto;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.markdown-body table th,
.markdown-body table td {
    border: 1px solid #e2e8f0;
    padding: 12px 16px;
    text-align: right;
    font-size: 16px;
}

.markdown-body table th {
    background-color: #edf2f7;
    font-weight: 600;
    color: #2d3748;
}

.markdown-body table tr:nth-child(even) {
    background-color: #f7fafc;
}

.markdown-body table tr:hover {
    background-color: #edf2f7;
    transition: background-color 0.2s ease;
}

.markdown-body p {
    margin: 8px 0;
    color: #2d3748;
}

.markdown-body ul,
.markdown-body ol {
    padding-right: 24px;
    padding-left: 0;
    margin: 8px 0;
}

.markdown-body li {
    margin: 4px 0;
    color: #4a5568;
}

.markdown-body code,
.markdown-body pre {
    background: #f8f9fa;
    color: #2d3748;
    border-radius: 8px;
    font-family: 'Consolas', 'Monaco', 'Liberation Mono', 'Courier New', monospace;
    border: 1px solid #e2e8f0;
}

.markdown-body code {
    padding: 0.25em 0.5em;
    font-size: 0.9em;
    font-weight: 500;
}

.markdown-body pre {
    padding: 20px;
    overflow-x: auto;
    margin: 12px 0;
    font-size: 16px;
    line-height: 1.4;
}

.markdown-body blockquote {
    padding: 20px;
    background: #f7fafc;
    border-right: 4px solid #4299e1;
    border-radius: 0 8px 8px 0;
    margin: 12px 0;
    font-style: italic;
    color: #4a5568;
}
}

.markdown-body a {
    color: #3182ce;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.markdown-body a:hover {
    color: #2c5282;
    text-decoration: underline;
}

.markdown-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 8px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.markdown-body em,
.markdown-body i {
    color: #475569;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    color: #111827;
}

.markdown-body strong {
    font-weight: 1000;
}

.markdown-body hr {
    height: 0.25em;
    margin: 16px 0;
    background-color: #e1e4e8;
    border: 0;
}

.markdown-body blockquote {
    padding: 0 1em;
    color: #6a737d;
    border-right: 0.25em solid #dfe2e5;
    border-left: 0;
    margin: 0;
}

.markdown-body::-webkit-scrollbar {
    width: 8px;
}

.markdown-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.markdown-body::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.markdown-body::-webkit-scrollbar-thumb:hover {
    background: #555;
}


.toolbar {
    margin-bottom: 10px;
    padding: 5px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Language Switcher in Menu */
.ai-menu-language-switcher {
    list-style: none;
    display: inline-block;
    margin-left: 20px;
}

.ai-menu-language-switcher .ai-language-select {
    padding: 8px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ai-menu-language-switcher .ai-language-select:hover {
    border-color: #007bff;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.3);
}

.ai-menu-language-switcher .ai-language-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
}

/* Language Switcher Container */
.ai-language-switcher {
    display: inline-block;
    margin: 10px;
}

.ai-language-switcher select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    color: #333;
    font-size: 14px;
    cursor: pointer;
}

.ai-language-switcher select:hover {
    border-color: #007bff;
}

/* Fixed Language Switcher (displayed at top of page) */
.ai-language-switcher-fixed {
    position: fixed;
    top: 10px;
    left: 10px;
    background-color: #fff;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-language-switcher-fixed label {
    margin: 0;
    font-weight: bold;
    color: #333;
    font-size: 13px;
}

.ai-language-select-floating {
    padding: 6px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
    color: #333;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ai-language-select-floating:hover {
    border-color: #007bff;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.3);
}

.ai-language-select-floating:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
}

/* RTL Support */
.ai-language-switcher-fixed[dir="rtl"] {
    left: auto;
    right: 10px;
    flex-direction: row-reverse;
}

.ai-post-generator-container[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

.ai-post-generator-container[dir="ltr"] {
    direction: ltr;
    text-align: left;
}

.ai-post-generator-container[dir="rtl"] .button-container,
.ai-post-generator-container[dir="rtl"] .custom-field-container {
    direction: rtl;
}

.ai-post-generator-container[dir="rtl"] label,
.ai-post-generator-container[dir="rtl"] input,
.ai-post-generator-container[dir="rtl"] textarea,
.ai-post-generator-container[dir="rtl"] select {
    direction: rtl;
    text-align: right;
}

.ai-post-generator-container[dir="ltr"] input,
.ai-post-generator-container[dir="ltr"] textarea,
.ai-post-generator-container[dir="ltr"] select {
    direction: ltr;
    text-align: left;
}

.toolbar select {
    height: 30px;
    margin: 0 5px;
    padding: 0 5px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background-color: white;
}

/* Translated content direction support */
.ai-translated-content[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

.ai-translated-content[dir="ltr"] {
    direction: ltr;
    text-align: left;
}

.toolbar .color-btn {
    width: 30px;
    height: 30px;
    padding: 0;
    margin: 0 2px;
    border: 1px solid #ddd;
    border-radius: 3px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.toolbar .color-btn i {
    font-size: 14px;
}

.toolbar .color-picker {
    position: absolute;
    width: 30px;
    height: 30px;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

.toolbar .color-preview {
    width: 20px;
    height: 4px;
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #000;
}

.toolbar button {
    margin: 0 2px;
}

.toolbar button:hover {
    background-color: #e0e0e0;
}

.toolbar select.heading-select {
    min-width: 120px;
    height: 30px;
    padding: 0 5px;
    margin: 0 5px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background-color: white;
    font-family: Arial, sans-serif;
}

/* Workflow steps: compact presentation */
#ai-workflow-steps-container .ai-workflow-steps-panel {
    max-height: none;
    overflow: visible;
    scrollbar-width: thin;
    width: 100%;
    box-sizing: border-box;
}

#ai-workflow-steps-container .ai-workflow-steps-panel h3 {
    margin: 0 0 4px;
    line-height: 1.2;
}

#ai-workflow-steps-container .ai-workflow-steps-list {
    display: none !important;
}

#ai-workflow-steps-container .ai-workflow-step {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 0;
    min-height: 18px;
    height: 18px;
    background: #e5e7eb;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
    position: relative;
    overflow: hidden;
    transition: background 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
    scroll-snap-align: start;
}

#ai-workflow-steps-container .ai-workflow-step:hover {
    transform: translateY(-1px);
    border-color: #cbd5e1;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

#ai-workflow-steps-container .ai-workflow-step-number {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    color: #475569;
    text-shadow: 0 1px 0 rgba(255,255,255,0.6);
    letter-spacing: 0.01em;
}

#ai-workflow-steps-container .ai-workflow-step[data-step-index] {
    position: relative;
}

#ai-workflow-steps-container .ai-workflow-step[data-step-index][title] {
    cursor: help;
}

#ai-workflow-steps-container .ai-workflow-step[data-step-index]:focus-within,
#ai-workflow-steps-container .ai-workflow-step[data-step-index].is-active {
    border-color: #93c5fd;
    background: linear-gradient(180deg, #f8fbff 0%, #eff6ff 100%);
}

#ai-workflow-steps-container .ai-workflow-step.is-complete {
    background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%);
    border-color: #16a34a;
}

#ai-workflow-steps-container .ai-workflow-step.is-complete.is-downloadable {
    cursor: pointer;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.2) inset, 0 6px 16px rgba(22, 163, 74, 0.18);
}

#ai-workflow-steps-container .ai-workflow-step.is-complete.is-downloadable:hover {
    transform: translateY(-1px) scale(1.01);
    filter: brightness(1.03);
}

#ai-workflow-steps-container .ai-workflow-step.is-active {
    background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%);
    border-color: #f59e0b;
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.18) inset;
}

#ai-workflow-steps-container .ai-workflow-step.is-failed {
    background: linear-gradient(180deg, #f87171 0%, #dc2626 100%);
    border-color: #dc2626;
}

#ai-workflow-steps-container .ai-workflow-step.is-skipped {
    background: linear-gradient(180deg, #a855f7 0%, #7c3aed 100%);
    border-color: #7c3aed;
}

#ai-workflow-generated-items {
    background: linear-gradient(180deg, rgba(248,250,252,0.98) 0%, rgba(255,255,255,0.96) 100%);
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 8px 8px 6px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
}

#ai-workflow-generated-items-list {
    display: flex;
    flex-direction: row;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 4px;
    scrollbar-width: thin;
    scroll-snap-type: x proximity;
}

.ai-workflow-generated-item {
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    gap: 0;
    padding: 5px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
    min-width: 42px;
    width: 42px;
    flex: 0 0 42px;
    aspect-ratio: 1 / 1;
    scroll-snap-align: start;
    position: relative;
    overflow: hidden;
}

.ai-workflow-generated-item:hover {
    transform: translateY(-1px) scale(1.02);
    border-color: #cbd5e1;
    background: #f8fafc;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    filter: saturate(1.03);
}

.ai-workflow-generated-item-thumb {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    position: relative;
    margin: auto;
    border-radius: 10px;
    overflow: hidden;
    background: linear-gradient(135deg, #dbeafe 0%, #e2e8f0 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.5);
}

.ai-workflow-generated-item-thumb img,
.ai-workflow-generated-item-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.ai-workflow-generated-item-thumb.is-audio,
.ai-workflow-generated-item-thumb.is-generic {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0f172a;
    font-size: 16px;
    font-weight: 700;
}

.ai-workflow-generated-item-thumb-badge {
    position: absolute;
    inset: auto 2px 2px auto;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.72);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    line-height: 1;
    pointer-events: none;
}

.ai-workflow-generated-item-meta {
    display: none;
}

.ai-workflow-generated-item-step {
    color: #0f172a;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.ai-workflow-generated-item-body {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
}

.ai-workflow-generated-item-type {
    color: #334155;
    font-size: 10px;
    background: #e2e8f0;
    border-radius: 999px;
    padding: 2px 8px;
    white-space: nowrap;
}

.ai-workflow-generated-item-hint {
    color: #16a34a;
    font-size: 10px;
    font-weight: 700;
    background: #dcfce7;
    border-radius: 999px;
    padding: 2px 8px;
    white-space: nowrap;
}

#ai-workflow-result-container #ai-workflow-result-content {
    padding: 10px 12px;
}

#ai-workflow-result-container #ai-workflow-result-content h3 {
    margin: 0 0 8px;
    line-height: 1.2;
}

#ai-workflow-result-container #ai-workflow-result-video,
#ai-workflow-result-container #ai-workflow-result-merged-video {
    margin-bottom: 8px;
}

#ai-workflow-result-container #ai-workflow-download-btn-container {
    margin-top: 8px;
}

@media (max-width: 768px) {
    #ai-workflow-steps-container .ai-workflow-steps-panel {
        max-height: none;
    }

    #ai-workflow-steps-container .ai-workflow-steps-list {
        gap: 1px;
    }

    #ai-workflow-steps-container .ai-workflow-step {
        min-height: 16px;
        height: 16px;
    }

    #ai-workflow-steps-container .ai-workflow-step-number {
        font-size: 8px;
    }

    .ai-workflow-generated-item {
        min-width: 40px;
        width: 40px;
        flex-basis: 40px;
    }

    #ai-workflow-result-container #ai-workflow-result-content {
        padding: 8px 10px;
    }
}

@media (min-width: 1200px) {
    #ai-workflow-steps-container .ai-workflow-step-number {
        font-size: 10px;
    }
}
