/* === WebApp Styles === */
/* Import Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* Import theme variables */
@import url('theme.css');

/* === CSS Variables === */
:root {
    --bg-color: #f3f4f6;
    --header-bg: #131312;
    --text-color: #111827;  
    --editor-bg: #f9fafb;
    --border-color: #e5e7eb;
    --control-btn-bg: rgba(255, 255, 255, 0.1);
    --modal-bg: #ffffff;
    --modal-text: #374151;
    --accent-color: #4f46e5;
    --accent-light: #e5e7eb;
    --accent-hover: #4338ca;
    --chat-primary: #4f46e5;
    --chat-secondary: #e5e7eb;
    --chat-accent: #e9d5ff;
    --chat-text-primary: #ffffff;
    --chat-text-secondary: #111827;
    --chat-border: #e5e7eb;
    --chat-tooltip-bg: #1f2937;
}

.dark-mode {
    --bg-color: #1f2937;
    --header-bg: #3730a3;
    --text-color: #f9fafb;
    --editor-bg: #111827;
    --border-color: #374151;
    --control-btn-bg: rgba(255, 255, 255, 0.05);
    --modal-bg: #1f2937;
    --modal-text: #f3f4f6;
    --chat-primary: #6366f1;
    --chat-secondary: #374151;
    --chat-accent: #8b5cf6;
    --chat-text-primary: #ffffff;
    --chat-text-secondary: #f3f4f6;
    --chat-border: #4b5563;
    --chat-tooltip-bg: #111827;
}

/* === Core Layout === */
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
}

.main-container {
    display: flex;
    height: 100vh;
    position: relative;
    transition: margin 0.3s ease;
}

.editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-color);
    transition: width 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 
                0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.editor-container:focus-within {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 
                0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.editor-header {
    background-color: var(--header-bg);
    color: white;
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    gap: 1rem;
}

.editor-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.editor-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.control-group {
    display: flex;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 0.25rem;
}

.control-btn {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: all 0.2s;
    background-color: transparent;
    border: none;
}

.control-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.control-btn.active {
    background-color: rgba(255, 255, 255, 0.3);
}

.control-btn i {
    font-size: 0.9rem;
}

/* === Editor Content === */
.editor-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

.code-section, .preview-section {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.CodeMirror {
    flex: 1;
    height: auto !important;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.95rem;
    line-height: 1.5;
    background-color: var(--editor-bg);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
}

.preview-frame {
    flex: 1;
    border: none;
    background-color: white;
    width: 100%;
    height: 100%;
}

.resize-handle {
    width: 8px;
    height: 100%;
    background-color: var(--border-color);
    cursor: col-resize;
    flex-shrink: 0;
    position: relative;
    transition: background-color 0.3s;
}

.resize-handle:hover {
    background-color: #4f46e5;
}

.resize-handle::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 24px;
    background-color: #9ca3af;
    border-radius: 1px;
}

/* === Preview Section Responsive Device Emulation === */
.preview-section {
    transition: all 0.3s ease;
}

.preview-section.desktop {
    max-width: 100%;
}

.preview-section.tablet {
    max-width: 768px;
    margin: 0 auto;
    border: 12px solid #1a1a1a;
    border-radius: 12px;
    height: calc(100% - 24px);
    box-shadow: 0 0 20px rgba(0,0,0,0.2);
}

.preview-section.mobile {
    max-width: 375px;
    margin: 0 auto;
    border: 12px solid #1a1a1a;
    border-radius: 24px;
    height: calc(100% - 24px);
    box-shadow: 0 0 20px rgba(0,0,0,0.2);
}

.preview-section.tablet::before,
.preview-section.mobile::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 6px;
    background: #333;
    border-radius: 3px;
}

.preview-section.tablet::after,
.preview-section.mobile::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: #333;
    border-radius: 2px;
}

/* === Chatbot Sidepanel Styling === */
.chat-sidepanel {
    width: 400px;
    height: 100vh;
    background-color: white;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    transition: transform 0.4s cubic-bezier(.4,0,.2,1), opacity 0.3s;
    position: relative;
    border-left: 1px solid var(--border-color);
}

