* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'IBM Plex Sans', sans-serif;
    background: #1c1c1e;
    color: #ffffff;
    height: 100vh;
    overflow: hidden;
}

.editor-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.title-bar {
    display: none;
}

.find-replace-panel {
    background: #2c2c2e;
    padding: 10px 20px;
    border-bottom: 1px solid #38383a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    display: none;

}

.find-replace-container {
    display: flex;
    gap: 12px;
    flex: 1;
}

.find-container,
.replace-container {
    display: flex;
    align-items: center;
    position: relative;
    flex: 1;
    max-width: 300px;
}

.search-icon,
.replace-icon {
    position: absolute;
    left: 8px;
    color: #8e8e93;
    font-size: 18px;
    line-height: 1;
}

#find-input,
#replace-input {
    background: #3a3a3c;
    border: none;
    border-radius: 6px;
    color: #ffffff;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px;
    padding: 6px 12px 6px 32px;
    width: 100%;
    outline: none;
}

#find-input:focus,
#replace-input:focus {
    box-shadow: 0 0 0 2px #F5E985;
}

.match-count {
    position: absolute;
    right: 8px;
    color: #8e8e93;
    font-size: 12px;
    font-weight: 500;
}

.find-replace-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.find-btn {
    background: #3a3a3c;
    border: none;
    border-radius: 4px;
    color: #ffffff;
    cursor: pointer;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 500;
    transition: background 0.2s;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.find-btn:hover {
    background: #48484a;
    color: #F5E985;
}

.find-btn .material-icons,
.find-btn .material-symbols-outlined {
    font-size: 16px;
}

.close-btn {
    padding: 6px;
}


.highlight-match {
    background-color: rgba(245, 233, 133, 0.3);
    border-radius: 2px;
}

.highlight-active {
    background-color: rgba(245, 233, 133, 0.8);
    border-radius: 2px;
    color: #1c1c1e;
}

.title-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.title-container img {
    height: 24px;
    width: auto;
}

.title {
    font-size: 20px;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    color: #F5E985;
    letter-spacing: -0.2px;
}

.controls {
    display: flex;
    gap: 16px;
}

.control-btn {
    font-family: 'IBM Plex Sans', sans-serif;
    background: transparent;
    border: none;
    color: #8e8e93;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
}

.control-btn:hover {
    background: #3a3a3c;
    color: #F5E985;
}

.control-btn .material-icons,
.control-btn .material-symbols-outlined {
    font-size: 18px;
}

/* Material Symbols styles */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  font-size: 18px;
  line-height: 1;
  vertical-align: middle;
}

/* Ensure both icon sets have the same alignment in suggestion items */
.suggestion-icon.material-icons,
.suggestion-icon.material-symbols-outlined {
  font-size: 18px;
  vertical-align: middle;
  margin-right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.editor-panel,
.preview-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.editor-panel {
    position: relative;
    border-right: 1px solid #38383a;
    background: #1c1c1e;
}

.preview-panel {
    background: #ffffff;
}

#butterscript-input {
    flex: 1;
    background: #1c1c1e;
    color: #ffffff;
    border: none;
    outline: none;
    padding: 24px;
    font-family: 'IBM Plex Mono', 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.7;
    resize: none;
    tab-size: 2;
}

#butterscript-input::placeholder {
    color: #8e8e93;
}

#butterscript-input::selection {
    background: #F5E985;
    color: #1c1c1e;
}

#preview {
    flex: 1;
    background: #ffffff;
    overflow-y: auto;
    padding: 24px;
    font-family: 'IBM Plex Sans', sans-serif;
    color: #1d1d1f;
}

/* Make sure font family styles are respected */
#preview span[style*="font-family: 'IBM Plex Sans'"],
#preview span[style*='font-family: "IBM Plex Sans"'] {
    font-family: 'IBM Plex Sans', sans-serif !important;
}

#preview span[style*="font-family: 'IBM Plex Serif'"],
#preview span[style*='font-family: "IBM Plex Serif"'] {
    font-family: 'IBM Plex Serif', serif !important;
}

#preview span[style*="font-family: 'IBM Plex Mono'"],
#preview span[style*='font-family: "IBM Plex Mono"'] {
    font-family: 'IBM Plex Mono', monospace !important;
}

/* Font classes for more reliable font styling */
#preview .bs-font-sans,
#preview span[style*="font-family: 'IBM Plex Sans'"],
#preview span[style*='font-family: "IBM Plex Sans"'] {
    font-family: 'IBM Plex Sans', sans-serif !important;
}

#preview .bs-font-serif,
#preview span[style*="font-family: 'IBM Plex Serif'"],
#preview span[style*='font-family: "IBM Plex Serif"'] {
    font-family: 'IBM Plex Serif', serif !important;
}

#preview .bs-font-mono,
#preview span[style*="font-family: 'IBM Plex Mono'"],
#preview span[style*='font-family: "IBM Plex Mono"'] {
    font-family: 'IBM Plex Mono', monospace !important;
}

