
/* =========================================
   Layout & Filters
   ========================================= */
#pd-visualizer-app {
    max-width: 1200px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.pd-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    background: #f9f9f9;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 20px;
}

.pd-filter-group {
    flex: 1;
    min-width: 150px;
}

.pd-filter-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 12px;
    color: #555;
}

.pd-filter-group select,
.pd-filter-group input {
    width: 100%;
    max-width: 100%;
}

.pd-view-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.pd-btn-view {
    padding: 8px 16px;
    border: 1px solid #ccc;
    background: #fff;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s;
}

.pd-btn-view:hover {
    background: #f0f0f0;
}

.pd-btn-view.active {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

/* =========================================
   Ideas Grid (Card View)
   ========================================= */
.pd-ideas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.pd-idea-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    position: relative;
}

.pd-idea-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.pd-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 12px;
}

.pd-card-category {
    font-weight: bold;
    color: #0073aa;
}

.pd-card-user {
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
    background: #eee;
}

.pd-card-body {
    flex-grow: 1;
    margin-bottom: 10px;
}

.pd-card-body blockquote {
    margin: 0 0 10px 0;
    font-style: italic;
    color: #333;
    border-left: 3px solid #eee;
    padding-left: 10px;
}

.pd-card-comment {
    font-size: 13px;
    color: #666;
    margin: 0;
}

.pd-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 10px;
}

.pd-card-tag {
    background: #f0f0f1;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    color: #555;
}

.pd-card-footer {
    border-top: 1px solid #eee;
    padding-top: 10px;
    margin-top: auto;
}

.pd-card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #999;
}

.pd-delete-card-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    color: #ccc;
    cursor: pointer;
    font-weight: bold;
    border-radius: 50%;
    font-size: 16px;
    z-index: 2;
}

.pd-delete-card-btn:hover {
    color: #d63638;
    background: rgba(214, 54, 56, 0.1);
}

/* =========================================
   List View
   ========================================= */
.pd-group-section {
    margin-bottom: 30px;
}

.pd-group-title {
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 15px;
    color: #23282d;
}

.pd-list-item {
    background: #fff;
    border: 1px solid #eee;
    padding: 10px 15px;
    margin-bottom: 10px;
    border-radius: 4px;
    position: relative;
    transition: background 0.2s;
}

.pd-list-item:hover {
    background: #f9f9f9;
}

.pd-list-item-content {
    font-size: 14px;
    margin-bottom: 5px;
    padding-right: 20px;
}

.pd-list-item-meta {
    font-size: 12px;
    color: #888;
}

/* =========================================
   Chat Interface
   ========================================= */
.pd-chat-interface {
    display: flex;
    height: 600px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    overflow: hidden;
}

.pd-chat-sidebar {
    background: #f9f9f9;
    padding: 15px;
    overflow-y: auto;
}

.pd-conversation-item {
    padding: 8px;
    margin-bottom: 5px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pd-conversation-item:hover {
    background: #e5e5e5;
}

.pd-conversation-item.active {
    background: #0073aa;
    color: #fff;
}

.pd-delete-conversation {
    display: inline-block;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    color: #ccc;
    cursor: pointer;
    font-weight: bold;
    border-radius: 50%;
    font-size: 16px;
    opacity: 0;
    transition: all 0.2s;
    margin-left: 5px;
    vertical-align: middle;
}

.pd-conversation-item:hover .pd-delete-conversation {
    opacity: 1;
}

.pd-delete-conversation:hover {
    color: #d63638;
    background: rgba(214, 54, 56, 0.1);
}

.pd-chat-main {
    padding: 15px;
    background: #fff;
    position: relative;
}

.pd-chat-history {
    flex-grow: 1;
    overflow-y: auto;
    padding: 15px;
    border: 1px solid #eee;
    border-radius: 4px;
    margin-bottom: 15px;
    background: #fafafa;
}

.pd-chat-message {
    margin-bottom: 15px;
    max-width: 80%;
    clear: both;
    position: relative;
}

.pd-chat-message.user-message {
    float: right;
    text-align: right;
}

.pd-chat-message.ai-message {
    float: left;
    text-align: left;
}

.pd-message-speaker {
    display: block;
    font-size: 11px;
    color: #999;
    margin-bottom: 2px;
}

.pd-message-content {
    display: inline-block;
    padding: 10px 30px 10px 15px; /* Increased right padding for copy button */
    border-radius: 15px;
    line-height: 1.5;
    font-size: 14px;
    position: relative;
}

.pd-chat-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 14px;
    opacity: 0.3;
    transition: opacity 0.2s;
    color: inherit;
    padding: 0;
    line-height: 1;
}

.pd-chat-copy-btn:hover {
    opacity: 1;
}

.pd-chat-message.user-message .pd-message-content {
    background: #0073aa;
    color: #fff;
    border-bottom-right-radius: 2px;
}

.pd-chat-message.ai-message .pd-message-content {
    background: #e5e5e5;
    color: #333;
    border-bottom-left-radius: 2px;
}