.chat-sidepanel.left {
    border-left: none;
    border-right: 1px solid var(--border-color);
    box-shadow: 5px 0 15px rgba(0, 0, 0, 0.1);
}

.chat-sidepanel.slide-out-right {
    transform: translateX(110%) translateY(30px) scale(0.6);
    opacity: 0;
    pointer-events: none;
}

.chat-sidepanel.slide-out-left {
    transform: translateX(-110%) translateY(30px) scale(0.6);
    opacity: 0;
    pointer-events: none;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
}

.chat-header {
    background-color: var(--header-bg);
    color: white;
    padding: 1.25rem;
    font-weight: 600;
    font-size: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-position-toggle {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1rem;
}

.chat-messages {
    height: 100%;
    overflow-y: auto;
    padding: 1.25rem;
    background-color: #f9fafb;
}

.message {
    margin-bottom: 1rem;
    max-width: 80%;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    font-size: 0.95rem;
    line-height: 1.4;
}

.user-message {
    background-color: var(--header-bg);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 0.25rem;
}

.bot-message {
    background-color: #e5e7eb;
    color: #111827;
    margin-right: auto;
    border-bottom-left-radius: 0.25rem;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    background-color: #e5e7eb;
    border-radius: 1rem;
    width: fit-content;
    margin-bottom: 1rem;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background-color: #6b7280;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
    animation-delay: 0s;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.6;
    }
    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

.chat-input-container {
    padding: 1rem;
    background-color: white;
    border-top: 1px solid #e5e7eb;
    position: relative;
}

.chat-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 0.95rem;
    resize: none;
    min-height: 50px;
    max-height: 150px;
    background-color: #f9fafb;
    transition: border-color 0.2s;
}

.chat-input:focus {
    outline: none;
    border-color: var(--header-bg);
}

.input-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.action-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s;
    background-color: transparent;
    border: none;
}

.action-btn:hover {
    background-color: #e5e7eb;
    color: var(--header-bg);
}

.action-btn.active {
    color: var(--header-bg);
}

.file-drop-area {
    position: relative;
    overflow: visible !important;
}

.file-input {
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-preview {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.file-preview-item {
    background-color: #e5e7eb;
    padding: 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.file-preview-item button {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    font-size: 0.8rem;
}

/* === Chat & Quick Action Buttons === */
.chat-action-btn, .quick-action-btn {
    border-radius: 4px;
    min-height: 44px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    background-color: var(--accent-light) !important;
    color: var(--header-bg);
    border: 1px solid rgba(75, 85, 99, 0.15);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    transition: all 200ms ease-in-out;
    cursor: pointer;
    outline: none;
}

.chat-action-btn:hover, .quick-action-btn:hover {
    background-color: var(--header-bg) !important;
    color: #FFFFFF;
    box-shadow: none !important;
    transform: none !important;
    border-radius: 4px !important;
    border: 1px solid rgba(75, 85, 99, 0.15);
}

.chat-action-btn:active, .quick-action-btn:active {
    transform: scale(0.95);
    transition: all 100ms ease-in-out;
    box-shadow: 0 1px 2px rgba(79, 70, 229, 0.1);
}

.chat-action-btn:focus, .quick-action-btn:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* === Button Group and History Items === */
.button-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
    margin-bottom: 6px;
    border-radius: 6px;
    background-color: rgba(243, 244, 246, 0.7);
    transition: all 0.2s ease;
}

.button-group-header:hover {
    background-color: rgba(243, 244, 246, 0.9);
}

.button-group-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #4b5563;
    display: flex;
    align-items: center;
    gap: 4px;
}

.button-group-title i {
    font-size: 0.7rem;
    color: var(--header-bg);
}

.button-group-toggle {
    background: transparent;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 4px 6px;
    font-size: 0.75rem;
    opacity: 0.75;
    transition: all 0.2s ease;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.button-group-toggle span {
    font-size: 0.7rem;
    font-weight: 500;
}

.button-group-toggle:hover {
    background-color: rgba(55, 65, 81, 0.1);
    color: var(--header-bg);
    opacity: 1;
}

.button-group-toggle i {
    transition: transform 0.3s ease;
}

.button-group-toggle.collapsed i {
    transform: rotate(180deg);
}

#chat-action-buttons,
#quick-action-buttons {
    transition: max-height 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
    transform-origin: top;
    overflow: hidden;
}

.buttons-collapsed #chat-action-buttons,
.buttons-collapsed #quick-action-buttons {
    max-height: 0 !important;
    opacity: 0;
    transform: scaleY(0);
    margin: 0;
    padding: 0;
}

