/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Modern Dark Theme Color Palette */
    --bg-primary: #0a0a0f;
    --bg-secondary: #1a1a23;
    --bg-tertiary: #2a2a35;
    --bg-editor: #161622;
    --bg-hover: #3a3a4a;

    /* Text Colors */
    --text-primary: #f8f8ff;
    --text-secondary: #b8b8c8;
    --text-muted: #6b6b80;

    /* Accent Colors */
    --accent-primary: #818cf8;
    --accent-secondary: #6366f1;
    --accent-glow: #a5b4fc;

    /* Border and Shadows */
    --border-subtle: rgba(255, 255, 255, 0.05);
    --border-medium: rgba(255, 255, 255, 0.1);
    --shadow-glow: 0 0 20px rgba(129, 140, 248, 0.15);
    --shadow-panel: 0 10px 40px rgba(0, 0, 0, 0.3);

    /* Glass Morphism */
    --glass-bg: rgba(26, 26, 35, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-blur: blur(12px);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 50%, var(--bg-primary) 100%);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 80%, rgba(129, 140, 248, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(167, 139, 250, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(196, 181, 253, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 1;
}

/* Container Layout */
.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: relative;
    z-index: 2;
}

/* Header Styles */
.header {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--glass-border);
    padding: 1.25rem 2rem;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--accent-glow) 20%,
        var(--accent-glow) 80%,
        transparent 100%);
    opacity: 0.5;
    animation: headerGlow 3s ease-in-out infinite;
}

@keyframes headerGlow {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 100%;
    position: relative;
    z-index: 3;
}

.title {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-glow) 0%, var(--text-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.title-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(129, 140, 248, 0.3);
    animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.title-icon svg {
    width: 20px;
    height: 20px;
    color: white;
}

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

/* Theme Toggle */
.theme-toggle {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    position: relative;
    overflow: hidden;
}

.theme-toggle:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.theme-toggle:hover svg {
    color: var(--accent-glow);
}

/* Button Styles */
.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(8px);
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(129, 140, 248, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(129, 140, 248, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--glass-bg);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
    box-shadow: 0 4px 20px rgba(129, 140, 248, 0.15);
    transform: translateY(-1px);
}

.btn-secondary:active {
    transform: translateY(0);
}

.btn-small {
    padding: 0.375rem 0.875rem;
    font-size: 0.8rem;
    border-radius: 10px;
}

.btn-icon {
    padding: 0.5rem;
    border-radius: 10px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn svg {
    width: 16px;
    height: 16px;
}

.btn-small svg {
    width: 14px;
    height: 14px;
}

/* Main Content Layout */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Panel Styles */
.panel {
    display: flex;
    flex-direction: column;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    overflow: hidden;
    margin: 1rem;
    box-shadow: var(--shadow-panel);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.panel:hover {
    border-color: var(--border-medium);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.4);
}

.editor-panel {
    flex: 1;
    min-width: 300px;
    margin-left: 1rem;
    margin-right: 0.5rem;
}

.preview-panel {
    flex: 1;
    min-width: 300px;
    margin-left: 0.5rem;
    margin-right: 1rem;
    /* Fix: Prevent any transform effects */
    transform: none !important;
    transition: none !important;
    will-change: auto !important;
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
}

/* Additional overrides to prevent any movement */
.preview-panel *,
.preview-panel *:hover,
.preview-panel *:active {
    transform: none !important;
    transition: transform 0s !important;
}

.preview-panel:hover {
    transform: none !important;
    transition: none !important;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border-subtle);
    position: relative;
}

.panel-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 1.5rem;
    right: 1.5rem;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--accent-primary) 10%,
        var(--accent-primary) 90%,
        transparent 100%);
    opacity: 0.3;
}

.panel-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.panel-icon {
    width: 20px;
    height: 20px;
    color: var(--accent-glow);
}

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

.editor-info {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--glass-bg);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    border: 1px solid var(--border-subtle);
    backdrop-filter: blur(8px);
}

.preview-controls {
    display: flex;
    gap: 0.5rem;
}

/* Editor Styles */
.editor-container {
    flex: 1;
    padding: 1.5rem;
    overflow: hidden;
    position: relative;
}

.editor-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    background: var(--bg-editor);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
}

.line-numbers {
    position: absolute;
    left: 0;
    top: 0;
    width: 50px;
    height: 100%;
    background: var(--bg-primary);
    border-right: 1px solid var(--border-subtle);
    padding: 1rem 0;
    overflow: hidden;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-muted);
    text-align: right;
    padding-right: 0.75rem;
    user-select: none;
}

