body {
    margin: 0;
    padding: 0;
    overflow: hidden; /* Prevent body scrollbars */
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #ffffff;
    font-family: 'Sono', sans-serif;
}

#editor {
    width: 80%; /* Restore original width */
    max-width: 800px; /* Restore original max-width */
    height: calc(100vh - 140px); /* Restore original height calc */
    margin-bottom: 60px; /* Restore margin for toolbar */
    box-sizing: border-box;
    border: none;
    padding: 20px;
    font-family: 'Sono', sans-serif;
    font-size: 16px;
    outline: none;
    background-color: white;
    overflow-y: auto;
    line-height: 1.5;
    white-space: pre-wrap;
    scrollbar-width: thin;
    scrollbar-color: var(--toolbar-bg) var(--toolbar-bg);
}

/* Comment Sidebar Styles - Adjusted for non-permanent display */
#commentSidebar {
    width: 280px;
    height: fit-content;
    position: fixed; /* Position relative to viewport */
    top: 80px;
    right: 20px;
    display: none; /* Hide by default */
    box-sizing: border-box;
    background-color: var(--sidebar-bg);
    border: 1px solid var(--sidebar-border);
    border-radius: 8px; /* Add rounded corners */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); /* Keep shadow for now */
    display: flex;
    flex-direction: column;
    padding: 15px;
    overflow: hidden;
    z-index: 999;
}

#commentSidebar h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 400;
    opacity: 0.7;
    color: var(--sidebar-header-text);
    border-bottom: 0.5px solid var(--sidebar-header-border);
    padding-bottom: 0.5rem;
    display: block;
}

#commentList {
    flex-grow: 1; /* List takes remaining space */
    overflow-y: auto; /* Allow comments to scroll */
    margin-top: 0.5rem  ;
    gap: 0.5rem;
    display: flex;
    flex-direction: column;
}

p {
    margin-block-start: 1rem;
    margin-block-end: 0.5rem;
}

.separator {
    color: var(--toolbar-btn-hover);
}

.comment-card {
    background-color: var(--comment-card-bg);
    border: 1px solid var(--comment-card-border);
    border-radius: 4px;
    padding: 0.7rem;
    font-size: 13px;
}

.comment-card-header {
    display: flex;
    justify-content: space-between; /* Pushes items to ends */
    align-items: center;          /* Vertically align items */
}

.comment-card .agent-name {
    font-weight: 500;
    color: var(--comment-card-header-text);
    font-size: 14px;
    opacity: 0.3;
}

.comment-card .comment-text {
    color: var(--comment-card-text);
    font-size: 14px;
    margin-bottom: 8px; /* Add margin below message */
}

.comment-status {
    display: block;
    font-size: 11px;
    color: var(--comment-card-status-text);


}

.run-agent-button {
    background-color: var(--comment-btn-bg);
    border: 1px solid var(--comment-btn-border);
    color: var(--comment-btn-text);
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.run-agent-button:hover {
    background-color: var(--comment-btn-hover-bg);
}

.run-agent-button:disabled {
    background-color: var(--comment-btn-disabled-bg);
    border-color: var(--comment-btn-disabled-border);
    color: var(--comment-btn-disabled-text);
    cursor: not-allowed;
}

.no-comments-message {
    font-size: 13px;
    color: var(--comment-card-status-text);
    text-align: center;
    margin-top: 0.5rem;
    opacity: 0.7;
}

/* Style for highlighting tagged text */
span[data-comment-id] {
    /* background-color: rgba(255, 213, 0, 0.3); Remove highlight */
    cursor: pointer;
    /* border: 1px solid red; Remove temporary border */
    background-color: #f0f0f0; /* Subtle background */
    padding: 1px 3px; /* Small padding */
    border-radius: 3px; /* Slightly rounded corners */
    margin: 0 1px; /* Tiny margin */
}

span[data-comment-id].highlighted {
    /* background-color: rgba(255, 213, 0, 0.6); Remove stronger highlight */
    box-shadow: 0 0 0 2px #0d6efd; /* Use a border/shadow for highlight */
}

/* Editor placeholder styles */
#editor[placeholder]:empty:before {
    content: attr(placeholder);
    color: #aaa;
    font-style: italic;
    font-weight: 300;
    opacity: 0.8;
}

#editor[placeholder]:empty:focus:before {
    display: none;
}

