/* markdown_editor/static/markdown_editor/css/editor.css */

.markdown-editor-container {
    background: #ffffff;
    border: 2px solid var(--lightbg);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1rem;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.08);
    transition: all 0.3s ease;
}

.markdown-editor-container:hover {
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.12);
}

/* Fullscreen Mode */
.markdown-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    margin: 0;
    border-radius: 0;
    max-width: 100vw;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
}

.markdown-fullscreen .markdown-editor-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.markdown-fullscreen .markdown-editor-area,
.markdown-fullscreen .markdown-preview-area {
    flex: 1;
    overflow-y: auto;
    max-height: none;
}

.markdown-fullscreen .markdown-editor-input {
    height: 100%;
    max-height: none;
}

.markdown-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--lightmain-ink) 0%, var(--hint-ink) 100%);
    border-bottom: 2px solid #c8e6c9;
    align-items: center;
}

.markdown-toolbar-group {
    display: flex;
    gap: 6px;
    padding-right: 12px;
    border-right: 2px solid #c8e6c9;
}

.markdown-toolbar-group:last-child {
    border-right: none;
}

.markdown-toolbar-right {
    margin-left: auto;
}

.markdown-btn {
    padding: 8px 14px;
    background: #ffffff;
    border: 2px solid #81c784;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    color: #2e7d32;
    font-family: inherit;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.markdown-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(76, 175, 80, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.markdown-btn:hover {
    background: #e8f5e9;
    border-color: #66bb6a;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.15);
}

.markdown-btn:hover::before {
    width: 200px;
    height: 200px;
}

.markdown-btn:active {
    transform: translateY(0);
}

.markdown-btn i {
    pointer-events: none;
}

.markdown-btn-toggle {
    font-weight: 600;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.markdown-btn-toggle.active {
    background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%);
    color: white;
    border-color: #388e3c;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.markdown-btn-toggle.active:hover {
    background: linear-gradient(135deg, #388e3c 0%, #2e7d32 100%);
    border-color: #2e7d32;
}

.markdown-editor-wrapper {
    position: relative;
    min-height: 200px;
    background: linear-gradient(to bottom, #fafffe 0%, #ffffff 100%);
}

.markdown-editor-area,
.markdown-preview-area {
    padding: 20px;
    overflow-y: auto;
    width: 100%;
    box-sizing: border-box;
}

.markdown-editor-area {
    background: #ffffff;
    display: block;
}

.markdown-editor-input {
    width: 100%;
    min-height: 200px;
    max-height: 800px;
    height: 400px;
    border: none;
    outline: none;
    font-family: 'Courier New', 'Consolas', 'Monaco', monospace;
    font-size: 15px;
    line-height: 1.7;
    resize: vertical;
    color: #1b5e20;
    padding: 0;
    margin: 0;
    background: transparent;
    display: block;
    box-sizing: border-box;
}

.markdown-editor-input::selection {
    background: #c8e6c9;
    color: #1b5e20;
}

.markdown-editor-input:focus {
    outline: none;
}

.markdown-preview-area {
    background: linear-gradient(135deg, #f1f8f4 0%, #fafffe 100%);
    border-top: 2px solid #c8e6c9;
    min-height: 200px;
    max-height: 1200px;
}

.markdown-preview-content {
    max-width: 100%;
    word-wrap: break-word;
}

/* Preview Styling */
.markdown-preview-content h1,
.markdown-preview-content h2,
.markdown-preview-content h3,
.markdown-preview-content h4,
.markdown-preview-content h5,
.markdown-preview-content h6 {
    margin-top: 24px;
    margin-bottom: 16px;
    font-weight: 700;
    line-height: 1.25;

}

.markdown-preview-content h1 { 
    font-size: 2.2em; 
    border-bottom: 3px solid #81c784; 
    padding-bottom: 0.3em; 
    background: linear-gradient(90deg, #4caf50, #66bb6a);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.markdown-preview-content h2 { 
    font-size: 1.7em; 
    border-bottom: 2px solid #a5d6a7; 
    padding-bottom: 0.3em; 
 
}

.markdown-preview-content h3 { 
    font-size: 1.4em;
   
}

.markdown-preview-content h4 { 
    font-size: 1.15em;
  
}

.markdown-preview-content h5 { 
    font-size: 0.95em;
  
}

.markdown-preview-content h6 { 
    font-size: 0.85em; 
 
}

.markdown-preview-content h1:first-child,
.markdown-preview-content h2:first-child,
.markdown-preview-content h3:first-child {
    margin-top: 0;
}

.markdown-preview-content p {
    margin-bottom: 16px;
    line-height: 1.7;
    color: #2d3436;
}

.markdown-preview-content strong {
    
    font-weight: 700;
}


.markdown-preview-content code {
    padding: 3px 8px;
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8f4 100%);
    border: 1px solid #c8e6c9;
    border-radius: 5px;
    font-family: 'Courier New', 'Consolas', 'Monaco', monospace;
    font-size: 90%;
    color: #2e7d32;
}

.markdown-preview-content pre {
    background: linear-gradient(135deg, #1b5e20 0%, #2e7d32 100%);
    color: #e8f5e9;
    padding: 20px;
    border-radius: 10px;
    overflow-x: auto;
    margin-bottom: 16px;
    border: 2px solid #4caf50;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.2);
}

.markdown-preview-content pre code {
    background: none;
    padding: 0;
    border: none;
    color: #e8f5e9;
}

.markdown-preview-content blockquote {
    padding: 12px 20px;
    color: #2e7d32;
    border-left: 5px solid #4caf50;
    margin-bottom: 16px;
    background: linear-gradient(90deg, #e8f5e9 0%, transparent 100%);
    border-radius: 0 8px 8px 0;
    font-style: italic;
}

.markdown-preview-content ul,
.markdown-preview-content ol {
    padding-left: 2em;
    margin-bottom: 16px;
}

.markdown-preview-content li {
    margin-bottom: 6px;
    color: #2d3436;
}

.markdown-preview-content li::marker {
    color: #4caf50;
    font-weight: bold;
}

.markdown-preview-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 16px 0;
    border: 2px solid #c8e6c9;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.15);
}

.markdown-preview-content a {
    color: #2e7d32;
    text-decoration: none;
    font-weight: 600;
    border-bottom: 2px solid #81c784;
    transition: all 0.2s ease;
}

.markdown-preview-content a:hover {
    color: #1b5e20;
    border-bottom-color: #4caf50;
    background: rgba(76, 175, 80, 0.05);
}

.markdown-preview-content table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 16px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.1);
}

.markdown-preview-content table th,
.markdown-preview-content table td {
    padding: 12px 16px;
    border: 1px solid #c8e6c9;
}

.markdown-preview-content table th {
    background: linear-gradient(135deg, #4caf50 0%, #66bb6a 100%);
    color: white;
    font-weight: 700;
    text-align: left;
}

.markdown-preview-content table tr:nth-child(even) {
    background: #f1f8f4;
}

.markdown-preview-content table tr:hover {
    background: #e8f5e9;
}

.markdown-preview-content hr {
    height: 3px;
    padding: 0;
    margin: 32px 0;
    background: linear-gradient(90deg, transparent 0%, #4caf50 50%, transparent 100%);
    border: 0;
    border-radius: 2px;
}

.markdown-preview-content iframe {
    max-width: 100%;
    margin: 16px 0;
    border-radius: 8px;
    border: 2px solid #c8e6c9;
}

/* Modal Styles */
.markdown-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(27, 94, 32, 0.5);
    backdrop-filter: blur(4px);
    z-index: 999999;
    align-items: center;
    justify-content: center;
}

.markdown-modal.active {
    display: flex;
}

.markdown-modal-content {
    background: white;
    padding: 32px;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 12px 40px rgba(76, 175, 80, 0.3);
    border: 2px solid #81c784;
}

.markdown-modal-content h3 {
    margin: 0 0 20px 0;
    font-size: 20px;
    font-weight: 700;
    color: #2e7d32;
    border-bottom: 2px solid #c8e6c9;
    padding-bottom: 10px;
}

.markdown-modal-content input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #c8e6c9;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.2s ease;
}

.markdown-modal-content input:focus {
    outline: none;
    border-color: #4caf50;
    box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.1);
}

.markdown-modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

.markdown-modal-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-family: inherit;
    font-weight: 600;
    transition: all 0.2s ease;
}

.markdown-modal-btn-primary {
    background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.markdown-modal-btn-primary:hover {
    background: linear-gradient(135deg, #388e3c 0%, #2e7d32 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(76, 175, 80, 0.4);
}

.markdown-modal-btn-cancel {
    background: #e0e0e0;
    color: #424242;
}

.markdown-modal-btn-cancel:hover {
    background: #bdbdbd;
    transform: translateY(-2px);
}

/* Responsive */
@media (max-width: 768px) {
    .markdown-toolbar {
        gap: 6px;
        padding: 10px;
    }
    
    .markdown-toolbar-group {
        gap: 4px;
        padding-right: 6px;
    }
    
    .markdown-btn {
        padding: 6px 10px;
        font-size: 13px;
    }
    
    .markdown-editor-input {
        font-size: 14px;
    }
    
    .markdown-fullscreen .markdown-toolbar {
        flex-wrap: nowrap;
        overflow-x: auto;
    }
}