/* ======================================= */
/*   CREATIVE MODE - Brand Orange Theme    */
/* ======================================= */

[data-mode="creative"] {
    --creative-primary: var(--primary);
    --creative-primary-hover: var(--primary-hover);
}

/* Container */
.creative-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Section Header */
.section-header {
    text-align: center;
    margin-bottom: 2rem;
}

.section-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.section-title h1 {
    font-size: inherit;
    font-weight: inherit;
    margin: 0;
}

.section-icon {
    font-size: 1.25rem;
    color: var(--primary);
}

.section-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Service Selector */
.service-selector {
    display: flex;
    justify-content: center;
    gap: 0;
    background: var(--component-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 4px;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.service-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.service-tab:hover {
    color: var(--text);
    background: var(--secondary-bg);
}

.service-tab.active {
    background: var(--primary);
    color: #ffffff;
}

.tab-icon {
    font-size: 0.95rem;
}

.tab-text {
    white-space: nowrap;
}

/* Service Panel */
.service-panel {
    display: none;
}

.service-panel.active {
    display: block;
    animation: fadeInPanel 0.3s ease;
}

@keyframes fadeInPanel {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Service Card */
.service-card {
    background: var(--component-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    transition: border-color 0.2s ease;
}

.service-card:hover {
    border-color: var(--primary);
}

.service-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.service-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

/* Input Section */
.input-section {
    margin-bottom: 1.5rem;
}

.input-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.75rem;
}

.label-icon {
    font-size: 0.9rem;
    color: var(--primary);
}

.creative-textarea {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--secondary-bg);
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    transition: all 0.2s ease;
    direction: rtl;
    box-sizing: border-box;
}

.creative-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(24, 66, 67, 0.1);
}

[data-theme="dark"] .creative-textarea:focus {
    box-shadow: 0 0 0 3px rgba(208, 201, 185, 0.1);
}

.creative-textarea::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.char-counter {
    text-align: left;
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* Options */
.options-row {
    display: flex;
    align-items: flex-end;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.option-select {
    padding: 0.55rem 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--secondary-bg);
    color: var(--text);
    font-size: 0.88rem;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.option-select:focus {
    outline: none;
    border-color: var(--primary);
}

.toggle-button-group {
    display: flex;
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.toggle-button {
    padding: 0.4rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 600;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
}

.toggle-button.active {
    background: var(--primary);
    color: #fff;
}

/* Quick Options Grid */
.quick-options-grid {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.quick-option {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.85rem;
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
}

.quick-option:hover {
    border-color: var(--primary);
    color: var(--text);
}

.quick-option.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* Toggles Row */
.toggles-row {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text);
    cursor: pointer;
}

.toggle-label input[type="checkbox"] {
    display: none;
}

.toggle-switch {
    width: 36px;
    height: 20px;
    background: var(--border-color);
    border-radius: 10px;
    position: relative;
    transition: background 0.2s ease;
}

.toggle-switch::after {
    content: '';
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    right: 2px;
    transition: transform 0.2s ease;
}

.toggle-label input[type="checkbox"]:checked+.toggle-switch {
    background: var(--primary);
}

.toggle-label input[type="checkbox"]:checked+.toggle-switch::after {
    transform: translateX(-16px);
}

/* Upload Area */
.upload-section {
    margin-bottom: 1.5rem;
}

.upload-area,
.scenario-upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2rem;
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    background: var(--secondary-bg);
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.upload-area:hover,
.scenario-upload-area:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.upload-icon {
    font-size: 1.5rem;
}

/* Image Preview */
.image-preview {
    position: relative;
    display: inline-block;
    max-width: 200px;
}

.image-preview img {
    max-width: 100%;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.remove-image-btn {
    position: absolute;
    top: -8px;
    left: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

/* Scenario Preview */
.scenario-preview {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text);
    font-size: 0.88rem;
}

/* Generate Button */
.generate-btn-creative {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.9rem;
    background: var(--primary);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.generate-btn-creative:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.generate-btn-creative:active {
    transform: translateY(0);
}

.generate-btn-creative:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    font-size: 1rem;
}

.btn-loader {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Result Section */
.result-section {
    margin-top: 1.5rem;
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    overflow: hidden;
    animation: fadeInPanel 0.4s ease;
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.result-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}

.result-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
}

.action-btn:hover {
    background: var(--component-bg);
    border-color: var(--primary);
    color: var(--primary);
}

.result-content {
    padding: 1.25rem;
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--text);
    white-space: pre-wrap;
    word-wrap: break-word;
    direction: rtl;
}

.result-content.markdown-formatted {
    white-space: normal;
}

.result-content.markdown-formatted h1,
.result-content.markdown-formatted h2,
.result-content.markdown-formatted h3 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.result-content.markdown-formatted ul,
.result-content.markdown-formatted ol {
    padding-right: 1.5rem;
    margin: 0.5rem 0;
}

/* Icon Preview */
.icon-preview-section {
    padding: 1.25rem;
    border-top: 1px solid var(--border-color);
}

.icon-preview-section h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.75rem;
}

.icon-preview-grid {
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.preview-placeholder i {
    font-size: 1.5rem;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--component-bg);
    color: var(--text);
    padding: 0.65rem 1.25rem;
    border-radius: 8px;
    font-size: 0.88rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    z-index: 9999;
    transition: transform 0.3s ease;
    pointer-events: none;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* History Sidebar */
.history-sidebar {
    position: fixed;
    top: 56px;
    left: -350px;
    width: 320px;
    height: calc(100vh - 56px);
    background: var(--component-bg);
    border-right: 1px solid var(--border-color);
    z-index: 999;
    transition: left 0.3s ease;
    padding: 1.5rem;
    overflow-y: auto;
}

.history-sidebar.open {
    left: 0;
}

.history-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Font Awesome icon in tools */
.tool-icon-fa {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
    .creative-container {
        padding: 1.5rem 1rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .service-selector {
        flex-direction: column;
        max-width: 100%;
    }

    .service-card {
        padding: 1.5rem;
    }

    .options-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .options-grid {
        grid-template-columns: 1fr;
    }

    .quick-options-grid {
        flex-direction: column;
    }

    .toggles-row {
        flex-direction: column;
    }
}