.status-bar {
    background: #2c2c2e;
    color: #8e8e93;
    padding: 8px 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid #F5E985;
    font-weight: 500;
}

.status-left,
.status-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.keyboard-hint {
    font-size: 11px;
    opacity: 0.7;
}


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

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: #2c2c2e;
    min-width: 220px;
    box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.5);
    z-index: 110000;
    border-radius: 6px;
    border: 1px solid #444446;
    padding: 5px 0;
    margin-top: 5px;
    overflow: hidden;
    animation: fadeIn 0.2s ease;
}

.dropdown-content a {
    color: #ffffff;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 13px;
    transition: background-color 0.2s;
}

.dropdown-content a:hover {
    background-color: #3a3a3c;
    color: #F5E985;
}

.show {
    display: block;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.export-btn {
    display: flex;
    align-items: center;
}

.export-btn .material-icons:last-child {
    font-size: 16px;
    margin-left: 4px;
}


#preview h1,
#preview h2,
#preview h3,
#preview h4,
#preview h5,
#preview h6 {
    margin: 1.5em 0 0.8em 0;
    color: #1d1d1f;
    font-weight: 700;
    letter-spacing: -0.5px;
}

#preview h1 {
    font-size: 2.5em;
    margin-top: 0;
}

#preview h2 {
    font-size: 2em;
}

#preview h3 {
    font-size: 1.5em;
}

#preview p {
    margin: 1em 0;
    line-height: 1.7;
    font-size: 16px;
}

#preview ul,
#preview ol {
    margin: 1em 0;
    padding-left: 2em;
}

#preview li {
    margin: 0.5em 0;
    line-height: 1.6;
}

#preview blockquote {
    border-left: 4px solid #F5E985;
    padding-left: 1.5em;
    margin: 1.5em 0;
    color: #6d6d70;
    font-style: italic;
    font-size: 1.1em;
}

#preview code {
    background: #f2f2f7;
    padding: 3px 8px;
    border-radius: 6px;
    font-family: 'IBM Plex Mono', 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 0.9em;
    color: #d70015;
}


#preview mark {
    background-color: #ffe066;
    padding: 0 3px;
    border-radius: 3px;
}

#preview s {
    text-decoration: line-through;
    opacity: 0.8;
}


#preview mark:not([style]) {
    background-color: #ffe066;
    color: #1d1d1f;
}


#preview strong mark,
#preview em mark,
#preview u mark,
#preview mark strong,
#preview mark em,
#preview mark u {
    display: inline-block;
    padding: 0 3px;
}

#preview pre {
    background: #f2f2f7;
    padding: 20px;
    border-radius: 12px;
    overflow-x: auto;
    margin: 1.5em 0;
    border: 1px solid #e5e5ea;
}

#preview a {
    color: #8B7B22;
    text-decoration: none;
}

#preview a:hover {
    text-decoration: underline;
}

#preview img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 1em 0;
}

#preview hr {
    border: none;
    border-top: 1px solid #F5E985;
    margin: 3em 0;
}


.highlight-text {
    background-color: #ffffc8;
    border-left: 4px solid #F5E985;
    padding: 8px 16px;
    border-radius: 4px;
    animation: pulse 1s ease;
}

@keyframes pulse {
    0% {
        background-color: #F5E985;
    }

    100% {
        background-color: #ffffc8;
    }
}

.toast {
    position: fixed;
    top: 70px;
    right: 20px;
    background: #2c2c2e;
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 12px;
    z-index: 1000;
    animation: slideIn 0.3s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid #F5E985;
    font-weight: 500;
}

@keyframes slideIn {
    from {
        transform: translateX(100%) scale(0.9);
        opacity: 0;
    }

    to {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0) scale(1);
        opacity: 1;
    }

    to {
        transform: translateX(100%) scale(0.9);
        opacity: 0;
    }
}


::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #48484a;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #F5E985;
}


#preview::-webkit-scrollbar-thumb {
    background: #d1d1d6;
}

#preview::-webkit-scrollbar-thumb:hover {
    background: #F5E985;
}


.autocomplete-container {
    position: absolute;
    z-index: 1000;
    display: none;
    max-height: 200px;
    background: #252526;
    border: 1px solid #454545;
    border-radius: 3px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
    overflow-y: auto;
    width: auto;
    min-width: 240px;
    max-width: 350px;
    animation: fadeInAutocomplete 0.1s ease;
    backdrop-filter: blur(10px);
    transform-origin: top left;
    transition: left 0.1s ease-out, top 0.1s ease-out;
}