.code-editor {
    width: 100%;
    height: 100%;
    background: transparent;
    color: var(--text-primary);
    border: none;
    padding: 1rem 1rem 1rem 60px;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    outline: none;
    tab-size: 2;
    position: relative;
    z-index: 1;
}

.code-editor:focus {
    outline: none;
}

.code-editor::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

/* Syntax Highlighting */
.code-editor {
    caret-color: var(--accent-glow);
}

/* Selection Styling */
.code-editor::selection {
    background: rgba(129, 140, 248, 0.2);
}

.code-editor::-moz-selection {
    background: rgba(129, 140, 248, 0.2);
}

/* Scrollbar for Editor */
.code-editor::-webkit-scrollbar {
    width: 12px;
}

.code-editor::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-right: 1px solid var(--border-subtle);
}

.code-editor::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: 6px;
}

.code-editor::-webkit-scrollbar-thumb:hover {
    background: var(--bg-tertiary);
}

/* Preview Styles */
.preview-container {
    flex: 1;
    padding: 1.5rem;
    overflow: hidden;
    position: relative;
}

.preview-frame {
    width: 100%;
    height: 100%;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    background: white;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.1);
    /* Fix: Prevent transform transitions */
    transition: border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: none !important;
}

.preview-frame:hover {
    border-color: var(--border-medium);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    /* Fix: Prevent transform on hover */
    transform: none !important;
}

/* Loading State for Preview */
.preview-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
}

.preview-loading.active {
    display: block;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-subtle);
    border-top: 3px solid var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Resizer Styles */
.resizer {
    width: 12px;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    cursor: col-resize;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 1px solid var(--border-subtle);
    border-right: 1px solid var(--border-subtle);
    margin: 1rem 0;
}

.resizer:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

.resizer::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 48px;
    background: linear-gradient(180deg,
        transparent 0%,
        var(--accent-primary) 20%,
        var(--accent-primary) 80%,
        transparent 100%);
    border-radius: 2px;
    opacity: 0.5;
    transition: all 0.3s ease;
}

.resizer:hover::before {
    opacity: 0.8;
    height: 56px;
}

.resizer:active {
    background: var(--bg-tertiary);
}

.resizer:active::before {
    opacity: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        padding: 1rem;
    }

    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .title {
        font-size: 1.25rem;
    }

    .controls {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .main-content {
        flex-direction: column;
    }

    .resizer {
        width: 100%;
        height: 12px;
        cursor: row-resize;
        margin: 0 1rem;
        border-left: none;
        border-right: none;
        border-top: 1px solid var(--border-subtle);
        border-bottom: 1px solid var(--border-subtle);
    }

    .resizer::before {
        width: 48px;
        height: 4px;
        background: linear-gradient(90deg,
            transparent 0%,
            var(--accent-primary) 20%,
            var(--accent-primary) 80%,
            transparent 100%);
    }

    .panel {
        min-width: unset;
        min-height: 200px;
        margin: 0.5rem;
    }

    .editor-panel,
    .preview-panel {
        margin: 0.5rem;
    }
}

/* Animation and Transitions */
.btn:active {
    transform: translateY(0);
}

/* Custom Scrollbar Styles */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: 5px;
    transition: all 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-corner {
    background: var(--bg-primary);
}

/* Notification System */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 20px;
    border-radius: 12px;
    color: white;
    font-weight: 500;
    font-size: 0.875rem;
    z-index: 1000;
    transform: translateX(400px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 400px;
}

.notification.show {
    transform: translateX(0);
}

.notification-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.9) 0%, rgba(5, 150, 105, 0.9) 100%);
    border-color: rgba(16, 185, 129, 0.3);
}

.notification-error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.9) 0%, rgba(220, 38, 38, 0.9) 100%);
    border-color: rgba(239, 68, 68, 0.3);
}

.notification-info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.9) 0%, rgba(37, 99, 235, 0.9) 100%);
    border-color: rgba(59, 130, 246, 0.3);
}

.notification-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.notification-close {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 6px;
    padding: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.notification-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.notification-close svg {
    width: 16px;
    height: 16px;
    color: white;
}

/* Status Bar */
.status-bar {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border-top: 1px solid var(--border-subtle);
    padding: 0.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

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

.status-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-primary);
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Focus States */
.code-editor:focus ~ .line-numbers {
    background: var(--bg-editor);
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --border-subtle: rgba(255, 255, 255, 0.3);
        --border-medium: rgba(255, 255, 255, 0.5);
        --text-muted: #a0a0b0;
    }
}

