/**
 * Professional HTML Editor Styles
 * mobifirms - Professional File Management System
 */

.html-editor-container {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.html-editor-header {
    display: flex;
    justify-content: flex-start; /* Only left-align toolbar, no space for toggle */
    align-items: center;
    padding: 0.5rem;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.html-editor-toolbar {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.html-editor-controls {
    display: none !important; /* Completely hide controls section */
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid #dee2e6;
    background: #fff;
    color: #495057;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    font-size: 0.875rem;
}

.toolbar-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    color: #212529;
}

.toolbar-btn:active,
.toolbar-btn.active {
    background: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
}

.toolbar-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.toolbar-separator {
    width: 1px;
    height: 24px;
    background: #dee2e6;
    margin: 0 0.25rem;
}

.toolbar-dropdown {
    position: relative;
    display: inline-block;
}

.toolbar-dropdown .toolbar-btn {
    width: auto;
    padding: 0 0.5rem;
    font-size: 0.75rem;
    white-space: nowrap;
}

.toolbar-dropdown .dropdown-menu {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    z-index: 1050;
    display: none;
    min-width: 140px;
    padding: 0.25rem 0;
    margin: 0;
    font-size: 0.875rem;
    color: #212529;
    text-align: left;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.175);
    transform: translateY(0);
    transition: opacity 0.15s ease, transform 0.15s ease;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
}

.toolbar-dropdown .dropdown-menu.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.toolbar-dropdown .dropdown-item {
    display: block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    clear: both;
    font-weight: 400;
    color: #212529;
    text-align: inherit;
    text-decoration: none;
    white-space: nowrap;
    background-color: transparent;
    border: 0;
    cursor: pointer;
}

.toolbar-dropdown .dropdown-item:hover,
.toolbar-dropdown .dropdown-item:focus {
    color: #1e2125;
    background-color: #e9ecef;
}

.toolbar-dropdown .dropdown-item:active {
    color: #fff;
    background-color: #0d6efd;
}

.html-editor-content {
    position: relative;
}

.html-editor-wysiwyg,
.html-editor-source {
    width: 100%;
    padding: 0.75rem;
    border: none;
    outline: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #212529;
    background: #fff;
    resize: vertical;
    overflow-y: auto;
}

.html-editor-wysiwyg {
    min-height: 200px;
    max-height: 400px;
}

.html-editor-wysiwyg:empty:before {
    content: attr(data-placeholder);
    color: #6c757d;
    font-style: italic;
}

.html-editor-wysiwyg h1,
.html-editor-wysiwyg h2,
.html-editor-wysiwyg h3,
.html-editor-wysiwyg h4,
.html-editor-wysiwyg h5,
.html-editor-wysiwyg h6 {
    margin: 0.5rem 0;
    font-weight: 600;
}

.html-editor-wysiwyg h1 { font-size: 1.5rem; }
.html-editor-wysiwyg h2 { font-size: 1.25rem; }
.html-editor-wysiwyg h3 { font-size: 1.125rem; }
.html-editor-wysiwyg h4 { font-size: 1rem; }
.html-editor-wysiwyg h5 { font-size: 0.875rem; }
.html-editor-wysiwyg h6 { font-size: 0.75rem; }

.html-editor-wysiwyg p {
    margin: 0.5rem 0;
}

.html-editor-wysiwyg ul,
.html-editor-wysiwyg ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

/* NUCLEAR TOGGLE BUTTON REMOVAL - PRODUCTION VERSION */
.html-editor-mode-toggle,
.html-editor-controls,
[data-toggle="mode"],
.mode-toggle,
.editor-mode-toggle,
.btn-group[role="group"],
.html-editor-header .btn-group,
.html-editor-container .btn-group,
.html-editor-header .btn-check,
.html-editor-header input[type="radio"],
.html-editor-header label[for*="mode"],
*[class*="mode-toggle"],
*[id*="mode-toggle"],
*[class*="editor-mode"],
*[id*="editor-mode"],
.html-editor-container .btn:not(.toolbar-btn),
.html-editor-header .btn:not(.toolbar-btn),
.html-editor-container button:not(.toolbar-btn),
.html-editor-container input[type="radio"],
.html-editor-container label[for*="mode"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    position: absolute !important;
    left: -99999px !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
    z-index: -9999 !important;
}

/* Hide any button containing "Text" or "HTML" text in editor */
.html-editor-container button:not(.toolbar-btn):not([data-command]) {
    display: none !important;
}

/* Force hide any remaining toggle elements */
.html-editor-header > *:not(.html-editor-toolbar) {
    display: none !important;
}

/* Target specific toggle buttons that appear on the right */
.html-editor-header .btn:contains("Text"),
.html-editor-header .btn:contains("HTML"),
.html-editor-container .btn:contains("Text"),
.html-editor-container .btn:contains("HTML") {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    position: absolute !important;
    left: -99999px !important;
}

/* Hide any buttons that are not toolbar buttons */
.html-editor-header button:not([class*="toolbar"]):not([data-command]):not([data-dropdown]) {
    display: none !important;
}

.html-editor-wysiwyg a {
    color: #0d6efd;
    text-decoration: underline;
}

.html-editor-wysiwyg img {
    max-width: 100%;
    height: auto;
    border-radius: 0.25rem;
    margin: 0.5rem 0;
}

.html-editor-wysiwyg blockquote {
    margin: 0.5rem 0;
    padding: 0.5rem 1rem;
    border-left: 4px solid #0d6efd;
    background: #f8f9fa;
    font-style: italic;
}

.html-editor-wysiwyg code {
    padding: 0.125rem 0.25rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
    font-size: 0.8125rem;
}

.html-editor-wysiwyg pre {
    margin: 0.5rem 0;
    padding: 0.75rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    overflow-x: auto;
}

.html-editor-wysiwyg pre code {
    padding: 0;
    background: none;
    border: none;
}

.html-editor-source {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
    font-size: 0.8125rem;
    background: #f8f9fa;
    border: none;
    resize: vertical;
}

.html-editor-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    font-size: 0.75rem;
    color: #6c757d;
}

