/* Editor View specific styles */

#editor-view {
    height: 100vh;
    display: none;
    flex-direction: column;
    background: #E5E5E5;
    overflow: hidden;
}

#editor-view.active {
    display: flex;
    /* Override .view.active */
}

.editor-header {
    background: white;
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.document-title-input {
    font-size: 1.25rem;
    font-weight: 700;
    font-family: inherit;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    text-align: center;
    color: var(--text-main);
    transition: all 0.2s;
    background: transparent;
    width: 300px;
}

.document-title-input:hover {
    border-color: #E1E1E1;
}

.document-title-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
}

.editor-actions {
    display: flex;
    gap: 12px;
}

.editor-workspace {
    display: flex;
    flex-grow: 1;
    overflow: hidden;
    /* Scroll individually inside */
}

/* Document Area Container */
.document-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 40px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    /* Start from top */
    scrollbar-width: thin;
}

.document-paper {
    background: white;
    width: 100%;
    max-width: 800px;
    /* standard document width */
    min-height: 1056px;
    /* standard document height (~8.5x11 inches) */
    padding: 64px;
    box-shadow: var(--shadow-md);
    border-radius: 4px;
    /* Slight rounding for the "paper" */
    font-family: "Times New Roman", Times, serif;
    /* Typical for worksheets, or stick with Inter */
    font-size: 1.1rem;
    line-height: 1.6;
    color: #333;
}

.document-paper:focus {
    outline: none;
}

.document-paper h1 {
    font-family: 'Inter', sans-serif;
    font-size: 2.5rem;
    margin-bottom: 24px;
    color: #111;
}

.document-paper h2 {
    font-family: 'Inter', sans-serif;
    font-size: 1.8rem;
    margin-top: 32px;
    margin-bottom: 16px;
    color: #111;
}

.document-paper p {
    margin-bottom: 16px;
}

/* AI Suggestions Highlights */
.ai-addition {
    background-color: var(--success-bg);
    border-bottom: 2px solid var(--success);
    color: #0b7a42;
    position: relative;
    cursor: pointer;
}

.ai-removal {
    background-color: var(--danger-bg);
    text-decoration: line-through;
    color: var(--danger);
    position: relative;
    cursor: pointer;
}

.suggestion-actions {
    display: none;
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-full);
    padding: 4px;
    z-index: 1000;
    gap: 4px;
}

.ai-addition:hover .suggestion-actions,
.ai-removal:hover .suggestion-actions {
    display: flex;
}

.btn-accept,
.btn-reject {
    background: none;
    border: none;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-accept {
    color: var(--success);
}

.btn-accept:hover {
    background: var(--success-bg);
}

.btn-reject {
    color: var(--danger);
}

.btn-reject:hover {
    background: var(--danger-bg);
}

/* AI Sidebar Container */
.ai-sidebar {
    width: 350px;
    background: white;
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.03);
    z-index: 10;
}

.ai-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ai-title {
    font-weight: 600;
    color: var(--text-main);
}

.chat-history {
    flex-grow: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    line-height: 1.4;
    animation: fadeIn 0.3s ease-out;
}

.chat-message.ai {
    background: #F4F6F8;
    color: var(--text-main);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-message.user {
    background: var(--primary-color);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-input-area {
    padding: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    background: white;
    position: relative;
    /* Make it a positioning context for Sammy popup */
    z-index: 2;
    /* Ensure it stays above the history */
}

.sammy-popup {
    position: absolute;
    bottom: 100%;
    /* Position it right above the input area */
    left: 24px;
    /* Slight indent */
    margin-bottom: -15px;
    /* Overlap slightly with the input area border */
    z-index: 3;
    animation: popupAnimation 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.sammy-popup img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    background: white;
    /* Fallback for transparency */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    border: 3px solid white;
}

@keyframes popupAnimation {
    0% {
        transform: translateY(20px) scale(0.8);
        opacity: 0;
    }

    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.chat-input-area input {
    flex-grow: 1;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    outline: none;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.chat-input-area input:focus {
    border-color: var(--primary-color);
}

#send-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.2s, transform 0.1s;
}

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

#send-btn:active {
    transform: scale(0.9);
}