@keyframes fadeInAutocomplete {
    from {
        opacity: 0;
        transform: translateY(-2px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.autocomplete-list {
    list-style: none;
    padding: 2px 0;
    margin: 0;
}

.autocomplete-item {
    padding: 4px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px;
    color: #ffffff;
    transition: background 0.1s, transform 0.1s;
    border-left: 3px solid transparent;
}

.autocomplete-item:hover {
    background: #2a2d2e;
}

.autocomplete-item.selected {
    background: #04395e;
    color: #ffffff;
    border-left-color: #0e639c;
}


.autocomplete-item.semi-focused {
    background: #2d2d30;
    border-left-color: #565656;
}

.autocomplete-item.selected .item-icon,
.autocomplete-item:hover .item-icon {
    color: #F5E985;
    opacity: 1;
}


.autocomplete-item.semi-focused .item-icon {
    color: #D1CCA1;
    opacity: 0.9;
}

.autocomplete-item .item-icon {
    opacity: 0.7;
    font-size: 16px;
}

/* Ensure Material Symbols in autocomplete are properly styled */
.autocomplete-item .material-symbols-outlined.item-icon {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    line-height: 1;
}

.autocomplete-item .item-text {
    flex: 1;
}

.autocomplete-item .item-type {
    font-size: 11px;
    opacity: 0.7;
    padding: 2px 6px;
    background: #38383a;
    border-radius: 4px;
    font-family: 'IBM Plex Sans', sans-serif;
    letter-spacing: -0.2px;
    font-weight: 500;
}


.autocomplete-container::-webkit-scrollbar {
    width: 6px;
}

.autocomplete-container::-webkit-scrollbar-track {
    background: transparent;
}

.autocomplete-container::-webkit-scrollbar-thumb {
    background: #48484a;
    border-radius: 3px;
}

.autocomplete-container::-webkit-scrollbar-thumb:hover {
    background: #F5E985;
}


#preview button {
    background-color: #F5E985;
    color: #1d1d1f;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 500;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

#preview button:hover {
    background-color: #f0e270;
    transform: translateY(-1px);
}

#preview button:active {
    transform: translateY(1px);
}

#preview input[type="text"],
#preview input[type="email"],
#preview input[type="password"],
#preview input[type="number"],
#preview input[type="search"],
#preview input[type="tel"],
#preview input[type="url"] {
    border: 1px solid #d1d1d6;
    border-radius: 6px;
    padding: 8px 12px;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 16px;
    background-color: #ffffff;
    color: #1d1d1f;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
    max-width: 300px;
}

#preview input:focus {
    border-color: #F5E985;
    box-shadow: 0 0 0 2px rgba(245, 233, 133, 0.3);
}

#preview form {
    margin: 1.5em 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 500px;
}


#preview form group,
#preview group {
    margin-bottom: 16px;
}


#preview group:has(button) {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

#preview button+button {
    margin-left: 8px;
}


#preview a.button-link {
    display: inline-block;
    background-color: #F5E985;
    color: #1d1d1f;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 500;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    text-decoration: none;
}

#preview a.button-link:hover {
    background-color: #f0e270;
    transform: translateY(-1px);
    text-decoration: none;
}

#preview a.button-link:active {
    transform: translateY(1px);
}

/* Menu Bar Styling */
.menu-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #1c1c1e;
    border-bottom: 1px solid #343438;
    padding: 0 16px;
    height: 48px;
    position: relative;
    z-index: 110000;
}

.branding {
    display: flex;
    align-items: center;
    gap: 10px;
}

.branding img {
    height: 24px;
    width: auto;
}

.branding .title {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 600;
    font-size: 18px;
    color: #F5E985;
    margin: 0;
}

.menu-container {
    flex-grow: 1;
    display: flex;
    justify-content: flex-start;
    margin-left: 20px;
}

.menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
}

.menu-item {
    position: relative;
    color: #e1e1e1;
    cursor: pointer;
    z-index: 110000;
}

.menu-item > span {
    display: block;
    padding: 0 12px;
    height: 48px;
    line-height: 48px;
    font-size: 14px;
}

.menu-item:hover > span {
    background-color: #2c2c2e;
}

.submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #2c2c2e;
    border: 1px solid #444446;
    border-radius: 6px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    min-width: 220px;
    padding: 5px 0;
    z-index: 110000;
}

.menu-item:hover .submenu {
    display: block;
    animation: fadeInMenu 0.15s ease;
}

@keyframes fadeInMenu {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.submenu a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    color: #e1e1e1;
    text-decoration: none;
    font-size: 14px;
    white-space: nowrap;
}

.submenu a:hover {
    background-color: #3c3c3e;
}

.shortcut {
    color: #999;
    margin-left: 20px;
    font-size: 12px;
}

/* Toggle Preview - when preview is hidden */
.preview-hidden .editor-panel {
    flex: 1;
}

.preview-hidden .preview-panel {
    display: none;
}

/* Modal Dialog Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1003;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background-color: #2c2c2e;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    width: 400px;
    max-width: 90%;
    overflow: hidden;
    animation: scaleIn 0.2s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #444446;
    position: relative;
}

.modal-header img {
    margin-right: 12px;
}

.modal-header h2 {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 600;
    font-size: 18px;
    color: #F5E985;
    margin: 0;
}

.modal-close {
    position: absolute;
    right: 16px;
    top: 16px;
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.modal-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.modal-body {
    padding: 20px;
    color: #e1e1e1;
    font-size: 14px;
    line-height: 1.6;
}

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}