/* Formatting styles */
#editor h1 {
    font-size: 1.8em;
    margin-top: 0.8em;
    margin-bottom: 0.5em;
    font-family: 'Sono', sans-serif;
    font-weight: 700;
}

#editor h2 {
    font-size: 1.5em;
    margin-top: 0.7em;
    margin-bottom: 0.4em;
    font-family: 'Sono', sans-serif;
    font-weight: 600;
}

#editor ul, #editor ol {
    margin-left: 1.5em;
    padding-left: 0.5em;
}

#editor a {
    color: #0d6efd;
    text-decoration: none;
}

#editor a:hover {
    text-decoration: underline;
}

#editor img {
    max-width: 100%;
    height: auto;
}


#toolbar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 8px 12px;
    display: flex;
    gap: 8px;
    align-items: center;
    z-index: 1000;
    font-family: 'Sono', sans-serif;
}

#toolbar button {
    background: none;
    border: none;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    font-family: 'Sono', sans-serif;
}

#toolbar button:hover {
    background-color: #e9ecef;
}

#toolbar button.active {
    background-color: #e2f0ff;
    color: #0d6efd;
}

#toolbar button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background-color: transparent; /* Ensure no hover effect lingers */
}



/* Link popup styles */
.popup {
    display: none;
    position: absolute;
    background-color: white;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 8px;
    z-index: 1001;
    flex-direction: row;
    align-items: center;
}

#linkPopup {
    gap: 4px;
}

#linkInput {
    font-size: 14px;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 240px;
    outline: none;
}

#linkInput:focus {
    border-color: #0d6efd;
}

#linkPopup button {
    background: none;
    border: none;
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--toolbar-btn-color);
}

#applyLink {
    background-color: var(--toolbar-btn-hover);
    color: var(--toolbar-btn-color);
}

#applyLink:hover {
    background-color: var(--toolbar-btn-hover);
}

#cancelLink:hover {
    background-color: var(--toolbar-btn-hover);
}

/* Agent Toggle Button Styles */
#agentControl {
    position: fixed;
    bottom: 20px;
    right: 70px; /* Position next to theme button */
    z-index: 1000;
}

#agentToggleButton {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--toolbar-bg);
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--toolbar-btn-color);
    font-size: 18px;
    transition: all 0.2s ease;
    border: 1px solid var(--toolbar-btn-hover);
}

#agentToggleButton:hover {
    transform: scale(1.05);
    background-color: var(--toolbar-btn-hover);
}

/* Agent Dropdown Styles */
#agentDropdown {
    position: absolute;
    display: none; /* Hidden by default */
    min-width: 180px;
    background-color: var(--popup-bg);
    border: 1px solid var(--popup-border);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1010; /* Above editor, sidebar, toolbar */
    font-family: 'Sono', sans-serif;
    font-size: 14px;
    scrollbar-width: thin;
    scrollbar-color: var(--popup-border) var(--popup-border);
}

.agent-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    border-bottom: 1px solid var(--sidebar-header-border); /* Use sidebar header border */
}

.agent-dropdown-header label {
    font-weight: 500;
    color: var(--sidebar-header-text); /* Use sidebar header text */
}

.agent-dropdown-header button {
    background: none;
    border: none;
    color: var(--link-color); /* Use theme link color */
    font-size: 13px;
    cursor: pointer;
    padding: 2px 4px;
}

.agent-dropdown-header button:hover {
    text-decoration: underline;
}

#agentDropdown ul {
    list-style: none;
    padding: 5px 0;
    margin: 0;
    max-height: 150px; /* Limit height and allow scroll */
    overflow-y: auto;
    /* Ensure background matches dropdown */
    background-color: var(--popup-bg);
}

#agentDropdown li {
    padding: 6px 12px;
    cursor: pointer;
    color: var(--popup-text); /* Use popup text color */
}

#agentDropdown li:hover {
    background-color: var(--toolbar-btn-hover); /* Use toolbar hover color */
}

/* Add styles for agent mentions */
#editor span.agent-mention-tag {
    background-color: var(--agent-tag-bg);
    color: var(--agent-tag-text);
    padding: 2px 6px;          /* Small padding */
    border-radius: 4px;        /* Rounded corners */
    display: inline-block;     /* Allows padding/margin */
    margin-right: 1px;         /* Tiny space after */
    /* contenteditable=false is set in HTML */
}