/* === History Items === */
.history-item {
    transition: all 0.2s ease;
    position: relative;
}

.history-item.selected {
    background-color: rgba(75, 85, 99, 0.08) !important;
    border-color: rgba(75, 85, 99, 0.3) !important;
}

.history-item.selected::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: var(--header-bg);
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
}

.history-item.selected span {
    color: var(--accent-hover) !important;
    font-weight: 600 !important;
}

/* === Tooltips === */
.chat-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    background-color: var(--chat-tooltip-bg);
    color: white;
    font-size: 12px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    pointer-events: none;
    margin-bottom: 4px;
    z-index: 9999;
}

.chat-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 4px;
    border-style: solid;
    border-color: var(--chat-tooltip-bg) transparent transparent transparent;
}

.group:hover .chat-tooltip,
.group:focus .chat-tooltip {
    opacity: 1;
    visibility: visible;
}

/* === Undo Toast === */
.undo-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #1f2937;
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
}

.undo-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.undo-toast .undo-btn {
    background-color: var(--header-bg);
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 0.25rem;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.undo-toast .undo-btn:hover {
    background-color: var(--accent-hover);
}

/* === Modal Styling === */
.modal-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.modal-bg.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background-color: var(--modal-bg);
    border-radius: 0.5rem;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
}

.modal-bg.show .modal {
    transform: translateY(0);
    opacity: 1;
}

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

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--modal-text);
}

.modal-close {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.25rem;
}

.modal-content {
    padding: 1rem;
    color: var(--modal-text);
}