/* =========================== */
/* Enhanced Editor Styles      */
/* =========================== */

/* Syntax Highlighting - No Overlay Approach */
/* Removed overlay container to prevent layering issues */

/* syntax-highlight-content removed - no longer using overlay approach */

/* Current Line Highlighting - Optimized */
.current-line-highlight {
    position: absolute;
    left: 0;
    right: 0;
    height: 21px; /* Match line height */
    background: rgba(129, 140, 248, 0.08);
    border-left: 3px solid var(--accent-primary);
    pointer-events: none;
    z-index: 1;
    /* Optimized transition for better performance */
    transition: transform 0.1s ease-out, opacity 0.1s ease-out;
    margin-left: 50px;
    /* Hardware acceleration */
    transform: translateZ(0);
    will-change: transform;
    /* Prevent layout reflows */
    contain: layout style paint;
}

/* Enhanced Selection */
.code-editor::selection {
    background: rgba(129, 140, 248, 0.3) !important;
}

.code-editor::-moz-selection {
    background: rgba(129, 140, 248, 0.3) !important;
}

/* Autocomplete Dropdown */
.autocomplete-dropdown {
    position: fixed;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    animation: autocompleteFadeIn 0.2s ease;
}

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

.autocomplete-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background: var(--accent-primary);
    color: white;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

/* =========================== */
/* Device Preview Styles       */
/* =========================== */

.device-selector {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    margin-bottom: 1rem;
    overflow: hidden;
    transition: all 0.3s ease;
}

.device-selector.collapsed .device-buttons,
.device-selector.collapsed .orientation-controls,
.device-selector.collapsed .breakpoint-info {
    display: none;
}

.device-selector-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--glass-bg);
}

.device-selector-header h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.device-selector-toggle {
    background: transparent;
    border: none;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
}

.device-selector-toggle:hover {
    background: var(--bg-hover);
    color: var(--accent-glow);
}

.device-selector-toggle svg {
    width: 16px;
    height: 16px;
}

.device-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.5rem;
    padding: 1rem;
}

.device-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
}

.device-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
    transform: translateY(-1px);
}

.device-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.device-icon {
    width: 24px;
    height: 24px;
    color: var(--accent-glow);
    display: flex;
    align-items: center;
    justify-content: center;
}

.device-btn.active .device-icon {
    color: white;
}

.device-icon svg {
    width: 20px;
    height: 20px;
}

.device-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

.device-size {
    font-size: 0.625rem;
    color: var(--text-muted);
}

.device-btn.active .device-name,
.device-btn.active .device-size {
    color: white;
}

.orientation-controls {
    display: flex;
    gap: 0.5rem;
    padding: 0 1rem 1rem;
    justify-content: center;
}

.orientation-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
}

.orientation-btn:hover {
    background: var(--bg-hover);
    color: var(--accent-glow);
}

.orientation-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.orientation-btn svg {
    width: 16px;
    height: 16px;
}

.breakpoint-info {
    padding: 1rem;
    border-top: 1px solid var(--border-subtle);
}

.breakpoint-info h4 {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 0.5rem 0;
}

