/* === PROMPT MANAGER STYLES V2.0 === */

/* --- Main Card --- */
.pm-card {
    background-color: #dfb770;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    margin: 30px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #374151;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    padding: 8px 24px 16px; /* top right&left bottom */
}

/* --- Sections --- */
.prompt-section {
    padding: 24px 0;
}

/* Add a border between sections */
.prompt-section + .prompt-section {
    border-top: 1px solid #e5e7eb;
}

/* --- Section Header --- */
.prompt-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 16px;
}

.prompt-section-title {
    font-size: 1.25rem; /* 20px */
    font-weight: 600;
    color: #111827;
    margin: 0;
}

/* --- Section Content --- */
.prompt-section-content p {
    margin: 0;
    line-height: 1.6;
}

/* Highlighted main prompt content */
.prompt-section-content.is-highlighted {
    background-color: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 20px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 1em;
    color: #1f2937;
}

/* --- Metadata Grid (2-column layout) --- */
.pm-metadata-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0 32px; /* vertical horizontal */
}

/* Reset border for items inside the grid */
.pm-metadata-grid .prompt-section {
    border-top: none;
    padding-top: 12px;
}

/* Re-add border for grid sections on top row */
.pm-metadata-grid .prompt-section:nth-child(n+3) {
   border-top: 1px solid #e5e7eb;
}
@media (max-width: 550px) {
    .pm-metadata-grid .prompt-section:nth-child(n+2) {
        border-top: 1px solid #e5e7eb;
    }
}