.modal-footer {
    padding: 1rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.modal-btn {
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-btn-cancel {
    background-color: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.modal-btn-cancel:hover {
    background-color: #e5e7eb;
}

.modal-btn-primary {
    background-color: var(--header-bg);
    color: white;
    border: none;
}

.modal-btn-primary:hover {
    background-color: var(--accent-hover);
}

/* Toast notification styles */
.toast {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background-color: #4f46e5;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 100;
}

.toast.show {
    opacity: 1;
}

/* Button styles */
.btn {
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s;
    border: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    cursor: pointer;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.btn:active {
    transform: translateY(0) scale(0.98);
}

.btn-copy {
    background-color: #57606f;
}

.btn-copy:hover {
    background-color: #2f3542;
}

.btn-download {
    background-color: #57606f;
}

.btn-download:hover {
    background-color: #000000;
}

.btn-primary {
    background-color: #4f46e5;
    color: white;
    border: none;
}

.btn-primary:hover {
    background-color: #4338ca;
}

.btn-secondary {
    background-color: var(--editor-bg);
    color: var(--modal-text);
    border: none;
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

/* Modal styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background-color: var(--modal-bg);
    color: var(--modal-text);
    border-radius: 0.5rem;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s, color 0.3s;
}

.modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 1.1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Add more styles as needed from index.html */

/* === Notification Components === */
.toast {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background-color: #4f46e5;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 100;
}

.toast.show {
    opacity: 1;
}

/* === Button Styles === */
.btn {
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s;
    border: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    cursor: pointer;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.btn:active {
    transform: translateY(0) scale(0.98);
}

.btn-copy {
    background-color: #57606f;
}

.btn-copy:hover {
    background-color: #000000;
}

.btn-download {
    background-color: #57606f;
}

.btn-download:hover {
    background-color: #000000;
}

.btn-primary {
    background-color: #4f46e5;
    color: white;
    border: none;
}

.btn-primary:hover {
    background-color: #4338ca;
}

.btn-secondary {
    background-color: var(--editor-bg);
    color: var(--modal-text);
    border: none;
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

/* === Modal Styles === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background-color: var(--modal-bg);
    color: var(--modal-text);
    border-radius: 0.5rem;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s, color 0.3s;
}

.modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 1.1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--modal-text);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* === Form Controls === */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--modal-text);
}

.form-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 0.9rem;
    background-color: var(--modal-bg);
    color: var(--modal-text);
    transition: border-color 0.3s, background-color 0.3s, color 0.3s;
}

.form-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 0.9rem;
    background-color: var(--modal-bg);
    color: var(--modal-text);
    transition: border-color 0.3s, background-color 0.3s, color 0.3s;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 1rem;
}

.form-select:focus, .form-input:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* === Toggle Switch === */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #4f46e5;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.toggle-label {
    margin-left: 0.5rem;
    font-size: 0.9rem;
}

.toggle-container {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

/* === Tooltip Styles === */
.tooltip {
    position: relative;
    display: inline-block;
    cursor: pointer;
    font-family: "Arial", sans-serif;
}

.tooltip:hover .tooltiptext,
.tooltip:focus-within .tooltiptext {
    visibility: visible;
    opacity: 1;
}

.tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 5px;
    padding: 10px;
    position: absolute;
    z-index: 1;
    top: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.95rem;
}

.tooltiptext::after {
    content: "";
    position: absolute;
    top: -10px;
    left: 50%;
    margin-left: -10px;
    border-width: 10px;
    border-style: solid;
    border-color: transparent transparent #333 transparent;
}

/* Modern Tailwind-style tooltips */
.tw-tooltip {
    position: absolute;
    left: 50%;
    bottom: 100%;
    margin-bottom: 0.5rem;
    min-width: 80px;
    max-width: 240px;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    background: #18181b;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 8px 32px 0 rgba(31, 41, 55, 0.25), 0 1.5px 4px 0 rgba(0,0,0,0.10);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 50;
    transform: translateX(-50%) translateY(10px);
}

.group:hover .tw-tooltip,
.group:focus .tw-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.tw-tooltip-down {
    position: absolute;
    left: 50%;
    top: 100%;
    margin-top: 0.5rem;
    min-width: 80px;
    max-width: 240px;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    background: #18181b;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 8px 32px 0 rgba(31, 41, 55, 0.25), 0 1.5px 4px 0 rgba(0,0,0,0.10);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 50;
    transform: translateX(-50%) translateY(-10px);
}

.group:hover .tw-tooltip-down,
.group:focus .tw-tooltip-down {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* === Floating Action Buttons === */
.floating-action-btns {
    position: absolute;
    right: 36px;
    bottom: 36px;
    z-index: 50;
    display: flex;
    flex-direction: row;
    gap: 16px;
    transition: opacity 0.4s, transform 0.4s;
    opacity: 1;
    pointer-events: auto;
}

.floating-action-btns.hide {
    opacity: 0;
    pointer-events: none;
    transform: translateY(40px) scale(0.95);
}

.fab-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 700;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    background: linear-gradient(145deg, #2ed573 80%, #1ed573 100%);
    color: #fff;
    box-shadow: 0 8px 32px 0 rgba(46,213,115,0.25), 0 2px 8px 0 rgba(83,82,237,0.10);
    border: none;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s, transform 0.2s;
    transform: scale(1) translateY(0);
    will-change: transform, box-shadow;
    outline: none;
    position: relative;
    overflow: hidden;
    animation: floaty 3.5s ease-in-out infinite alternate;
    z-index: 50;
}

.fab-btn:active {
    transform: scale(0.97);
}

.fab-btn:hover {
    background: linear-gradient(145deg, #5352ed 80%, #2ed573 100%);
    color: #fff;
    box-shadow: 0 12px 36px 0 rgba(83,82,237,0.18), 0 4px 16px 0 rgba(46,213,115,0.10);
    transform: scale(1.07) translateY(-2px);
}

@keyframes floaty {
    0% { transform: scale(1) translateY(0); }
    100% { transform: scale(1.03) translateY(-8px); }
}

/* === Utility Classes === */
.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
} 

/* === Focus Mode (Fullscreen Preview) === */
.focus-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.focus-overlay.active {
    opacity: 1;
    visibility: visible;
}

.focus-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.focus-frame {
    width: 90%;
    height: 90%;
    max-width: 1200px;
    border: none;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.focus-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 10000;
}

.focus-control-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: #333;
}

.focus-control-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

.focus-exit-hint {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.focus-overlay:hover .focus-exit-hint {
    opacity: 1;
}

/* === More Dropdown Styles === */
#more-dropdown {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15), 0 4px 6px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
    padding: 8px 0;
}

#more-dropdown.show {
    opacity: 1 !important;
    visibility: visible !important;
    transform: scale(1) !important;
}

#more-dropdown button {
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    margin: 0 8px;
    transition: all 0.2s ease;
    border: none;
    position: relative;
    overflow: hidden;
    max-width: calc(100% - 16px);
    box-sizing: border-box;
}

