/* AI Notepad Specific Styles */

/* Editor Container */
.editor-container {
    background: white;
    border-radius: 16px;
    padding: 0;
    box-shadow: var(--shadow-lg);
    margin-top: 30px;
    min-height: 600px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.editor-container:hover {
    box-shadow: var(--shadow-xl);
}

/* Quill Editor Styles */
#editor {
    min-height: 500px;
    font-size: 16px;
    line-height: 1.8;
}

.ql-container {
    font-size: 16px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    min-height: 500px;
}

.ql-editor {
    min-height: 500px;
    padding: 20px 30px;
    line-height: 1.8;
}

.ql-editor p {
    margin-bottom: 12px;
}

.ql-editor.ql-blank::before {
    color: var(--text-muted);
    font-style: normal;
    opacity: 0.6;
}

.ql-toolbar.ql-snow {
    border: none;
    border-bottom: 2px solid var(--border-color);
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 16px 16px 0 0;
}

.ql-container.ql-snow {
    border: none;
}

.ql-editor:focus {
    outline: none;
}

/* Toolbar button styling */
.ql-snow .ql-stroke {
    stroke: var(--text-secondary);
}

.ql-snow .ql-fill {
    fill: var(--text-secondary);
}

.ql-snow .ql-picker-label {
    color: var(--text-secondary);
}

.ql-toolbar.ql-snow .ql-picker-label:hover,
.ql-toolbar.ql-snow .ql-picker-label.ql-active {
    color: #667eea;
}

.ql-toolbar.ql-snow button:hover .ql-stroke,
.ql-toolbar.ql-snow button.ql-active .ql-stroke {
    stroke: #667eea;
}

.ql-toolbar.ql-snow button:hover .ql-fill,
.ql-toolbar.ql-snow button.ql-active .ql-fill {
    fill: #667eea;
}

/* Custom selection color for better visibility */
::selection {
    background: rgba(102, 126, 234, 0.3);
    color: inherit;
}

/* Tone Context Menu */
.tone-context-menu {
    position: fixed;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    display: none;
    min-width: 280px;
    max-height: 500px;
    overflow-y: auto;
    animation: contextMenuFadeIn 0.2s ease;
}

@keyframes contextMenuFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.tone-context-menu.show {
    display: block;
}

.context-menu-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border-radius: 12px 12px 0 0;
}

.context-menu-items {
    padding: 8px;
}

.context-menu-item {
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: white;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.context-menu-item:hover {
    background: var(--bg-secondary);
    color: #667eea;
    transform: translateX(4px);
}

.context-menu-item .icon {
    font-size: 18px;
    width: 24px;
    display: inline-block;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 10001;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 900px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease;
    display: flex;
    flex-direction: column;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    padding: 24px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transform: rotate(90deg);
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

.text-comparison {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    align-items: start;
}

.comparison-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comparison-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0;
}

.text-box {
    padding: 20px;
    border-radius: 12px;
    font-size: 15px;
    line-height: 1.8;
    min-height: 150px;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.text-box.original-text {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    color: var(--text-secondary);
}

.text-box.adjusted-text {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border: 2px solid rgba(102, 126, 234, 0.3);
    color: var(--text-primary);
    font-weight: 500;
}

.comparison-arrow {
    font-size: 24px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    margin-top: 32px;
}

.modal-loading {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 40px;
}

.modal-loading.show {
    display: flex;
}

.modal-loading .loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.modal-loading span {
    font-size: 15px;
    color: var(--text-secondary);
    font-weight: 500;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    background: var(--bg-secondary);
}

.modal-footer .btn-secondary,
.modal-footer .btn-primary {
    padding: 12px 28px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.modal-footer .btn-secondary {
    background: white;
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
}

.modal-footer .btn-secondary:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transform: translateY(-2px);
}

.modal-footer .btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: var(--shadow-md);
}

.modal-footer .btn-primary:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.modal-footer .btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .editor-container {
        padding: 20px;
        border-radius: 12px;
    }

    .text-comparison {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .comparison-arrow {
        transform: rotate(90deg);
        margin: 0 auto;
    }

    .modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 20px;
    }

    .tone-context-menu {
        min-width: 240px;
        max-height: 400px;
    }
}

/* Scrollbar Styling */
.tone-context-menu::-webkit-scrollbar,
.text-box::-webkit-scrollbar,
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.tone-context-menu::-webkit-scrollbar-track,
.text-box::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.tone-context-menu::-webkit-scrollbar-thumb,
.text-box::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}

.tone-context-menu::-webkit-scrollbar-thumb:hover,
.text-box::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}
