* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft JhengHei", sans-serif;
    background: #f5f5f5;
    height: 100vh;
    overflow: hidden;
}

.container {
    display: flex;
    height: 100vh;
}

/* Left Panel - Main Editor */
.main-editor {
    flex: 1;
    background: white;
    padding: 40px;
    overflow-y: auto;
    border-right: 1px solid #e0e0e0;
}

.main-editor h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 24px;
}

.editor-field {
    margin-bottom: 30px;
}

.editor-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #555;
}

.editor-field input,
.editor-field textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.editor-field input:focus,
.editor-field textarea:focus {
    outline: none;
    border-color: #4CAF50;
}

.editor-field input {
    font-size: 18px;
    font-weight: 500;
}

.editor-field textarea {
    min-height: 400px;
    resize: vertical;
    line-height: 1.8;
}

/* Right Panel - AI Assistant */
.ai-panel {
    width: 500px;
    background: #fafafa;
    padding: 30px;
    overflow-y: auto;
    box-shadow: -2px 0 10px rgba(0,0,0,0.05);
}

.ai-panel h3 {
    color: #333;
    margin-bottom: 20px;
    font-size: 18px;
}

.search-box {
    margin-bottom: 25px;
}

.search-box input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 12px;
}

.search-box input:focus {
    outline: none;
    border-color: #4CAF50;
}

.btn-generate {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

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

.btn-generate:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.output-format {
    margin-top: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.output-format label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #555;
    font-size: 14px;
}

.output-format select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

.btn-export {
    width: 100%;
    padding: 12px;
    background: #FF9800;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: background 0.2s;
}

.btn-export:hover {
    background: #F57C00;
}

.char-count {
    font-size: 12px;
    color: #888;
    font-weight: 500;
    padding: 4px 8px;
    background: #f5f5f5;
    border-radius: 4px;
}

.char-count.warning {
    color: #FF9800;
    background: #FFF3E0;
}

.char-count.error {
    color: #f44336;
    background: #FFEBEE;
}

.loading {
    display: none;
    text-align: center;
    padding: 40px;
    color: #666;
}

.loading.active {
    display: block;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

.result-section {
    display: none;
}

.result-section.active {
    display: block;
}

.section-divider {
    border-top: 2px solid #e0e0e0;
    margin: 25px 0;
}

.section-header {
    font-size: 16px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #667eea;
    display: flex;
    align-items: center;
}

.section-header::before {
    content: '';
    display: inline-block;
    width: 5px;
    height: 20px;
    background: #667eea;
    margin-right: 10px;
    border-radius: 3px;
}

.content-card {
    background: white;
    border-radius: 8px;
    padding: 16px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.editable-area {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.8;
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
    background: white;
}

.editable-area:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-insert {
    width: 100%;
    padding: 14px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 25px;
    transition: background 0.2s, transform 0.2s;
}

.btn-insert:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.btn-apply-content {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-apply-content:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-apply-content:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.compose-loading {
    display: none;
    text-align: center;
    padding: 20px;
    color: #666;
}

.compose-loading.active {
    display: block;
}

.compose-loading .spinner {
    width: 30px;
    height: 30px;
}

.section-block {
    margin-bottom: 28px;
}

.highlight-card {
    background: linear-gradient(135deg, #f8f9ff 0%, #fff 100%);
    border: 1px solid #d0d7ff;
}

.suggested-title-block {
    margin-bottom: 20px;
}

.image-gen-section {
    margin-bottom: 30px;
}

#btn-generate-image:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(238, 90, 36, 0.3);
}

#btn-generate-image:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Step Indicator */
.step-indicator {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding: 12px 0;
    border-bottom: 1px solid #e0e0e0;
}

.step {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #bbb;
    font-weight: 600;
    transition: color 0.3s;
}

.step.active {
    color: #667eea;
}

.step.done {
    color: #4CAF50;
}

.step-number {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    background: #e0e0e0;
    color: white;
    transition: background 0.3s;
}

.step.active .step-number {
    background: #667eea;
}

.step.done .step-number {
    background: #4CAF50;
}

.step-arrow {
    margin: 0 10px;
    color: #ddd;
    font-size: 14px;
}

.section-include {
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-include input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.section-block.excluded .section-content textarea {
    opacity: 0.4;
    pointer-events: none;
}

.section-block.excluded .section-header {
    text-decoration: line-through;
    color: #bbb;
}

/* Search Results Section */
.search-results {
    display: none;
    margin-top: 15px;
}

.search-results.active {
    display: block;
}

.search-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.search-results-header span {
    font-weight: 600;
    color: #555;
    font-size: 14px;
}

.search-result-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: white;
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    transition: border-color 0.2s, background 0.2s;
}

.search-result-item:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.search-result-item input[type="checkbox"] {
    margin-top: 3px;
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-title {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    line-height: 1.5;
    display: block;
    margin-bottom: 4px;
}

.search-result-meta {
    font-size: 12px;
    color: #888;
}

.search-result-meta a {
    color: #667eea;
    text-decoration: none;
}

.search-result-meta a:hover {
    text-decoration: underline;
}

.btn-select-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.btn-select-actions button {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    font-size: 12px;
    cursor: pointer;
    color: #555;
    transition: background 0.2s;
}

.btn-select-actions button:hover {
    background: #f0f0f0;
}

.btn-generate-from-selected {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 12px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-generate-from-selected:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.btn-generate-from-selected:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.selected-count {
    font-size: 13px;
    color: #667eea;
    font-weight: 600;
}
