:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --secondary-hover: #475569;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --border-color: #e2e8f0;
    --background-color: #ffffff;
    --surface-color: #f8fafc;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: 'Noto Sans', sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.header {
    text-align: center;
    margin-bottom: 3rem;
}

.header h1 {
    font-family: 'Cal Sans', sans-serif;
    font-size: 3rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--success-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header p {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    min-height: 70vh;
}

.main-content.builder-collapsed {
    grid-template-columns: 60px 1fr;
}

.builder-panel,
.preview-panel {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.builder-panel.collapsed {
    padding: 1rem 0.5rem;
    overflow: hidden;
}

.builder-panel.collapsed .panel-header h2,
.builder-panel.collapsed .menu-builder,
.builder-panel.collapsed .panel-footer {
    display: none;
}

.builder-panel.collapsed .panel-header {
    justify-content: center;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    margin-bottom: 1rem;
}

.builder-panel.collapsed .toggle-icon {
    transform: rotate(90deg);
}

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

.panel-header h2 {
    font-family: 'Cal Sans', sans-serif;
    font-size: 1.8rem;
    font-weight: 600;
}

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

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.btn.primary {
    background-color: var(--primary-color);
    color: white;
}

.btn.primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn.secondary {
    background-color: white;
    color: var(--secondary-color);
    border: 1px solid var(--border-color);
}

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

.btn.danger {
    background-color: var(--danger-color);
    color: white;
}

.btn.danger:hover {
    background-color: #dc2626;
}

.btn.small {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

.menu-builder {
    min-height: 400px;
    margin-bottom: 2rem;
}

.menu-item {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
    transition: all 0.2s ease;
}

.menu-item:hover {
    box-shadow: var(--shadow);
}

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

.menu-header input {
    border: none;
    background: transparent;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
    flex: 1;
    margin-right: 1rem;
}

.menu-header input:focus {
    outline: none;
}

.menu-actions {
    display: flex;
    gap: 0.5rem;
}

.submenu-list {
    padding: 1rem;
}

.submenu-item {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background-color: #fafafa;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.submenu-item:hover {
    background-color: #f0f0f0;
}

.submenu-item input {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.5rem;
    flex: 1;
}

.submenu-item input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.submenu-item input[type="url"] {
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
}

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

.menu-preview {
    min-height: 400px;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-hint {
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.preview-menu {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.preview-menu-header {
    background: var(--primary-color);
    color: white;
    padding: 1rem;
    font-weight: 600;
}

.preview-submenu {
    padding: 0;
}

.preview-submenu-item {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.preview-submenu-item:hover {
    background-color: var(--surface-color);
    cursor: pointer;
}

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

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 1200px;
    height: 80%;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.modal.fullscreen .modal-content {
    position: fixed;
    top: 0;
    left: 0;
    transform: none;
    width: 100%;
    height: 100%;
    max-width: none;
    border-radius: 0;
}

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

.modal-header h3 {
    font-family: 'Cal Sans', sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
}

.modal-header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

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

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    height: calc(100% - 80px);
}

#simulator-frame {
    width: 100%;
    height: 100%;
    border: none;
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .main-content {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .main-content.builder-collapsed {
        grid-template-columns: 1fr;
    }
    
    .builder-panel.collapsed {
        display: none;
    }
    
    .panel-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .panel-header-actions {
        flex-wrap: wrap;
    }
    
    .panel-footer {
        flex-wrap: wrap;
    }
    
    .modal-content {
        width: 95%;
        height: 90%;
    }
    
    .submenu-item {
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
    }
}

/* Animation keyframes */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.menu-item {
    animation: slideIn 0.3s ease;
}

.fullscreen-icon {
    font-size: 0.9rem;
}

.toggle-icon {
    font-weight: bold;
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}