/* Modern Text Editor Styles */
.text-editor-component {
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    background: white;
}

.text-editor-toolbar {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #e1e5e9;
    padding: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    min-height: 60px;
}

/* Toolbar Controls Base Styling */
.text-editor-toolbar select,
.text-editor-toolbar button {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Select Dropdowns */
.text-editor-toolbar select {
    min-width: 120px;
    padding-right: 32px;
}

.text-editor-toolbar .editor-font-family {
    min-width: 140px;
}

.text-editor-toolbar .editor-font-size {
    min-width: 80px;
}

/* Color Input (Hidden) */
.text-editor-toolbar input[type="color"] {
    display: none !important;
}

/* Color Button */
.text-editor-toolbar .editor-color-btn {
    background: linear-gradient(135deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #ffeaa7, #dda0dd);
    background-size: 300% 300%;
    animation: gradient 3s ease infinite;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.text-editor-toolbar .editor-color-btn:hover {
    transform: translateY(-1px) scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.text-editor-toolbar .editor-color-btn i {
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

@keyframes gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Buttons */
.text-editor-toolbar button {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 6px;
    font-size: 16px;
    color: #495057;
}

.text-editor-toolbar button:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    color: #212529;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.text-editor-toolbar button:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.text-editor-toolbar button.active {
    background: #007bff;
    color: white;
    border-color: #0056b3;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}

.text-editor-toolbar button.active:hover {
    background: #0056b3;
    border-color: #004085;
}

/* Editor Area */
.text-editor-area {
    padding: 20px;
    min-height: 200px;
    max-height: 500px;
    overflow-y: auto;
    outline: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #212529;
    background: white;
    transition: all 0.2s ease;
}

.text-editor-area:focus {
    box-shadow: inset 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Responsive Design */
@media (max-width: 768px) {
    .text-editor-toolbar {
        padding: 8px;
        gap: 6px;
        justify-content: flex-start;
    }

    .text-editor-toolbar select {
        min-width: 100px;
        font-size: 13px;
    }

    .text-editor-toolbar .editor-font-family {
        min-width: 110px;
    }

    .text-editor-toolbar .editor-font-size {
        min-width: 70px;
    }

    .text-editor-toolbar button {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .text-editor-area {
        padding: 12px;
        font-size: 15px;
        min-height: 150px;
    }
}

@media (max-width: 480px) {
    .text-editor-toolbar {
        padding: 6px;
        gap: 4px;
    }

    .text-editor-toolbar select {
        min-width: 80px;
        font-size: 12px;
        padding: 6px 24px 6px 8px;
    }

    .text-editor-toolbar .editor-font-family {
        min-width: 90px;
    }

    .text-editor-toolbar .editor-font-size {
        min-width: 60px;
    }

    .text-editor-toolbar button {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .text-editor-area {
        padding: 10px;
        font-size: 14px;
        min-height: 120px;
    }
}

/* Toolbar Groups for Better Organization */
.text-editor-toolbar::after {
    content: '';
    display: block;
    width: 100%;
    height: 0;
}

/* Improved Focus States */
.text-editor-toolbar select:focus,
.text-editor-toolbar button:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
    border-color: #007bff;
}

/* Loading State for Buttons */
.text-editor-toolbar button.loading {
    pointer-events: none;
    opacity: 0.6;
    position: relative;
}

.text-editor-toolbar button.loading::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .text-editor-component {
        border-color: #495057;
        background: #212529;
    }

    .text-editor-toolbar {
        background: linear-gradient(135deg, #343a40 0%, #495057 100%);
        border-bottom-color: #495057;
    }

    .text-editor-toolbar select,
    .text-editor-toolbar button {
        background: #495057;
        border-color: #6c757d;
        color: #f8f9fa;
    }

    .text-editor-toolbar button:hover {
        background: #6c757d;
        color: white;
    }

    .text-editor-area {
        background: #212529;
        color: #f8f9fa;
    }
}

/* Enhanced Content Styles within Editor */

/* Typography */
.text-editor-area h1, .text-editor-area h2, .text-editor-area h3,
.text-editor-area h4, .text-editor-area h5, .text-editor-area h6 {
    margin: 1.5rem 0 0.75rem 0;
    font-weight: 600;
    line-height: 1.3;
}

.text-editor-area h1 { font-size: 2rem; color: #212529; }
.text-editor-area h2 { font-size: 1.75rem; color: #212529; }
.text-editor-area h3 { font-size: 1.5rem; color: #343a40; }
.text-editor-area h4 { font-size: 1.25rem; color: #495057; }
.text-editor-area h5 { font-size: 1.1rem; color: #495057; }
.text-editor-area h6 { font-size: 1rem; color: #6c757d; }

.text-editor-area p {
    margin: 0.75rem 0;
    line-height: 1.6;
}

/* Links */
.text-editor-area a {
    color: #007bff;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
}

.text-editor-area a:hover {
    color: #0056b3;
    border-bottom-color: #0056b3;
}

/* Tables */
.text-editor-area table {
    border-collapse: collapse;
    width: 100%;
    margin: 1.5rem 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.text-editor-area table td,
.text-editor-area table th {
    border: 1px solid #e9ecef;
    padding: 12px 16px;
    text-align: left;
    vertical-align: top;
}

.text-editor-area table th {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
}

.text-editor-area table tr:nth-child(even) {
    background: #f8f9fa;
}

.text-editor-area table tr:hover {
    background: #e3f2fd;
}

/* Code Blocks */
.text-editor-area pre {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    margin: 1.5rem 0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.text-editor-area code {
    background: #f1f3f5;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 3px 6px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
    color: #e83e8c;
    font-weight: 500;
}

.text-editor-area pre code {
    background: transparent;
    border: none;
    padding: 0;
    color: #495057;
    font-weight: normal;
}

/* Images */
.text-editor-area img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.text-editor-area img:hover {
    transform: scale(1.02);
}

/* Lists */
.text-editor-area ul,
.text-editor-area ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

.text-editor-area li {
    margin: 0.5rem 0;
    line-height: 1.6;
}

.text-editor-area ul li {
    list-style-type: disc;
}

.text-editor-area ol li {
    list-style-type: decimal;
}

.text-editor-area ul ul li {
    list-style-type: circle;
}

.text-editor-area ul ul ul li {
    list-style-type: square;
}

/* Horizontal Rules */
.text-editor-area hr {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent, #dee2e6, transparent);
    margin: 2rem 0;
}

/* Blockquotes */
.text-editor-area blockquote {
    margin: 1.5rem 0;
    padding: 1rem 1.5rem;
    border-left: 4px solid #007bff;
    background: #f8f9fa;
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: #495057;
}

/* SVG Icons */
.text-editor-area svg {
    width: 1.5em;
    height: 1.5em;
    vertical-align: middle;
    margin: 0 0.25rem;
    fill: currentColor;
}

/* Responsive Content */
@media (max-width: 768px) {
    .text-editor-area table {
        font-size: 0.9rem;
    }

    .text-editor-area table td,
    .text-editor-area table th {
        padding: 8px 12px;
    }

    .text-editor-area pre {
        padding: 12px;
        font-size: 0.85rem;
    }

    .text-editor-area h1 { font-size: 1.75rem; }
    .text-editor-area h2 { font-size: 1.5rem; }
    .text-editor-area h3 { font-size: 1.25rem; }
}

/* Slide preview transition effects */
.transition-fade {
    animation: fadeEffect 1.2s;
}
@keyframes fadeEffect {
    0% { opacity: 1; }
    50% { opacity: 0.2; }
    100% { opacity: 1; }
}
.transition-slide-left {
    animation: slideLeftEffect 1.2s;
}
@keyframes slideLeftEffect {
    0% { transform: translateX(0); }
    50% { transform: translateX(-100px); opacity: 0.5; }
    100% { transform: translateX(0); opacity: 1; }
}
.transition-slide-right {
    animation: slideRightEffect 1.2s;
}
@keyframes slideRightEffect {
    0% { transform: translateX(0); }
    50% { transform: translateX(100px); opacity: 0.5; }
    100% { transform: translateX(0); opacity: 1; }
}
.transition-slide-up {
    animation: slideUpEffect 1.2s;
}
@keyframes slideUpEffect {
    0% { transform: translateY(0); }
    50% { transform: translateY(-60px); opacity: 0.5; }
    100% { transform: translateY(0); opacity: 1; }
}
.transition-slide-down {
    animation: slideDownEffect 1.2s;
}
@keyframes slideDownEffect {
    0% { transform: translateY(0); }
    50% { transform: translateY(60px); opacity: 0.5; }
    100% { transform: translateY(0); opacity: 1; }
}
.transition-zoom {
    animation: zoomEffect 1.2s;
}
@keyframes zoomEffect {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

/* Custom Text Editor CSS */
.text-editor-component {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fafbfc;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    padding: 0.5rem 0.75rem 0.75rem 0.75rem;
    margin-bottom: 1.5rem;
}
.text-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
    background: #f5f5f5;
    border-radius: 8px 8px 0 0;
}
.text-editor-toolbar select,
.text-editor-toolbar input[type="color"] {
    height: 32px;
    border-radius: 4px;
    border: 1px solid #ccc;
    padding: 0 0.5rem;
    font-size: 1rem;
}
.text-editor-toolbar .editor-btn {
    background: #fff;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.2s, border 0.2s;
    color: #333;
}
.text-editor-toolbar .editor-btn:hover {
    background: #e9ecef;
    border-color: #b0b0b0;
}
.text-editor-area {
    min-height: 200px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 0 0 8px 8px;
    padding: 1rem;
    font-size: 1rem;
    outline: none;
    transition: border 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.text-editor-area:focus {
    border-color: #007bff;
}
.text-editor-area table {
    border-collapse: collapse;
    width: 100%;
}
.text-editor-area table td, .text-editor-area table th {
    border: 1px solid #ccc;
    padding: 4px 8px;
}
.text-editor-area pre, .text-editor-area code {
    background: #f8f8f8;
    color: #333;
    font-family: 'Fira Mono', 'Consolas', 'Menlo', monospace;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.95em;
}
.text-editor-area img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 4px 0;
}
.text-editor-area hr {
    border: none;
    border-top: 1px solid #bbb;
    margin: 1rem 0;
}
.text-editor-area svg {
    width: 1.5em;
    height: 1.5em;
    vertical-align: middle;
    margin: 0 2px;
}
/*responsive images*/
  .modal-body
  .article-body-preview img
  {
   max-width: 100%;
   height: auto;
   display: block;
   margin: 0 auto 1rem auto;
}

.article-body
.article-body-preview img
  {
   max-width: 100%;
   height: auto;
   display: block;
   margin: 0 auto 1rem auto;
}

/* Alignment Button Groups */
.text-editor-toolbar .btn-group {
    display: inline-flex;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.text-editor-toolbar .btn-group .editor-btn {
    border-radius: 0;
    border-right: none;
    margin: 0;
}

.text-editor-toolbar .btn-group .editor-btn:first-child {
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

.text-editor-toolbar .btn-group .editor-btn:last-child {
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
    border-right: 1px solid #ced4da;
}

.text-editor-toolbar .btn-group .editor-btn:hover {
    z-index: 1;
}

.text-editor-toolbar .btn-group .editor-btn.active {
    z-index: 2;
}

/* Alignment Specific Icons */
.text-editor-toolbar .btn-group .editor-btn i {
    font-size: 14px;
}

/* Active state for alignment buttons */
.text-editor-area[style*="text-align: left"] ~ .text-editor-toolbar [data-command="justifyLeft"],
.text-editor-area[style*="text-align: center"] ~ .text-editor-toolbar [data-command="justifyCenter"],
.text-editor-area[style*="text-align: right"] ~ .text-editor-toolbar [data-command="justifyRight"],
.text-editor-area[style*="text-align: justify"] ~ .text-editor-toolbar [data-command="justifyFull"] {
    background: #007bff;
    color: white;
    border-color: #0056b3;
}

/* Undo/Redo button styling */
.text-editor-toolbar [data-command="undo"],
.text-editor-toolbar [data-command="redo"] {
    position: relative;
}

.text-editor-toolbar [data-command="undo"]:hover,
.text-editor-toolbar [data-command="redo"]:hover {
    background: #f8f9fa;
    border-color: #007bff;
    color: #007bff;
}

.text-editor-toolbar [data-command="undo"]:active,
.text-editor-toolbar [data-command="redo"]:active {
    background: #e9ecef;
    transform: translateY(1px);
}

/* Disabled state for undo/redo when not available */
.text-editor-toolbar [data-command="undo"].disabled,
.text-editor-toolbar [data-command="redo"].disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Keyboard shortcut indicators */
.text-editor-toolbar [data-command="undo"]::after,
.text-editor-toolbar [data-command="redo"]::after {
    content: attr(title);
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1000;
}

.text-editor-toolbar [data-command="undo"]:hover::after,
.text-editor-toolbar [data-command="redo"]:hover::after {
    opacity: 1;
}