.breakpoint-indicators {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.breakpoint-indicator {
    font-size: 0.625rem;
    padding: 0.25rem 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.breakpoint-indicator.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

/* Device Frame */
.device-frame {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.device-frame-shell {
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.device-screen-area {
    position: relative;
    overflow: hidden;
    background: white;
}

.device-notch {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 150px;
    height: 25px;
    background: var(--bg-secondary);
    border-radius: 0 0 15px 15px;
    z-index: 10;
}

/* Breakpoint Overlay */
.breakpoint-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 5;
}

.breakpoint-line {
    position: absolute;
    top: 0;
    width: 1px;
    height: 100%;
    background: var(--accent-primary);
    opacity: 0.3;
}

.breakpoint-label {
    position: absolute;
    top: 5px;
    font-size: 10px;
    color: var(--accent-primary);
    background: rgba(26, 26, 35, 0.8);
    padding: 2px 6px;
    border-radius: 3px;
    z-index: 6;
    transform: translateX(-50%);
}

/* Device Resize Handle */
.device-resize-handle {
    position: absolute;
    bottom: -10px;
    right: -10px;
    width: 20px;
    height: 20px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: nwse-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
}

.device-frame:hover .device-resize-handle {
    opacity: 1;
}

.device-resize-handle svg {
    width: 12px;
    height: 12px;
    color: white;
}

/* =========================== */
/* Error Detection Styles      */
/* =========================== */

.error-panel {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    margin-top: 1rem;
    overflow: hidden;
    transition: all 0.3s ease;
}

.error-panel.collapsed .error-list {
    display: none;
}

.error-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--glass-bg);
}

.error-panel-header h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.error-panel-toggle {
    background: transparent;
    border: none;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
}

.error-panel-toggle:hover {
    background: var(--bg-hover);
    color: var(--accent-glow);
}

.error-panel-toggle svg {
    width: 16px;
    height: 16px;
}

.error-list {
    max-height: 200px;
    overflow-y: auto;
}

.error-summary {
    display: flex;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.error-count,
.warning-count {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.error-count {
    color: #ef4444;
}

.warning-count {
    color: #f59e0b;
}

.error-icon,
.warning-icon {
    font-size: 0.875rem;
}

.error-items {
    padding: 0.5rem;
}

.no-issues {
    text-align: center;
    padding: 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.error-item {
    padding: 0.75rem 1rem;
    margin: 0.25rem 0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.error-item:hover {
    background: var(--bg-hover);
}

.error-item.error {
    border-left: 3px solid #ef4444;
}

.error-item.warning {
    border-left: 3px solid #f59e0b;
}

.error-item-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.error-item-icon {
    font-size: 0.75rem;
}

.error-item-position {
    font-size: 0.625rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

.error-item-message {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* =========================== */
/* Enhanced Editor UI          */
/* =========================== */

/* Current Line Indicator */
.line-numbers .current-line {
    background: var(--bg-editor);
    color: var(--text-primary);
    font-weight: 600;
}

/* Enhanced Caret - Fixed blinking issues */
.code-editor {
    caret-color: var(--accent-glow);
    /* Remove problematic animation that causes visual conflicts */
}

/* Enhanced Scrollbar for Syntax Highlighter - Removed (no overlay approach) */

/* =========================== */
/* Responsive Enhancements     */
/* =========================== */

@media (max-width: 1024px) {
    .device-buttons {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }

    .device-frame {
        transform: scale(0.8);
    }
}

@media (max-width: 768px) {
    .device-buttons {
        grid-template-columns: repeat(2, 1fr);
    }

    .device-frame {
        transform: scale(0.7);
    }

    .error-panel {
        font-size: 0.75rem;
    }

    .autocomplete-dropdown {
        font-size: 12px;
        max-height: 150px;
    }
}

@media (max-width: 480px) {
    .device-buttons {
        grid-template-columns: 1fr;
    }

    .device-frame {
        transform: scale(0.6);
    }

    .breakpoint-info h4 {
        font-size: 0.625rem;
    }

    .breakpoint-indicator {
        font-size: 0.5rem;
        padding: 0.125rem 0.375rem;
    }
}

/* =========================== */
/* Animation Enhancements      */
/* =========================== */

/* Device frame transitions */
.device-frame-shell {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.device-screen-area {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Error panel animations */
.error-item {
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Autocomplete animations */
.autocomplete-item {
    animation: fadeInUp 0.2s ease;
}

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

/* =========================== */
/* Performance Optimizations  */
/* =========================== */

/* Hardware acceleration for smooth animations */
.device-frame,
.device-frame-shell,
.device-screen-area,
.syntax-highlight-content,
.autocomplete-dropdown,
.error-panel {
    transform: translateZ(0);
    will-change: transform;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .device-frame,
    .device-frame-shell,
    .device-screen-area,
    .autocomplete-dropdown,
    .error-panel,
    .error-item,
    .autocomplete-item {
        animation: none !important;
        transition: none !important;
    }
}

/* =========================== */
/* Find and Replace Widget     */
/* =========================== */

/* Widget Container */
.find-replace-widget {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, opacity;
}

.find-replace-widget.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Widget Content */
.find-replace-content {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: var(--shadow-panel), var(--shadow-glow);
    min-width: 400px;
    max-width: 600px;
    overflow: hidden;
}

/* Search and Replace Rows */
.search-row,
.replace-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
}

.replace-row {
    border-bottom: none;
}

.find-replace-widget:not(.replace-mode) .replace-row {
    display: none;
}

/* Input Wrapper */
.input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon,
.replace-icon {
    position: absolute;
    left: 0.75rem;
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    z-index: 2;
    transition: color 0.2s ease;
}

.search-input,
.replace-input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.5rem;
    background: var(--bg-editor);
    border: 1px solid var(--border-medium);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    outline: none;
    transition: all 0.2s ease;
}

.search-input:focus,
.replace-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.1);
}

.search-input::placeholder,
.replace-input::placeholder {
    color: var(--text-muted);
}

/* Match Counter */
.match-counter {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 6px;
    min-width: 80px;
    justify-content: center;
}

.match-text {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Control Buttons */
.search-controls,
.replace-controls {
    display: flex;
    gap: 0.25rem;
}

.control-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-medium);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.control-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
}

.control-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.control-btn:focus {
    box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.2);
}

.btn-text {
    font-size: 0.75rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.control-btn:hover .btn-text,
.control-btn.active .btn-text {
    color: var(--text-primary);
}

/* Toggle replace button specific styling */
.toggle-replace-btn svg {
    width: 14px;
    height: 14px;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.control-btn:hover .toggle-replace-btn svg,
.control-btn.active .toggle-replace-btn svg {
    color: var(--text-primary);
}

/* Navigation Row */
.navigation-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-subtle);
}

.nav-controls {
    display: flex;
    gap: 0.25rem;
}

.btn-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-medium);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.btn-nav:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
}

.btn-nav:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-nav:focus:not(:disabled) {
    box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.2);
}

.btn-nav svg {
    width: 14px;
    height: 14px;
    color: var(--text-secondary);
}

.btn-nav:hover:not(:disabled) svg {
    color: var(--text-primary);
}

/* Close Button */
.close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    color: var(--text-muted);
}