#more-dropdown button:hover {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    transform: translateX(1px);
    box-shadow: 0 4px 8px rgba(99, 102, 241, 0.3);
}

#more-dropdown button:hover i {
    color: white;
    transform: scale(1.1);
}

#more-dropdown button:focus {
    outline: 2px solid #3b82f6;
    outline-offset: -2px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
}

#more-dropdown button:active {
    transform: translateX(1px) scale(0.98);
}

/* Individual button icon colors on hover */
#more-dropdown button#clip-btn:hover i {
    color: white;
}

#more-dropdown button#embed-btn:hover i {
    color: white;
}

#more-dropdown button#share-social-btn:hover i {
    color: white;
}

#more-dropdown button#visual-edit-btn:hover i {
    color: white;
}

/* Coming soon button styling */
#more-dropdown button#publish-coming-soon-btn {
    opacity: 0.5;
    cursor: not-allowed;
}

#more-dropdown button#publish-coming-soon-btn:hover {
    background: transparent;
    color: #9ca3af;
    transform: none;
    box-shadow: none;
}

#more-dropdown button#publish-coming-soon-btn:hover i {
    color: #9ca3af;
    transform: none;
}

/* === Mobile/Tablet Responsive Rules === */

/* Tablet View (769px - 1024px) */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    /* ChatBot Header - Hide Left/Right Arrow on Tablet */
    .chat-position-toggle {
        display: none !important;
    }
    
    /* Editor Header - Hide all small control buttons on Tablet */
    .editor-controls .control-group {
        display: none !important;
    }
    
    /* Editor Header - Hide all large buttons first, then show specific ones */
    .editor-controls .flex.gap-2.ml-4 button {
        display: none !important;
    }
    
    /* Show only the buttons we want on Tablet with very high specificity */
    .editor-controls .flex.gap-2.ml-4 #download-btn-large,
    .editor-controls .flex.gap-2.ml-4 #save-img-btn,
    .editor-controls .flex.gap-2.ml-4 #save-pdf-btn,
    .editor-controls .flex.gap-2.ml-4 #more-btn {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* More button - Show only dots and arrow on Tablet */
    #more-btn span:not(.fa-ellipsis-h):not(.fa-chevron-down) {
        display: none !important;
    }
    
    /* More dropdown responsive */
    #more-dropdown {
        right: 0;
        width: 200px;
    }
}

