:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-main: #0f172a;
    --bg-sidebar: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --glass: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header / Toolbar */
.toolbar {
    height: 64px;
    background-color: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.device-toggles {
    display: flex;
    background: var(--bg-main);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.device-btn {
    padding: 6px 12px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.device-btn.active {
    background: var(--primary);
    color: white;
}

.actions {
    display: flex;
    gap: 12px;
}

.btn {
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border);
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: transparent;
    color: var(--text-main);
}

.btn-secondary:hover {
    background: var(--border);
}

/* Main Layout */
.editor-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 320px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 64px);
    overflow-y: auto;
    padding-bottom: 40px;
}

/* Custom Scrollbar for Sidebar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #3f3f46;
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #52525b;
}

#context-panel {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #1e1e2e;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    border-bottom: 2px solid var(--primary);
    margin-top: 0 !important;
    padding: 20px;
}

.context-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.context-header h3 {
    margin: 0;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.control-group {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.control-group h3 {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.control-field {
    margin-bottom: 16px;
}

.control-label {
    display: block;
    font-size: 0.875rem;
    margin-bottom: 8px;
    color: var(--text-main);
}

.input-text {
    width: 100%;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 12px;
    color: var(--text-main);
    outline: none;
}

.input-text:focus {
    border-color: var(--primary);
}

.input-color {
    width: 100%;
    height: 40px;
    padding: 2px;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
}

/* Preview Area */
.preview-area {
    flex: 1;
    background-color: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    position: relative;
    overflow: auto;
}

.iframe-wrapper {
    background: white;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transition: width 0.3s ease;
    border-radius: 8px;
    overflow: hidden;
}

.preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.device-desktop .iframe-wrapper {
    width: 100%;
    height: 100%;
}

.device-tablet .iframe-wrapper {
    width: 768px;
    height: 1024px;
    max-height: 100%;
}

.device-mobile .iframe-wrapper {
    width: 375px;
    height: 667px;
    max-height: 100%;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}


/* Preview Modal */
.preview-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    padding: 0;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.preview-modal.active {
    display: flex;
}

.modal-content {
    position: relative;
    width: 95%;
    height: 90vh;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.preview-modal.active .modal-content {
    transform: translateY(0);
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 24px;
    color: #000;
    z-index: 2100;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border: none;
    transition: all 0.2s;
}

.close-modal:hover {
    transform: scale(1.1) rotate(90deg);
    background: #ef4444;
    color: white;
}

#modal-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}