.close-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.close-btn:focus {
    box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.2);
}

.close-btn svg {
    width: 14px;
    height: 14px;
}

/* Replace Buttons */
.replace-btn,
.replace-all-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.replace-btn:hover:not(:disabled),
.replace-all-btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

/* Search Highlights */
.highlight-overlay {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 1;
}

.search-highlight {
    background: rgba(129, 140, 248, 0.2);
    border: 1px solid rgba(129, 140, 248, 0.4);
    border-radius: 3px;
    transition: all 0.2s ease;
}

.search-highlight.current-match {
    background: rgba(129, 140, 248, 0.4);
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.6);
}

/* Responsive Design */
@media (max-width: 768px) {
    .find-replace-widget {
        top: 0.5rem;
        right: 0.5rem;
        left: 0.5rem;
    }

    .find-replace-content {
        min-width: auto;
        max-width: none;
    }

    .search-row,
    .replace-row {
        padding: 0.5rem;
        gap: 0.25rem;
    }

    .match-counter {
        min-width: 60px;
        padding: 0.375rem 0.5rem;
    }

    .control-btn {
        width: 28px;
        height: 28px;
    }

    .btn-text {
        font-size: 0.625rem;
    }

    .search-input,
    .replace-input {
        padding: 0.375rem 0.75rem 0.375rem 2rem;
        font-size: 0.75rem;
    }

    .navigation-row {
        padding: 0.375rem 0.5rem;
    }

    .btn-nav {
        width: 24px;
        height: 24px;
    }

    .btn-nav svg {
        width: 12px;
        height: 12px;
    }

    .close-btn {
        width: 24px;
        height: 24px;
    }

    .close-btn svg {
        width: 12px;
        height: 12px;
    }
}

@media (max-width: 480px) {
    .search-row,
    .replace-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .input-wrapper {
        order: 1;
    }

    .match-counter {
        order: 2;
        justify-content: center;
    }

    .search-controls,
    .replace-controls {
        order: 3;
        justify-content: center;
    }

    .navigation-row {
        justify-content: center;
        gap: 1rem;
    }

    .nav-controls {
        order: 1;
    }

    .close-btn {
        order: 2;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .find-replace-widget {
        border: 2px solid var(--text-primary);
    }

    .search-input,
    .replace-input {
        border: 2px solid var(--text-primary);
    }

    .control-btn,
    .btn-nav {
        border: 2px solid var(--text-primary);
    }

    .search-highlight {
        border: 2px solid var(--accent-primary);
    }
}

/* Animation Enhancements */
@keyframes widgetSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes highlightPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

.find-replace-widget.visible .find-replace-content {
    animation: widgetSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-highlight.current-match {
    animation: highlightPulse 2s ease-in-out infinite;
}

/* Performance Optimizations */
.find-replace-widget,
.find-replace-content,
.search-highlight,
.control-btn,
.btn-nav {
    transform: translateZ(0);
    will-change: transform;
}