/* Mobile View (481px - 768px) */
@media screen and (min-width: 481px) and (max-width: 768px) {
    /* ChatBot Header - Hide Left/Right Arrow on Mobile */
    .chat-position-toggle {
        display: none !important;
    }
    
    /* Editor Header - Hide all small control buttons on Mobile */
    .editor-controls .control-group {
        display: none !important;
    }
    
    /* Editor Header - Hide all large buttons first, then show specific ones */
    .editor-controls .flex.gap-2.ml-4 button {
        display: none !important;
    }
    
    /* Show only the buttons we want on Mobile with very high specificity */
    .editor-controls .flex.gap-2.ml-4 #download-btn-large,
    .editor-controls .flex.gap-2.ml-4 #save-img-btn,
    .editor-controls .flex.gap-2.ml-4 #save-pdf-btn,
    .editor-controls .flex.gap-2.ml-4 #more-btn {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* More button - Show only dots and arrow on Mobile */
    #more-btn span:not(.fa-ellipsis-h):not(.fa-chevron-down) {
        display: none !important;
    }
    
    /* More dropdown responsive */
    #more-dropdown {
        right: 0;
        width: 200px;
    }
}

/* Small Mobile View (max-width: 480px) */
@media screen and (max-width: 480px) {
    /* ChatBot Header - Hide Left/Right Arrow on Small Mobile */
    .chat-position-toggle {
        display: none !important;
    }
    
    /* Editor Header - Hide all small control buttons on Small Mobile */
    .editor-controls .control-group {
        display: none !important;
    }
    
    /* Editor Header - Hide all large buttons first, then show specific ones */
    .editor-controls .flex.gap-2.ml-4 button {
        display: none !important;
    }
    
    /* Show only the buttons we want on Small Mobile with very high specificity */
    .editor-controls .flex.gap-2.ml-4 #download-btn-large,
    .editor-controls .flex.gap-2.ml-4 #save-img-btn,
    .editor-controls .flex.gap-2.ml-4 #save-pdf-btn,
    .editor-controls .flex.gap-2.ml-4 #more-btn {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* More button - Show only dots and arrow on Small Mobile */
    #more-btn span:not(.fa-ellipsis-h):not(.fa-chevron-down) {
        display: none !important;
    }
    
    #more-btn {
        padding: 0.5rem 0.75rem !important;
        min-width: auto !important;
    }
    
    /* === NUCLEAR OPTION: FORCE MOBILE DROPDOWN VISIBILITY (ONLY WHEN SHOWN) === */
    #more-dropdown {
        width: 180px !important;
        margin-right: 0 !important;
        right: 0 !important;
        left: auto !important;
        margin-top: 0.5rem !important;
        z-index: 99999 !important;
        position: absolute !important;
        top: 100% !important;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25) !important;
        background: white !important;
        border: 1px solid #ddd !important;
        border-radius: 8px !important;
        padding: 8px 0 !important;
        /* HIDDEN BY DEFAULT - only show when .show class is applied */
        visibility: hidden !important;
        opacity: 0 !important;
        display: none !important;
        transform: scale(0.95) !important;
        -webkit-transform: scale(0.95) !important;
        pointer-events: none !important;
    }
    
    /* NUCLEAR: Force show state with maximum specificity */
    html body .editor-controls #more-dropdown.show,
    html body #more-dropdown.show,
    #more-dropdown.show {
        opacity: 1 !important;
        visibility: visible !important;
        transform: scale(1) !important;
        -webkit-transform: scale(1) !important;
        display: block !important;
        position: absolute !important;
        z-index: 99999 !important;
        background: white !important;
        border: 1px solid #ddd !important;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25) !important;
        max-height: 500px !important;
        overflow: visible !important;
        clip: auto !important;
        clip-path: none !important;
        pointer-events: auto !important;
    }
    
    /* NUCLEAR: Force button visibility */
    #more-dropdown button,
    html body #more-dropdown button {
        font-size: 13px !important;
        padding: 8px 12px !important;
        width: calc(100% - 16px) !important;
        text-align: left !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        background: white !important;
        color: #333 !important;
        border: 1px solid #ddd !important;
        margin: 2px 8px !important;
        border-radius: 4px !important;
        cursor: pointer !important;
        pointer-events: auto !important;
        position: relative !important;
        z-index: 99999 !important;
        min-height: 35px !important;
        max-height: none !important;
        overflow: visible !important;
        clip: auto !important;
        clip-path: none !important;
    }
    
    /* NUCLEAR: Force button hover states */
    #more-dropdown button:hover,
    html body #more-dropdown button:hover {
        background: #f0f0f0 !important;
        color: #000 !important;
        border-color: #999 !important;
    }
    
    /* NUCLEAR: Container positioning with maximum override */
    html body .editor-controls #more-dropdown-container,
    html body #more-dropdown-container,
    #more-dropdown-container {
        position: relative !important;
        z-index: 99999 !important;
        visibility: visible !important;
        opacity: 1 !important;
        display: block !important;
        overflow: visible !important;
        clip: auto !important;
        clip-path: none !important;
    }
    
    /* NUCLEAR: Override ANY hiding classes or styles */
    .editor-controls .flex.gap-2.ml-4 #more-dropdown-container {
        position: relative !important;
        z-index: 99999 !important;
        visibility: visible !important;
        opacity: 1 !important;
        display: block !important;
        overflow: visible !important;
    }
    
    /* NUCLEAR: Webkit/mobile specific overrides */
    @supports (-webkit-appearance: none) {
        #more-dropdown.show,
        html body #more-dropdown.show {
            -webkit-transform: scale(1) !important;
            transform: scale(1) !important;
            -webkit-opacity: 1 !important;
            opacity: 1 !important;
            visibility: visible !important;
            display: block !important;
        }
    }
    
    /* NUCLEAR: iOS Safari specific fixes */
    @media screen and (-webkit-min-device-pixel-ratio: 0) {
        #more-dropdown.show {
            -webkit-transform: scale(1) !important;
            transform: scale(1) !important;
            visibility: visible !important;
            opacity: 1 !important;
            display: block !important;
            z-index: 99999 !important;
        }
    }
}