/* Tooltip for agent message prompt */
#agentPromptTooltip {
    position: absolute; /* Position near cursor */
    display: none;      /* Hidden by default */
    background-color: var(--popup-bg); /* Dark background */
    color: var(--popup-text);         /* White text */
    border: 1px solid var(--popup-border);
    font-size: 12px;
    padding: 5px 10px;
    border-radius: 4px;
    z-index: 1010;      /* Above editor, etc. */
    pointer-events: none; /* Prevent mouse interaction */
    white-space: nowrap;
    opacity: 0; /* Start hidden for transition */
    transition: opacity 0.3s ease-in-out; /* Add fade transition */
}

#editor.theme a {
    color: var(--link-color);
}

/* --------- Modal Styles --------- */

.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
}

.modal-overlay {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* Black w/ opacity */
    z-index: 1001;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-content {
    background-color: var(--popup-bg); /* Use theme background */
    color: var(--popup-text); /* Use theme text color */
    margin: 5% auto; /* 15% from the top and centered */
    padding-top: 25px;
    padding-left: 25px;
    padding-right: 25px;
    border: 1px solid var(--popup-border); /* Use theme border */
    border-radius: 8px;
    width: 80%; /* Could be more or less, depending on screen size */
    max-width: 600px; /* Max width */
    position: relative; /* For positioning close button */
    z-index: 1002;
    box-shadow: 0 0px 4px var(--popup-border);
    scrollbar-width: thin;
    scrollbar-color: var(--popup-border) var(--popup-border);
}

.modal-close-button {
    color: var(--popup-text);
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    
    background: none;
    border: none;
    cursor: pointer;
}

.modal-close-button:hover,
.modal-close-button:focus {
    color: var(--primary-color);
    text-decoration: none;
    cursor: pointer;
}

h2 {
    font-size: 1rem;
    font-weight: 300;
    margin-bottom: 0.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--popup-border);
}

/* Styles for Agent Marketplace List inside Modal */
.agent-marketplace-list {
    margin-top: 20px; /* Space below header */
    max-height: 60vh; /* Limit height */
    overflow-y: auto; /* Allow scrolling */
    padding-right: 10px; /* Space for scrollbar */
}

.agent-marketplace-card {
    background-color: var(--bg-color); /* Use a slightly different bg if needed */
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start; /* Align items to the top */
}

.agent-info {
    flex-grow: 1; /* Allow info to take up space */
    padding-right: 15px; /* Space between info and controls */
}

.agent-marketplace-card h3 {
    margin: 0 0 5px 0;
    font-size: 0.9rem;
    font-weight: 500; /* Make name slightly bolder */
    color: var(--text-color); /* Use standard text color */
}

.agent-author {
    display: block;
    font-size: 0.75rem;
    color: var(--text-color-muted); /* Muted color for author */
    margin-bottom: 8px;
}

.agent-description {
    font-size: 0.85rem;
    color: var(--text-color);
    margin: 0;
    line-height: 1.4;
    opacity: 0.5;
}

.agent-controls {
    flex-shrink: 0; /* Prevent controls from shrinking */
    display: flex;
    align-items: center; /* Vertically center checkbox/label */
}

.agent-controls label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.85rem;
}

.agent-controls input[type="checkbox"] {
    margin-right: 1rem;
    cursor: pointer;
    /* Optional: Style checkbox */
    width: 16px;
    height: 16px;
    background-color: #0d6efd;}

.agent-controls input[type="checkbox"]:checked {
    accent-color: var(--toolbar-btn-color);
}

/* ------- End Modal Styles ------- */

/* Specific adjustments for RozNote layout */
#editor {
    width: 80%; /* Restore original width */
    max-width: 800px; /* Restore original max-width */
    height: calc(100vh - 140px); /* Restore original height calc */
    margin-bottom: 60px; /* Restore margin for toolbar */
    box-sizing: border-box;
    border: none;
    padding: 20px;
    font-family: 'Sono', sans-serif;
    font-size: 16px;
    outline: none;
    background-color: white;
    overflow-y: auto;
    line-height: 1.5;
    white-space: pre-wrap;
    scrollbar-width: thin;
    scrollbar-color: var(--toolbar-bg) var(--toolbar-bg);
} 