.word-count {
    font-weight: 500;
}

/* Mode toggle styles */
.html-editor-mode-toggle .btn-group {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.html-editor-mode-toggle .btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-color: #dee2e6;
}

.html-editor-mode-toggle .btn-check:checked + .btn {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
}

/* Focus states */
.html-editor-container:focus-within {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Responsive design */
@media (max-width: 768px) {
    .html-editor-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .html-editor-toolbar {
        justify-content: center;
        margin-bottom: 0.5rem;
    }
    
    .html-editor-controls {
        justify-content: center;
    }
    
    .toolbar-btn {
        width: 36px;
        height: 36px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .html-editor-container {
        border-color: #495057;
        background: #212529;
    }
    
    .html-editor-header,
    .html-editor-footer {
        background: #343a40;
        border-color: #495057;
    }
    
    .toolbar-btn {
        background: #343a40;
        border-color: #495057;
        color: #adb5bd;
    }
    
    .toolbar-btn:hover {
        background: #495057;
        border-color: #6c757d;
        color: #fff;
    }
    
    .html-editor-wysiwyg,
    .html-editor-source {
        background: #212529;
        color: #fff;
    }
    
    .html-editor-source {
        background: #1a1e21;
    }
    
    .html-editor-wysiwyg:empty:before {
        color: #6c757d;
    }
    
    .html-editor-wysiwyg blockquote,
    .html-editor-wysiwyg code,
    .html-editor-wysiwyg pre {
        background: #343a40;
        border-color: #495057;
    }
}

/* Animation for mode switching */
.html-editor-wysiwyg,
.html-editor-source {
    transition: opacity 0.2s ease-in-out;
}

/* Selection styles in editor */
.html-editor-wysiwyg ::selection {
    background: rgba(13, 110, 253, 0.25);
}

/* Placeholder styling */
.html-editor-wysiwyg[data-placeholder]:empty::before {
    content: attr(data-placeholder);
    color: #6c757d;
    font-style: italic;
    pointer-events: none;
}

/* Error states */
.html-editor-container.is-invalid {
    border-color: #dc3545;
}

.html-editor-container.is-invalid:focus-within {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

/* Success states */
.html-editor-container.is-valid {
    border-color: #198754;
}

.html-editor-container.is-valid:focus-within {
    border-color: #198754;
    box-shadow: 0 0 0 0.25rem rgba(25, 135, 84, 0.25);
}