/* === Focus Mode (Fullscreen Preview) === */
.focus-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.focus-overlay.active {
    opacity: 1;
    visibility: visible;
}

.focus-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.focus-frame {
    width: 90%;
    height: 90%;
    max-width: 1200px;
    border: none;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.focus-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 10000;
}

.focus-control-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: #333;
}

.focus-control-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

.focus-exit-hint {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.focus-overlay:hover .focus-exit-hint {
    opacity: 1;
}

/* === More Dropdown Styles === */
#more-dropdown {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15), 0 4px 6px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
    padding: 8px 0;
}

#more-dropdown.show {
    opacity: 1 !important;
    visibility: visible !important;
    transform: scale(1) !important;
}

#more-dropdown button {
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    margin: 0 8px;
    transition: all 0.2s ease;
    border: none;
    position: relative;
    overflow: hidden;
    max-width: calc(100% - 16px);
    box-sizing: border-box;
}

#more-dropdown button:hover {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    transform: translateX(1px);
    box-shadow: 0 4px 8px rgba(99, 102, 241, 0.3);
}

#more-dropdown button:hover i {
    color: white;
    transform: scale(1.1);
}

#more-dropdown button:focus {
    outline: 2px solid #3b82f6;
    outline-offset: -2px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
}

#more-dropdown button:active {
    transform: translateX(1px) scale(0.98);
}

/* Individual button icon colors on hover */
#more-dropdown button#clip-btn:hover i {
    color: white;
}

#more-dropdown button#embed-btn:hover i {
    color: white;
}

#more-dropdown button#share-social-btn:hover i {
    color: white;
}

#more-dropdown button#visual-edit-btn:hover i {
    color: white;
}

/* Coming soon button styling */
#more-dropdown button#publish-coming-soon-btn {
    opacity: 0.5;
    cursor: not-allowed;
}

#more-dropdown button#publish-coming-soon-btn:hover {
    background: transparent;
    color: #9ca3af;
    transform: none;
    box-shadow: none;
}

#more-dropdown button#publish-coming-soon-btn:hover i {
    color: #9ca3af;
    transform: none;
}