.pd-chat-message.loading .pd-message-content {
    background: #f0f0f1;
    font-style: italic;
    color: #888;
}

.pd-chat-message.error-message .pd-message-content {
    background: #fbeaea;
    color: #d63638;
}

.pd-chat-input-wrapper {
    margin-top: auto;
}

.pd-chat-input-wrapper textarea {
    width: 100%;
    resize: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 10px;
    font-family: inherit;
}

.pd-chat-memory-toggle {
    font-size: 11px;
    color: #999;
    margin-bottom: 2px;
    opacity: 0.7;
}

/* Chat Config Summary */
.pd-chat-config-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: #f0f0f1;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 10px;
    font-size: 13px;
    color: #333;
}

.pd-chat-config-summary:hover {
    background: #e5e5e5;
    border-color: #ccc;
}

.pd-chat-config-summary .dashicons {
    color: #555;
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.pd-chat-context-indicator {
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* =========================================
   Popovers & Modals
   ========================================= */
.pd-popover {
    position: fixed;
    z-index: 10000;
    background: #fff;
    border: 1px solid #ccc;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    border-radius: 4px;
    width: 400px;
    max-width: 95%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: pd-popover-fade-in 0.2s ease-out;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    box-sizing: border-box;
    overflow: hidden;
}

.pd-popover * {
    box-sizing: border-box;
}

@keyframes pd-popover-fade-in {
    from { opacity: 0; transform: translate(-50%, -60%); }
    to { opacity: 1; transform: translate(-50%, -50%); }
}

.pd-popover-header {
    padding: 10px 15px;
    background: #f5f5f5;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    flex-shrink: 0;
}

.pd-popover-body {
    padding: 15px;
    overflow-y: auto;
    flex-grow: 1;
    min-height: 0; /* Crucial for flex scrolling */
    width: 100%;
    position: relative;
}

/* Debug Modal Specifics */
#pd-debug-content {
    white-space: pre-wrap;
    background: #2d2d2d;
    color: #ccc;
    padding: 15px;
    border: none;
    border-radius: 0;
    font-size: 13px;
    font-family: 'Consolas', 'Monaco', monospace;
    line-height: 1.5;
    margin: 0;
    flex-grow: 1;
    box-sizing: border-box;
    overflow-y: auto;
}

.pd-close-popover, .pd-close-debug {
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    color: #999;
    background: none;
    border: none;
    padding: 0;
}

.pd-close-popover:hover {
    color: #d63638;
}

/* Generic Modal Styles (New) */
.pd-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.pd-modal-content {
    background: #fff;
    width: 90%;
    max-width: 500px;
    border-radius: 6px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: pd-fade-in 0.2s ease-out;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

@keyframes pd-fade-in {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.pd-modal-header {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9f9f9;
}

.pd-modal-header h3 {
    margin: 0;
    font-size: 16px;
    color: #333;
}

.pd-modal-close {
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    color: #999;
}

.pd-modal-close:hover {
    color: #d63638;
}

.pd-modal-body {
    padding: 20px;
    overflow-y: auto;
}

.pd-modal-footer {
    padding: 15px;
    border-top: 1px solid #eee;
    background: #f9f9f9;
    text-align: right;
}

.pd-form-group {
    margin-bottom: 15px;
}

.pd-form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 13px;
}

.pd-form-group select,
.pd-form-group textarea,
.pd-form-group input[type="text"] {
    width: 100%;
    box-sizing: border-box;
}

.pd-btn-save {
    background: #0073aa;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    width: 100%;
}

.pd-btn-save:hover {
    background: #005177;
}

.pd-btn-danger {
    background: #d63638;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.pd-btn-danger:hover {
    background: #a5181a;
}

.pd-editing {
    outline: none;
    background-color: #fff;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

/* =========================================
   Toast Notifications
   ========================================= */
.pd-toast {
    visibility: hidden;
    min-width: 250px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 4px;
    padding: 16px;
    position: fixed;
    z-index: 10001;
    right: 30px;
    top: 30px;
    font-size: 15px;
    opacity: 0;
    transition: opacity 0.3s, top 0.3s;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.pd-toast.show {
    visibility: visible;
    opacity: 1;
    top: 50px;
}

.pd-toast.success {
    background-color: #4CAF50;
}

.pd-toast.error {
    background-color: #f44336;
}

/* =========================================
   Extractor Highlights
   ========================================= */
.pd-highlighted-idea {
    cursor: pointer;
    border-bottom: 2px solid rgba(0,0,0,0.1);
    transition: background-color 0.2s;
}

.pd-highlighted-idea:hover {
    filter: brightness(0.9);
}

.pd-highlight-hidden {
    background-color: transparent !important;
    border-bottom: none !important;
    pointer-events: none !important;
}

/* Placeholder & Loading */
.pd-placeholder, .pd-loading, .pd-empty, .pd-error {
    text-align: center;
    padding: 40px;
    color: #666;
    font-style: italic;
}

.pd-error {
    color: #d63638;
}