/* --- Elements Styling --- */
/* Copy Button */
.pm-button.pm-button-primary {
    background-color: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 10px 18px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
.pm-button.pm-button-primary:hover {
    background-color: #1d4ed8;
}

/* Taxonomy Tags */
.pm-term-tag {
    display: inline-block;
    background-color: #e5e7eb;
    color: #4b5563;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 9999px; /* pill shape */
    margin: 0 8px 8px 0;
    line-height: 1.5;
}

/* Variables Code Block */
.prompt-section-content code {
    background-color: #e5e7eb;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.9em;
}

/* === Frontend Generator Styles === */
.pm-pro-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    max-width: 800px;
    margin: 2em auto;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.07);
}
.pm-main-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
}
.pm-input-group {
    flex-grow: 1;
    width: 100%;
}
#pm-user-prompt-input { 
    width: 100%; 
    padding: 12px; 
    font-size: 16px; 
    line-height: 1.6; 
    border: 1px solid #e5e7eb; 
    border-radius: 8px; 
    transition: all 0.2s ease-in-out; 
    resize: vertical; 
    min-height: 80px; 
    box-sizing: border-box;
}
#pm-user-prompt-input:focus { 
    border-color: #2563eb; 
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15); 
    outline: none; 
}
#pm-generate-btn {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    background-color: #2563eb;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
#pm-generate-btn:hover:not(:disabled) { 
    background-color: #1d4ed8; 
}
#pm-generate-btn:disabled { 
    background-color: #9ca3af; 
    cursor: not-allowed; 
}
.pm-spinner { 
    width: 18px; 
    height: 18px; 
    border: 2px solid rgba(255, 255, 255, 0.5); 
    border-radius: 50%; 
    border-top-color: #fff; 
    display: none; 
    animation: pm-btn-spin 1s linear infinite; 
}
#pm-generate-btn.loading .pm-spinner { 
    display: inline-block; 
}
@keyframes pm-btn-spin { to { transform: rotate(360deg); } }
.pm-advanced-toggle { margin: 16px 0; text-align: center; }
.pm-advanced-toggle a { color: #2563eb; text-decoration: none; font-weight: 500; cursor: pointer; }
.pm-advanced-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; padding: 20px; background-color: #f9fafb; border-radius: 8px; margin-bottom: 16px; }
.pm-option-col label { display: block; font-size: 14px; font-weight: 500; color: #1f2937; margin-bottom: 8px; }
.pm-option-col select { width: 100%; padding: 10px; font-size: 15px; border: 1px solid #e5e7eb; border-radius: 6px; background-color: #ffffff; box-sizing: border-box; }
#pm-result-container { margin-top: 24px; }
.pm-tabs-nav { display: flex; border-bottom: 1px solid #e5e7eb; flex-wrap: wrap; }
.pm-tab { padding: 10px 20px; cursor: pointer; background: none; border: none; border-bottom: 3px solid transparent; font-size: 16px; font-weight: 600; color: #6b7280; transition: all 0.2s ease; margin-bottom: -1px; }
.pm-tab.active { color: #2563eb; border-bottom-color: #2563eb; }
.pm-tabs-content { padding: 24px; background-color: #f9fafb; border-radius: 0 0 8px 8px; border: 1px solid #e5e7eb; border-top: none; }
.pm-tab-content { display: none; }
.pm-tab-content.active { display: block; }
.pm-feedback-message { padding: 12px; border-radius: 8px; margin-top: 16px; text-align: center; font-weight: 500; }
.pm-feedback-message.error { background-color: #fee2e2; color: #ef4444; border: 1px solid #fca5a5; }

/* Skeleton Loader */
#pm-loader { margin-top: 24px; }
.pm-skeleton-item { border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden; animation: pm-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.pm-skeleton-tabs { padding: 10px 20px; border-bottom: 1px solid #e5e7eb; display: flex; gap: 20px; }
.pm-skeleton-tab { width: 80px; height: 24px; background-color: #f3f4f6; border-radius: 4px; }
.pm-skeleton-content { padding: 24px; }
.pm-skeleton-line { height: 16px; background-color: #f3f4f6; border-radius: 4px; margin-bottom: 12px; }
.pm-skeleton-line.short { width: 60%; }
@keyframes pm-pulse { 50% { opacity: 0.6; } }

/* === Frontend Toolkit Styles === */
.pm-veo-tabs { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 15px; margin-bottom: 25px; border-bottom: 1px solid #e5e7eb; }
.pm-veo-tab-link { padding: 8px 16px; border-radius: 20px; background-color: #f9fafb; color: #1f2937; font-weight: 500; font-size: 15px; transition: all 0.2s ease-in-out; cursor: pointer; border: 1px solid #e5e7eb; }
.pm-veo-tab-link:hover { background-color: #e5e7eb; }
.pm-veo-tab-link.active { background-color: #2563eb; color: white; border-color: #2563eb; }
.pm-veo-tab-content { display: none; }
.pm-veo-tab-content.active { display: block; }
#pm-brainstorm-keyword, #pm-optimize-input { width: 100%; padding: 12px; font-size: 16px; line-height: 1.6; border: 1px solid #e5e7eb; border-radius: 8px; transition: all 0.2s ease-in-out; box-sizing: border-box; }
.pm-result-wrapper { position: relative; padding-right: 50px; }
.pm-result-wrapper .pm-copy-btn { position: absolute; top: 10px; right: 10px; }
.pm-brainstorm-results { margin-top: 25px; border-top: 1px solid #e5e7eb; padding-top: 20px; }
.pm-viral-analysis-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 20px; }
.pm-analysis-section { margin-bottom: 20px; }
.pm-analysis-section:last-child { margin-bottom: 0; }
.pm-section-title { display: block; font-size: 13px; font-weight: 700; text-transform: uppercase; color: #6b7280; margin-bottom: 8px; }
.pm-analysis-section p { margin: 0; font-size: 15px; line-height: 1.6; }
.pm-analysis-section .pm-suggestion-item:hover { color: #2563eb; cursor: pointer; }

/* === Run Prompt Modal Styles === */
.pm-modal-wrapper { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.6); z-index: 1000; justify-content: center; align-items: center; padding: 15px; }
.pm-modal-content { background: #fff; padding: 0; border-radius: 12px; width: 90%; max-width: 700px; position: relative; box-shadow: 0 5px 25px rgba(0,0,0,0.2); display: flex; flex-direction: column; max-height: 90vh; }
.pm-modal-header { display: flex; justify-content: space-between; align-items: center; padding: 15px 25px; border-bottom: 1px solid #e5e7eb; }
.pm-modal-header h3 { margin: 0; font-size: 18px; }
.pm-modal-close-btn { background: none; border: none; font-size: 28px; line-height: 1; cursor: pointer; color: #aaa; }
.pm-modal-body { padding: 25px; overflow-y: auto; }
.pm-modal-footer { display: flex; justify-content: flex-end; padding: 15px 25px; border-top: 1px solid #e5e7eb; background-color: #f9fafb; }
.pm-run-btn { background-color: #2ecc71 !important; border-color: #27ae60 !important; }
.pm-run-btn:hover { background-color: #27ae60 !important; }

/* === AI Summarizer Styles === */
.pm-summarizer-container h3 { margin-top: 0; }
.pm-summarizer-container .pm-form-group { margin-bottom: 20px; }
.pm-summarizer-container .pm-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; }
.pm-summarizer-container .pm-radio-group { display: flex; flex-direction: column; gap: 10px; }
.pm-summarizer-container .pm-radio-group label { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.pm-summarizer-container textarea, .pm-summarizer-container select { width: 100%; padding: 12px; font-size: 16px; border: 1px solid #e5e7eb; border-radius: 8px; box-sizing: border-box; }

/* === AI Composer Styles === */
.pm-composer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.pm-composer-col-left, .pm-composer-col-right { display: flex; flex-direction: column; gap: 20px; }
.pm-image-drop-zone { border: 2px dashed #d1d5db; border-radius: 8px; padding: 20px; text-align: center; cursor: pointer; transition: all 0.2s ease; position: relative; }
.pm-image-drop-zone:hover, .pm-image-drop-zone.is-dragover { border-color: #2563eb; background-color: #f9fafb; }
#pm-image-preview-wrapper { position: relative; }
#pm-image-preview { max-width: 100%; max-height: 150px; border-radius: 6px; }
#pm-remove-image-btn { position: absolute; top: -10px; right: -10px; background: #333; color: white; border: none; width: 24px; height: 24px; border-radius: 50%; font-weight: bold; cursor: pointer; }
#pm-composer-output { width: 100%; box-sizing: border-box; resize: none; background-color: #f9fafb; border-color: #e5e7eb; }
#pm-composer-copy-btn { position: absolute; bottom: 10px; right: 10px; }
@media screen and (max-width: 768px) { .pm-composer-grid { grid-template-columns: 1fr; } }

/* === AI Seeding Comments Styles === */
.pm-seeding-output-list { display: flex; flex-direction: column; gap: 10px; }
.pm-seeding-comment-item { display: flex; align-items: center; gap: 10px; background-color: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px; padding: 10px 15px; }
.pm-seeding-comment-item p { margin: 0; flex-grow: 1; }
.pm-seeding-comment-item .pm-copy-btn { flex-shrink: 0; }
/* === Nâng cấp Giao diện Danh sách Kết quả (Đánh giá & Bình luận) === */

.pm-seeding-output-list {
    display: flex;
    flex-direction: column;
    gap: 0; /* Bỏ khoảng cách, dùng đường kẻ */
}

.pm-seeding-comment-item {
    display: flex;
    align-items: center;
    justify-content: space-between; /* Đẩy nút Sao chép sang phải */
    gap: 20px; /* Khoảng cách giữa chữ và nút */
    
    /* Ghi đè các style cũ */
    background-color: transparent;
    border: none;
    border-radius: 0;
    
    /* Thêm đường kẻ dưới */
    border-bottom: 1px solid #e5e7eb;
    padding: 15px 5px; /* Điều chỉnh lại padding */
}

/* Bỏ đường kẻ cho phần tử cuối cùng */
.pm-seeding-comment-item:last-child {
    border-bottom: none;
}

.pm-seeding-comment-item p {
    margin: 0;
    flex-grow: 1; /* Cho phép text chiếm hết không gian trống */
    text-align: left;
    line-height: 1.6;
}

.pm-seeding-comment-item .pm-copy-btn {
    flex-shrink: 0; /* Ngăn nút bị co lại */
    padding: 8px 16px !important; /* Đồng bộ kích thước nút */
}

/* === AI JSON Analyzer Styles === */
#pm-analyzer-result-wrapper pre {
    background-color: #2d2d2d;
    color: #f8f8f2;
    padding: 20px;
    border-radius: 8px;
    min-height: 300px;
    height: 100%;
    box-sizing: border-box;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
}
#pm-analyzer-copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
}
/* === AI Prompt Architect Styles === */
.pm-architect-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.pm-architect-col h4 { margin-top: 0; border-bottom: 1px solid #e5e7eb; padding-bottom: 10px; margin-bottom: 20px; }
.pm-architect-col .pm-form-group { margin-bottom: 15px; }
.pm-architect-col .pm-form-group label { font-weight: 600; display: block; margin-bottom: 8px; }
.pm-architect-input { width: 100%; padding: 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px; line-height: 1.6; box-sizing: border-box; resize: vertical; }
.pm-ai-suggest-btn { background: none; border: 1px solid #d1d5db; color: #374151; font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 4px; cursor: pointer; display: block; margin-top: 8px; transition: all 0.2s ease; }
.pm-ai-suggest-btn:hover { background: #f3f4f6; border-color: #6b7280; }
.pm-ai-suggest-btn.is-loading { cursor: wait; background: #e5e7eb; }
#architect-final-prompt { width: 100%; box-sizing: border-box; background-color: #f9fafb; color: #374151; }
#architect-copy-btn { position: absolute; bottom: 10px; right: 10px; }
@media screen and (max-width: 850px) { .pm-architect-grid { grid-template-columns: 1fr; } }

/* Read More for Prompt Content */
.pm-expandable-content {
    position: relative;
    overflow: hidden;
 
}


.pm-expandable-content.is-collapsed {
    max-height: 120px; /* Adjust this value to control the initial visible height (approx. 5 lines) */
}

/* Gradient overlay for collapsed state */
.pm-expandable-content.is-collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: linear-gradient(to bottom, transparent, #f3f4f6);
    pointer-events: none;
}

.pm-read-more-btn {
    display: block;
    margin: 15px auto 0;
    cursor: pointer;
    background-color: #e5e7eb;
    color: #374151;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    transition: background-color 0.2s ease;
}

.pm-read-more-btn:hover {
    background-color: #d1d5db;
}
.pm-card.prompt-unified-box {
    padding: 10px;
    box-shadow: rgba(17, 17, 26, 0.1) 0px 0px 16px;
}
/* === Related Prompts Styles === */
.pm-related-prompts {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid #e5e7eb;
}

.pm-related-prompts h2 {
    font-size: 1.5rem; /* 24px */
    font-weight: 600;
    margin-bottom: 20px;
    color: #111827;
}

.pm-related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.pm-related-item {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s ease-in-out, transform 0.2s ease-in-out;
}

.pm-related-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -4px rgba(0, 0, 0, 0.07);
}

.pm-related-item a {
    text-decoration: none;
    color: #111827;
    display: block;
}

.pm-related-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.pm-related-item h4 {
    font-size: 1rem; /* 16px */
    font-weight: 600;
    margin: 0;
    padding: 15px;
    line-height: 1.4;
}
/* === NÂNG CẤP: Styling cho các biến số trong prompt === */
.pm-prompt-variable {
    background-color: #e5e7eb; /* Nền xám nhạt */
    color: #1f2937; /* Chữ đen */
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    font-family: monospace; /* Font chữ giống code để dễ nhìn */
}
/* Spinner Animation */
.pm-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: #2563eb; /* Màu của spinner */
    border-radius: 50%;
    animation: pm-spin 1s linear infinite;
}

@keyframes pm-spin {
    to {
        transform: rotate(360deg);
    }
}
.pm-variations-section { margin-top: 40px; padding-top: 30px; border-top: 1px solid #e5e7eb; }
.pm-variations-section h2 { font-size: 1.5rem; font-weight: 600; margin-bottom: 20px; color: #111827; }
.pm-variation-item { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px; margin-bottom: 15px; padding: 20px; }
.pm-variation-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.pm-variation-header h4 { margin: 0; font-size: 1.1rem; color: #111827; }
.pm-variation-item p { margin: 0; line-height: 1.6; }